blob: 0c2c117df29cbacefa07268917bb0aa61779f6bb [file] [log] [blame]
xjb04a4022021-11-25 15:01:52 +08001#CC=gcc
2#CXX=g++
3
4SOURCE_DIR=..
5GPS_HAL_PATH=$(SOURCE_DIR)/gps_hal/
6
7ifneq ($(findstring __LIBMNL_SIMULATOR__, $(CFLAG)),)
8 USR_LIB_DIR=$(GPS_HAL_PATH)
9else
10 USR_LIB_DIR=/usr/lib/
11endif
12
13FLAGS=\
14 -g \
15 -Wall \
16 -fPIC \
17 -D__COMPILE_OPTION__ \
18 -D__LINUX_OS__ \
19
20# -m32 \
21
22CPPFLAGS=\
23 -std=c++11 \
24
25INCLUDE=\
26 -Imnld_client/inc \
27 -Imnld_fm/inc \
28 -I../gps_hal/inc \
29 -I../gps_hal/inc/hardware \
30 -I../gps_hal/mnldinf/inc \
31
32LIBS=\
33 -ldl \
34 -lrt \
35 -lpthread \
36 -lgnsshal \
rita2f860ea2022-04-28 16:30:25 +080037 -llynq-systime \
38 -llynq-uci \
xjb04a4022021-11-25 15:01:52 +080039 -L$(GPS_HAL_PATH) \
40 -Wl,-rpath $(USR_LIB_DIR)
41
42$(warning libs=$(LIBS))
43
44CXXSRC=\
45
46CSRC_mnld_test=\
47 mnld_client/src/mnld_client.c \
48 mnld_client/src/mnld_client_gps_cb.c
49
50CSRC_fm_gnss=\
51 mnld_fm/src/mnld_fm.c \
52 mnld_fm/src/mnld_fm_gps_cb.c
53
54EXECUTABLE=mnld_test fm_gnss
55
56COBJS=$(CSRC:.c=.o)
57CXXOBJS=$(CXXSRC:.cpp=.o)
58
59all: $(EXECUTABLE)
60
61$(warning $(patsubst %.c,%.o,$(CSRC_mnld_test))...........................................)
62
63mnld_test: $(patsubst %.c,%.o,$(CSRC_mnld_test))
64 $(CC) $^ --sysroot=$(BB_SYSROOT_ADD) -I$(BB_SYSROOT_ADD)/usr/include/gps_hal $(LIBS) $(FLAGS) $(CPPFLAGS) -o $@
65
66fm_gnss: $(patsubst %.c,%.o,$(CSRC_fm_gnss))
67 $(CC) $^ --sysroot=$(BB_SYSROOT_ADD) -I$(BB_SYSROOT_ADD)/usr/include/gps_hal $(LIBS) $(FLAGS) $(CPPFLAGS) -o $@
68
69%.o : %.c
70 $(CC) -c $(FLAGS) -I$(BB_SYSROOT_ADD)/usr/include/gps_hal $(INCLUDE) -o $@ $^
71
72%.o : %.cpp
73 $(CC) -c $(FLAGS) $(INCLUDE) $(CPPFLAGS) -o $@ $^
74
75.PHONY: install clean
76install:
77 install -d $(DESTDIR)/${bindir}
78 install -m 0755 $(EXECUTABLE) $(DESTDIR)/${bindir}
79
80clean:
81 rm -f $(EXECUTABLE) rm -rf *.o
82 find ./ -name *.o | xargs rm -rf