| #******************************************************************************* |
| # include build/common makefile |
| # 以生成两个应用为例,如果只有一个删除EXEC2 OBJS2即可 |
| #******************************************************************************* |
| include $(COMMON_MK) |
| |
| EXEC = demo1 |
| OBJS = demo1.o |
| #EXEC 特有的LIB参数 |
| #LDLIBS_demo1 = -lnvram_sc -L$(LIB_DIR)/libnvram |
| |
| EXEC2 = demo2 |
| OBJS2 = demo2.o |
| #EXEC2 特有的LIB参数 |
| #LDLIBS_demo2 = -lsoft_timer_sc -L$(LIB_DIR)/libsoft_timer |
| |
| #宏和头文件目录在CFLAGS里定义,要用+=,不要用=,否则会覆盖COMMON_MK里的值 |
| #CFLAGS += -I$(APP_DIR)/include |
| CXXFLAGS = -Wall -g -std=c++11 |
| |
| #EXEC EXEC2 公共LIB参数,第一行定义LDLIBS用=,不要用+=,应用连接的库都在本Makefile定义 |
| LDLIBS = -lpthread |
| |
| #******************************************************************************* |
| # targets |
| #******************************************************************************* |
| all: $(EXEC) $(EXEC2) |
| |
| $(EXEC): $(OBJS) |
| $(CC) $(LDFLAGS) -o $@ $^ -Wl,--start-group $(LDLIBS) $(LDLIBS_$@) -Wl,--end-group |
| @cp $@ $@.elf |
| |
| $(EXEC2): $(OBJS2) |
| $(CXX) $(LDFLAGS) -o $@ $^ -Wl,--start-group $(LDLIBS) $(LDLIBS_$@) -Wl,--end-group |
| @cp $@ $@.elf |
| |
| romfs: |
| $(ROMFSINST) $(EXEC) /bin/$(EXEC) |
| $(ROMFSINST) $(EXEC2) /bin/$(EXEC2) |
| |
| clean: |
| -@rm -f $(EXEC) $(EXEC2) *.elf *.gdb *.o |