Updating the build of the draft and adding fixed-point support
[opus.git] / Makefile.draft
1 FIXED_POINT=1
2
3 include silk_sources.mk
4 include celt_sources.mk
5 include opus_sources.mk
6
7 EXESUFFIX =
8 LIBPREFIX = lib
9 LIBSUFFIX = .a
10 OBJSUFFIX = .o
11
12 CC     = $(TOOLCHAIN_PREFIX)gcc$(TOOLCHAIN_SUFFIX)
13 CXX    = $(TOOLCHAIN_PREFIX)g++$(TOOLCHAIN_SUFFIX)
14 AR     = $(TOOLCHAIN_PREFIX)ar
15 RANLIB = $(TOOLCHAIN_PREFIX)ranlib
16 CP     = $(TOOLCHAIN_PREFIX)cp
17
18 cppflags-from-defines   = $(addprefix -D,$(1))
19 cppflags-from-includes  = $(addprefix -I,$(1))
20 ldflags-from-ldlibdirs  = $(addprefix -L,$(1))
21 ldlibs-from-libs                = $(addprefix -l,$(1))
22
23 WARNINGS = -Wall -W -Wstrict-prototypes -Wextra -Wcast-align -Wnested-externs -Wshadow -Wno-parentheses -Wno-unused-parameter -Wno-sign-compare
24 CFLAGS  += -O2 -g $(WARNINGS) -DOPUS_BUILD -Drestrict=
25 ifdef FIXED_POINT
26 CFLAGS += -DFIXED_POINT=1
27 endif
28
29 CFLAGS  += $(call cppflags-from-defines,$(CDEFINES))
30 CFLAGS  += $(call cppflags-from-includes,$(CINCLUDES))
31 LDFLAGS += $(call ldflags-from-ldlibdirs,$(LDLIBDIRS))
32 LDLIBS  += $(call ldlibs-from-libs,$(LIBS))
33
34 COMPILE.c.cmdline   = $(CC) -c $(CFLAGS) -o $@ $<
35 COMPILE.cpp.cmdline = $(CXX) -c $(CFLAGS) -o $@ $<
36 LINK.o              = $(CC) $(LDPREFLAGS) $(LDFLAGS)
37 LINK.o.cmdline      = $(LINK.o) $^ $(LDLIBS) -o $@$(EXESUFFIX)
38
39 ARCHIVE.cmdline     = $(AR) $(ARFLAGS) $@ $^ && $(RANLIB) $@
40
41 %$(OBJSUFFIX):%.c
42         $(COMPILE.c.cmdline)
43
44 %$(OBJSUFFIX):%.cpp
45         $(COMPILE.cpp.cmdline)
46
47 # Directives
48
49 CINCLUDES += silk/interface \
50         silk/src_common \
51         silk/test silk/src_FIX \
52         silk/src_FLP \
53         silk/src_SigProc_FIX \
54         silk/src_SigProc_FLP \
55         celt/libcelt \
56         src
57
58 # VPATH e.g. VPATH = src:../headers
59 VPATH = ./ \
60         silk/interface \
61         silk/src_FIX \
62         silk/src_FLP \
63         silk/src_SigProc_FIX \
64         silk/src_SigProc_FLP \
65         test
66
67 # Variable definitions
68 LIB_NAME = opus
69 TARGET = $(LIBPREFIX)$(LIB_NAME)$(LIBSUFFIX)
70
71 SRCS_C = $(SILK_SOURCES) $(CELT_SOURCES) $(OPUS_SOURCES)
72
73 OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(SRCS_C))
74
75 TESTOPUS_SRCS_C = src/test_opus.c
76 TESTOPUS_OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(TESTOPUS_SRCS_C))
77
78 LIBS = m
79
80 LDLIBDIRS = ./
81
82 # Rules
83 default: all
84
85 all: $(TARGET) lib test_opus
86
87 lib: $(TARGET)
88
89 $(TARGET): $(OBJS)
90         $(ARCHIVE.cmdline)
91
92 test_opus$(EXESUFFIX): $(TESTOPUS_OBJS) $(TARGET)
93         $(LINK.o.cmdline)
94         
95 clean:
96         rm -f test_opus$(EXESUFFIX) $(TARGET) $(OBJS) $(TESTOPUS_OBJS)