| xj | b04a402 | 2021-11-25 15:01:52 +0800 | [diff] [blame] | 1 | #CC=gcc |
| 2 | #CXX=g++ |
| 3 | |
| 4 | SOURCE_DIR=.. |
| 5 | GPS_HAL_PATH=$(SOURCE_DIR)/gps_hal/ |
| 6 | |
| 7 | ifneq ($(findstring __LIBMNL_SIMULATOR__, $(CFLAG)),) |
| 8 | USR_LIB_DIR=$(GPS_HAL_PATH) |
| 9 | else |
| 10 | USR_LIB_DIR=/usr/lib/ |
| 11 | endif |
| 12 | |
| 13 | FLAGS=\ |
| 14 | -g \ |
| 15 | -Wall \ |
| 16 | -fPIC \ |
| 17 | -D__COMPILE_OPTION__ \ |
| 18 | -D__LINUX_OS__ \ |
| 19 | |
| 20 | # -m32 \ |
| 21 | |
| 22 | CPPFLAGS=\ |
| 23 | -std=c++11 \ |
| 24 | |
| 25 | INCLUDE=\ |
| 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 | |
| 32 | LIBS=\ |
| 33 | -ldl \ |
| 34 | -lrt \ |
| 35 | -lpthread \ |
| 36 | -lgnsshal \ |
| rita | 2f860ea | 2022-04-28 16:30:25 +0800 | [diff] [blame] | 37 | -llynq-systime \ |
| 38 | -llynq-uci \ |
| xj | b04a402 | 2021-11-25 15:01:52 +0800 | [diff] [blame] | 39 | -L$(GPS_HAL_PATH) \ |
| 40 | -Wl,-rpath $(USR_LIB_DIR) |
| 41 | |
| 42 | $(warning libs=$(LIBS)) |
| 43 | |
| 44 | CXXSRC=\ |
| 45 | |
| 46 | CSRC_mnld_test=\ |
| 47 | mnld_client/src/mnld_client.c \ |
| 48 | mnld_client/src/mnld_client_gps_cb.c |
| 49 | |
| 50 | CSRC_fm_gnss=\ |
| 51 | mnld_fm/src/mnld_fm.c \ |
| 52 | mnld_fm/src/mnld_fm_gps_cb.c |
| 53 | |
| 54 | EXECUTABLE=mnld_test fm_gnss |
| 55 | |
| 56 | COBJS=$(CSRC:.c=.o) |
| 57 | CXXOBJS=$(CXXSRC:.cpp=.o) |
| 58 | |
| 59 | all: $(EXECUTABLE) |
| 60 | |
| 61 | $(warning $(patsubst %.c,%.o,$(CSRC_mnld_test))...........................................) |
| 62 | |
| 63 | mnld_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 | |
| 66 | fm_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 |
| 76 | install: |
| 77 | install -d $(DESTDIR)/${bindir} |
| 78 | install -m 0755 $(EXECUTABLE) $(DESTDIR)/${bindir} |
| 79 | |
| 80 | clean: |
| 81 | rm -f $(EXECUTABLE) rm -rf *.o |
| 82 | find ./ -name *.o | xargs rm -rf |