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