OLD | NEW |
1 #################### COMPILE OPTIONS ####################### | 1 #################### COMPILE OPTIONS ####################### |
2 | 2 |
3 # Uncomment this for fixed-point build | 3 # Uncomment this for fixed-point build |
4 #FIXED_POINT=1 | 4 #FIXED_POINT=1 |
5 | 5 |
6 # It is strongly recommended to uncomment one of these | 6 # It is strongly recommended to uncomment one of these |
7 # VAR_ARRAYS: Use C99 variable-length arrays for stack allocation | 7 # VAR_ARRAYS: Use C99 variable-length arrays for stack allocation |
8 # USE_ALLOCA: Use alloca() for stack allocation | 8 # USE_ALLOCA: Use alloca() for stack allocation |
9 # If none is defined, then the fallback is a non-threadsafe global array | 9 # If none is defined, then the fallback is a non-threadsafe global array |
10 CFLAGS := -DUSE_ALLOCA $(CFLAGS) | 10 CFLAGS := -DUSE_ALLOCA $(CFLAGS) |
11 #CFLAGS := -DVAR_ARRAYS $(CFLAGS) | 11 #CFLAGS := -DVAR_ARRAYS $(CFLAGS) |
12 | 12 |
13 # These options affect performance | 13 # These options affect performance |
14 # HAVE_LRINTF: Use C99 intrinsics to speed up float-to-int conversion | 14 # HAVE_LRINTF: Use C99 intrinsics to speed up float-to-int conversion |
15 # inline: Don't use the 'inline' keyword (for ANSI C compilers) | 15 # inline: Don't use the 'inline' keyword (for ANSI C compilers) |
16 # restrict: Don't use the 'restrict' keyword (for pre-C99 compilers) | 16 # restrict: Don't use the 'restrict' keyword (for pre-C99 compilers) |
17 #CFLAGS := -DHAVE_LRINTF $(CFLAGS) | 17 #CFLAGS := -DHAVE_LRINTF $(CFLAGS) |
18 #CFLAGS := -Dinline= $(CFLAGS) | 18 #CFLAGS := -Dinline= $(CFLAGS) |
19 CFLAGS := -Drestrict= $(CFLAGS) | 19 CFLAGS := -Drestrict= $(CFLAGS) |
20 | 20 |
21 ###################### END OF OPTIONS ###################### | 21 ###################### END OF OPTIONS ###################### |
22 | 22 |
23 include version.mk | 23 -include package_version |
24 CFLAGS += -DOPUS_VERSION='$(OPUS_VERSION)' | 24 |
25 include silk_sources.mk | 25 include silk_sources.mk |
26 include celt_sources.mk | 26 include celt_sources.mk |
27 include opus_sources.mk | 27 include opus_sources.mk |
28 | 28 |
29 ifdef FIXED_POINT | 29 ifdef FIXED_POINT |
30 SILK_SOURCES += $(SILK_SOURCES_FIXED) | 30 SILK_SOURCES += $(SILK_SOURCES_FIXED) |
31 else | 31 else |
32 SILK_SOURCES += $(SILK_SOURCES_FLOAT) | 32 SILK_SOURCES += $(SILK_SOURCES_FLOAT) |
| 33 OPUS_SOURCES += $(OPUS_SOURCES_FLOAT) |
33 endif | 34 endif |
34 | 35 |
35 EXESUFFIX = | 36 EXESUFFIX = |
36 LIBPREFIX = lib | 37 LIBPREFIX = lib |
37 LIBSUFFIX = .a | 38 LIBSUFFIX = .a |
38 OBJSUFFIX = .o | 39 OBJSUFFIX = .o |
39 | 40 |
40 CC = $(TOOLCHAIN_PREFIX)cc$(TOOLCHAIN_SUFFIX) | 41 CC = $(TOOLCHAIN_PREFIX)cc$(TOOLCHAIN_SUFFIX) |
41 AR = $(TOOLCHAIN_PREFIX)ar | 42 AR = $(TOOLCHAIN_PREFIX)ar |
42 RANLIB = $(TOOLCHAIN_PREFIX)ranlib | 43 RANLIB = $(TOOLCHAIN_PREFIX)ranlib |
43 CP = $(TOOLCHAIN_PREFIX)cp | 44 CP = $(TOOLCHAIN_PREFIX)cp |
44 | 45 |
45 cppflags-from-defines = $(addprefix -D,$(1)) | 46 cppflags-from-defines = $(addprefix -D,$(1)) |
46 cppflags-from-includes = $(addprefix -I,$(1)) | 47 cppflags-from-includes = $(addprefix -I,$(1)) |
47 ldflags-from-ldlibdirs = $(addprefix -L,$(1)) | 48 ldflags-from-ldlibdirs = $(addprefix -L,$(1)) |
48 ldlibs-from-libs = $(addprefix -l,$(1)) | 49 ldlibs-from-libs = $(addprefix -l,$(1)) |
49 | 50 |
50 WARNINGS = -Wall -W -Wstrict-prototypes -Wextra -Wcast-align -Wnested-externs -W
shadow | 51 WARNINGS = -Wall -W -Wstrict-prototypes -Wextra -Wcast-align -Wnested-externs -W
shadow |
51 CFLAGS += -O2 -g $(WARNINGS) -DOPUS_BUILD | 52 CFLAGS += -O2 -g $(WARNINGS) -DOPUS_BUILD |
| 53 CINCLUDES = include silk celt |
| 54 |
52 ifdef FIXED_POINT | 55 ifdef FIXED_POINT |
53 CFLAGS += -DFIXED_POINT=1 -DDISABLE_FLOAT_API | 56 CFLAGS += -DFIXED_POINT=1 -DDISABLE_FLOAT_API |
| 57 CINCLUDES += silk/fixed |
| 58 else |
| 59 CINCLUDES += silk/float |
54 endif | 60 endif |
55 | 61 |
56 CINCLUDES += include/ \ | |
57 silk/ \ | |
58 silk/float/ \ | |
59 silk/fixed/ \ | |
60 celt/ \ | |
61 src/ | |
62 | |
63 # VPATH e.g. VPATH = src:../headers | |
64 VPATH = ./ \ | |
65 silk/interface \ | |
66 silk/src_FIX \ | |
67 silk/src_FLP \ | |
68 silk/src_SigProc_FIX \ | |
69 silk/src_SigProc_FLP \ | |
70 test | |
71 | 62 |
72 LIBS = m | 63 LIBS = m |
73 | 64 |
74 LDLIBDIRS = ./ | 65 LDLIBDIRS = ./ |
75 | 66 |
76 CFLAGS += $(call cppflags-from-defines,$(CDEFINES)) | 67 CFLAGS += $(call cppflags-from-defines,$(CDEFINES)) |
77 CFLAGS += $(call cppflags-from-includes,$(CINCLUDES)) | 68 CFLAGS += $(call cppflags-from-includes,$(CINCLUDES)) |
78 LDFLAGS += $(call ldflags-from-ldlibdirs,$(LDLIBDIRS)) | 69 LDFLAGS += $(call ldflags-from-ldlibdirs,$(LDLIBDIRS)) |
79 LDLIBS += $(call ldlibs-from-libs,$(LIBS)) | 70 LDLIBS += $(call ldlibs-from-libs,$(LIBS)) |
80 | 71 |
(...skipping 20 matching lines...) Expand all Loading... |
101 | 92 |
102 OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(SRCS_C)) | 93 OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(SRCS_C)) |
103 | 94 |
104 OPUSDEMO_SRCS_C = src/opus_demo.c | 95 OPUSDEMO_SRCS_C = src/opus_demo.c |
105 OPUSDEMO_OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(OPUSDEMO_SRCS_C)) | 96 OPUSDEMO_OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(OPUSDEMO_SRCS_C)) |
106 | 97 |
107 OPUSCOMPARE_SRCS_C = src/opus_compare.c | 98 OPUSCOMPARE_SRCS_C = src/opus_compare.c |
108 OPUSCOMPARE_OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(OPUSCOMPARE_SRCS_C)) | 99 OPUSCOMPARE_OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(OPUSCOMPARE_SRCS_C)) |
109 | 100 |
110 # Rules | 101 # Rules |
111 default: all | 102 all: lib opus_demo opus_compare |
112 | |
113 all: $(TARGET) lib opus_demo opus_compare | |
114 | 103 |
115 lib: $(TARGET) | 104 lib: $(TARGET) |
116 | 105 |
117 $(TARGET): $(OBJS) | 106 $(TARGET): $(OBJS) |
118 $(ARCHIVE.cmdline) | 107 $(ARCHIVE.cmdline) |
119 | 108 |
120 opus_demo$(EXESUFFIX): $(OPUSDEMO_OBJS) $(TARGET) | 109 opus_demo$(EXESUFFIX): $(OPUSDEMO_OBJS) $(TARGET) |
121 $(LINK.o.cmdline) | 110 $(LINK.o.cmdline) |
122 | 111 |
123 opus_compare$(EXESUFFIX): $(OPUSCOMPARE_OBJS) | 112 opus_compare$(EXESUFFIX): $(OPUSCOMPARE_OBJS) |
124 $(LINK.o.cmdline) | 113 $(LINK.o.cmdline) |
125 | 114 |
| 115 celt/celt.o: CFLAGS += -DPACKAGE_VERSION='$(PACKAGE_VERSION)' |
| 116 celt/celt.o: package_version |
| 117 |
| 118 package_version: force |
| 119 @if [ -x ./update_version ]; then \ |
| 120 ./update_version || true; \ |
| 121 elif [ ! -e ./package_version ]; then \ |
| 122 echo 'PACKAGE_VERSION="unknown"' > ./package_version; \ |
| 123 fi |
| 124 |
| 125 force: |
| 126 |
126 clean: | 127 clean: |
127 » rm -f opus_demo$(EXESUFFIX) opus_compare$(EXESUFFIX) $(TARGET) $(OBJS) $
(OPUSDEMO_OBJS) | 128 » rm -f opus_demo$(EXESUFFIX) opus_compare$(EXESUFFIX) $(TARGET) \ |
| 129 » » $(OBJS) $(OPUSDEMO_OBJS) $(OPUSCOMPARE_OBJS) |
| 130 |
| 131 .PHONY: all lib clean |
OLD | NEW |