Makefile.draft 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #################### COMPILE OPTIONS #######################
  2. # Uncomment this for fixed-point build
  3. #FIXED_POINT=1
  4. # It is strongly recommended to uncomment one of these
  5. # VAR_ARRAYS: Use C99 variable-length arrays for stack allocation
  6. # USE_ALLOCA: Use alloca() for stack allocation
  7. # If none is defined, then the fallback is a non-threadsafe global array
  8. CFLAGS := -DUSE_ALLOCA $(CFLAGS)
  9. #CFLAGS := -DVAR_ARRAYS $(CFLAGS)
  10. # These options affect performance
  11. # HAVE_LRINTF: Use C99 intrinsics to speed up float-to-int conversion
  12. # inline: Don't use the 'inline' keyword (for ANSI C compilers)
  13. # restrict: Don't use the 'restrict' keyword (for pre-C99 compilers)
  14. #CFLAGS := -DHAVE_LRINTF $(CFLAGS)
  15. #CFLAGS := -Dinline= $(CFLAGS)
  16. CFLAGS := -Drestrict= $(CFLAGS)
  17. ###################### END OF OPTIONS ######################
  18. CFLAGS += -DOPUS_VERSION='"0.9.14"'
  19. include silk_sources.mk
  20. include celt_sources.mk
  21. include opus_sources.mk
  22. ifdef FIXED_POINT
  23. SILK_SOURCES += $(SILK_SOURCES_FIXED)
  24. else
  25. SILK_SOURCES += $(SILK_SOURCES_FLOAT)
  26. endif
  27. EXESUFFIX =
  28. LIBPREFIX = lib
  29. LIBSUFFIX = .a
  30. OBJSUFFIX = .o
  31. CC = $(TOOLCHAIN_PREFIX)cc$(TOOLCHAIN_SUFFIX)
  32. AR = $(TOOLCHAIN_PREFIX)ar
  33. RANLIB = $(TOOLCHAIN_PREFIX)ranlib
  34. CP = $(TOOLCHAIN_PREFIX)cp
  35. cppflags-from-defines = $(addprefix -D,$(1))
  36. cppflags-from-includes = $(addprefix -I,$(1))
  37. ldflags-from-ldlibdirs = $(addprefix -L,$(1))
  38. ldlibs-from-libs = $(addprefix -l,$(1))
  39. WARNINGS = -Wall -W -Wstrict-prototypes -Wextra -Wcast-align -Wnested-externs -Wshadow
  40. CFLAGS += -O2 -g $(WARNINGS) -DOPUS_BUILD
  41. ifdef FIXED_POINT
  42. CFLAGS += -DFIXED_POINT=1 -DDISABLE_FLOAT_API
  43. endif
  44. CINCLUDES += include/ \
  45. silk/ \
  46. silk/float/ \
  47. silk/fixed/ \
  48. celt/ \
  49. src/
  50. # VPATH e.g. VPATH = src:../headers
  51. VPATH = ./ \
  52. silk/interface \
  53. silk/src_FIX \
  54. silk/src_FLP \
  55. silk/src_SigProc_FIX \
  56. silk/src_SigProc_FLP \
  57. test
  58. LIBS = m
  59. LDLIBDIRS = ./
  60. CFLAGS += $(call cppflags-from-defines,$(CDEFINES))
  61. CFLAGS += $(call cppflags-from-includes,$(CINCLUDES))
  62. LDFLAGS += $(call ldflags-from-ldlibdirs,$(LDLIBDIRS))
  63. LDLIBS += $(call ldlibs-from-libs,$(LIBS))
  64. COMPILE.c.cmdline = $(CC) -c $(CFLAGS) -o $@ $<
  65. LINK.o = $(CC) $(LDPREFLAGS) $(LDFLAGS)
  66. LINK.o.cmdline = $(LINK.o) $^ $(LDLIBS) -o $@$(EXESUFFIX)
  67. ARCHIVE.cmdline = $(AR) $(ARFLAGS) $@ $^ && $(RANLIB) $@
  68. %$(OBJSUFFIX):%.c
  69. $(COMPILE.c.cmdline)
  70. %$(OBJSUFFIX):%.cpp
  71. $(COMPILE.cpp.cmdline)
  72. # Directives
  73. # Variable definitions
  74. LIB_NAME = opus
  75. TARGET = $(LIBPREFIX)$(LIB_NAME)$(LIBSUFFIX)
  76. SRCS_C = $(SILK_SOURCES) $(CELT_SOURCES) $(OPUS_SOURCES)
  77. OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(SRCS_C))
  78. OPUSDEMO_SRCS_C = src/opus_demo.c
  79. OPUSDEMO_OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(OPUSDEMO_SRCS_C))
  80. OPUSCOMPARE_SRCS_C = src/opus_compare.c
  81. OPUSCOMPARE_OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(OPUSCOMPARE_SRCS_C))
  82. # Rules
  83. default: all
  84. all: $(TARGET) lib opus_demo opus_compare
  85. lib: $(TARGET)
  86. $(TARGET): $(OBJS)
  87. $(ARCHIVE.cmdline)
  88. opus_demo$(EXESUFFIX): $(OPUSDEMO_OBJS) $(TARGET)
  89. $(LINK.o.cmdline)
  90. opus_compare$(EXESUFFIX): $(OPUSCOMPARE_OBJS)
  91. $(LINK.o.cmdline)
  92. clean:
  93. rm -f opus_demo$(EXESUFFIX) opus_compare$(EXESUFFIX) $(TARGET) $(OBJS) $(OPUSDEMO_OBJS)