1# ---------------------------------------------------------------------------------
2#				MM-AUDIO-OSS-8K-AENC-AMR
3# ---------------------------------------------------------------------------------
4
5# cross-compiler flags
6CFLAGS += -Wall
7CFLAGS += -Wundef
8CFLAGS += -Wstrict-prototypes
9CFLAGS += -Wno-trigraphs
10
11# cross-compile flags specific to shared objects
12CFLAGS_SO += -fpic
13
14# required pre-processor flags
15CPPFLAGS := -D__packed__=
16CPPFLAGS += -DIMAGE_APPS_PROC
17CPPFLAGS += -DFEATURE_Q_SINGLE_LINK
18CPPFLAGS += -DFEATURE_Q_NO_SELF_QPTR
19CPPFLAGS += -DFEATURE_LINUX
20CPPFLAGS += -DFEATURE_NATIVELINUX
21CPPFLAGS += -DFEATURE_DSM_DUP_ITEMS
22
23CPPFLAGS += -g
24CPPFALGS += -D_DEBUG
25CPPFLAGS += -Iinc
26
27# linker flags
28LDFLAGS += -L$(SYSROOT)/usr/lib
29
30# linker flags for shared objects
31LDFLAGS_SO := -shared
32
33# defintions
34LIBMAJOR := $(basename $(basename $(LIBVER)))
35LIBINSTALLDIR := $(DESTDIR)usr/lib
36INCINSTALLDIR := $(DESTDIR)usr/include
37BININSTALLDIR := $(DESTDIR)usr/bin
38
39# ---------------------------------------------------------------------------------
40#					BUILD
41# ---------------------------------------------------------------------------------
42all: libOmxAmrEnc.so.$(LIBVER) mm-aenc-omxamr-test
43
44install:
45	echo "intalling aenc-amr in $(DESTDIR)"
46	if [ ! -d $(LIBINSTALLDIR) ]; then mkdir -p $(LIBINSTALLDIR); fi
47	if [ ! -d $(INCINSTALLDIR) ]; then mkdir -p $(INCINSTALLDIR); fi
48	if [ ! -d $(BININSTALLDIR) ]; then mkdir -p $(BININSTALLDIR); fi
49	install -m 555 libOmxAmrEnc.so.$(LIBVER) $(LIBINSTALLDIR)
50	cd $(LIBINSTALLDIR) && ln -s libOmxAmrEnc.so.$(LIBVER) libOmxAmrEnc.so.$(LIBMAJOR)
51	cd $(LIBINSTALLDIR) && ln -s libOmxAmrEnc.so.$(LIBMAJOR) libOmxAmrEnc.so
52	install -m 555 mm-aenc-omxamr-test $(BININSTALLDIR)
53
54# ---------------------------------------------------------------------------------
55#				COMPILE LIBRARY
56# ---------------------------------------------------------------------------------
57LDLIBS := -lpthread
58LDLIBS += -lstdc++
59LDLIBS += -lOmxCore
60
61SRCS := src/omx_amr_aenc.cpp
62SRCS += src/aenc_svr.c
63
64libOmxAmrEnc.so.$(LIBVER): $(SRCS)
65	$(CC) $(CPPFLAGS) $(CFLAGS_SO) $(LDFLAGS_SO) -Wl,-soname,libOmxAmrEnc.so.$(LIBMAJOR) -o $@ $^ $(LDFLAGS) $(LDLIBS)
66
67# ---------------------------------------------------------------------------------
68#				COMPILE TEST APP
69# ---------------------------------------------------------------------------------
70TEST_LDLIBS := -lpthread
71TEST_LDLIBS += -ldl
72TEST_LDLIBS += -lOmxCore
73
74TEST_SRCS := test/omx_amr_enc_test.c
75
76mm-aenc-omxamr-test: libOmxAmrEnc.so.$(LIBVER) $(TEST_SRCS)
77	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(TEST_LDLIBS)
78
79# ---------------------------------------------------------------------------------
80#					END
81# ---------------------------------------------------------------------------------
82