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