rita | 3f2ca90 | 2023-06-16 13:36:53 +0800 | [diff] [blame^] | 1 | SHELL = /bin/sh |
| 2 | RM = rm -f |
| 3 | |
| 4 | LOCAL_CFLAGS := -Wall \ |
| 5 | -std=gnu++14 \ |
| 6 | -g -Os \ |
| 7 | -flto \ |
| 8 | -fPIC \ |
| 9 | -DECALL_SUPPORT \ |
| 10 | -fpermissive \ |
| 11 | |
| 12 | |
| 13 | |
| 14 | $(warning ################# lynq qser sms demo ROOT: $(ROOT),includedir:$(includedir)) |
| 15 | LOCAL_PATH = . |
| 16 | |
| 17 | LOCAL_C_INCLUDES = \ |
| 18 | -I. \ |
| 19 | -I$(LOCAL_PATH)/include/ \ |
| 20 | -I$(ROOT)$(includedir)/logger \ |
| 21 | -I$(ROOT)$(includedir)/liblog \ |
| 22 | |
| 23 | LOCAL_LIBS := \ |
| 24 | -L. \ |
| 25 | -ldl \ |
| 26 | -lstdc++ \ |
| 27 | -lcutils \ |
| 28 | -lutils \ |
| 29 | -lpthread \ |
| 30 | -llynq-log \ |
| 31 | -llynq-sim \ |
| 32 | |
| 33 | |
| 34 | SOURCES = $(wildcard *.cpp) |
| 35 | |
| 36 | EXECUTABLE = liblynq-qser-sim.so |
| 37 | |
| 38 | OBJECTS=$(SOURCES:.cpp=.o) |
| 39 | |
| 40 | |
| 41 | .PHONY: build clean install pack_rootfs |
| 42 | all: build |
| 43 | $(EXECUTABLE): $(OBJECTS) |
| 44 | $(CXX) -shared -Wl,--no-undefined $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@ |
| 45 | |
| 46 | %.o : %.cpp |
| 47 | $(CXX) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $< |
| 48 | |
| 49 | build: $(EXECUTABLE) |
| 50 | $(warning ########## build $(EXECUTABLE) ##########) |
| 51 | install: |
| 52 | mkdir -p $(ROOT)$(base_libdir)/ |
| 53 | install $(EXECUTABLE) $(ROOT)$(base_libdir)/ |
| 54 | mkdir -p $(ROOT)$(includedir)/$(NAME)/sdk |
| 55 | pack_rootfs: |
| 56 | mkdir -p $(PACK_INITRAMFS_TO)$(base_libdir)/ |
| 57 | cp -af $(EXECUTABLE) $(PACK_INITRAMFS_TO)$(base_libdir)/ |
| 58 | $(CROSS)strip $(PACK_INITRAMFS_TO)$(base_libdir)/$(EXECUTABLE) |
| 59 | mkdir -p $(PACK_TO)$(base_libdir)/ |
| 60 | cp -af $(EXECUTABLE) $(PACK_TO)$(base_libdir)/ |
| 61 | $(CROSS)strip $(PACK_TO)$(base_libdir)/$(EXECUTABLE) |
| 62 | .PHONY: clean |
| 63 | clean: |
| 64 | $(RM) $(OBJECTS) $(EXECUTABLE) |
| 65 | -find . -name "*.o" -delete |