-
Notifications
You must be signed in to change notification settings - Fork 25
/
make_one_app
58 lines (41 loc) · 1.55 KB
/
make_one_app
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#
# 本软件为免费、开源软件。
# 本软件的版权(包括源码及二进制发布版本)归一切公众所有。
# 您可以自由使用、传播本软件。
# 您也可以以任何形式、任何目的使用本软件(包括源码及二进制发布版本),而不受任何版权限制。
# =====================
# 作者: 孙明保
# 邮箱: [email protected]
#
TARGET_PATH=$(apps_target_root)
EXE_FILE=$(addprefix $(TARGET_PATH)/, $(addsuffix .exe, $(APP_NAME)))
OBJ_PATH=$(TARGET_PATH)/$(APP_NAME)_tmp
DEP_PATH=$(OBJ_PATH)
__dummy:=$(shell $(MKDIR) $(OBJ_PATH))
SRC_PATH=$(app_root)/$(APP_NAME)
SRC_FILES=$(wildcard $(SRC_PATH)/*.c)
SRC_FILES_BASE_NAMES=$(basename $(notdir $(SRC_FILES)))
OBJ_FILES=$(addprefix $(OBJ_PATH)/, $(addsuffix .o, $(SRC_FILES_BASE_NAMES)))
DEP_FILES=$(addprefix $(DEP_PATH)/, $(addsuffix .d, $(SRC_FILES_BASE_NAMES)))
#you can change CFLAGS/INC_DIRS/LDFLAGS/LIBS according to app name
INC_DIRS+=$(INC_ALL_PRJ_LIB_HDR_DIR) \
-I$(SRC_PATH)
all: $(EXE_FILE)
.PHONY:all
.PRECIOUS: $(OBJ_FILES) $(DEP_FILES)
$(EXE_FILE): $(OBJ_FILES) $(lib_file_list)
@echo -n Making $@ ...
@$(CC) $(LDFLAGS) -o $@ $(OBJ_FILES) $(LIBS)
@echo done!
$(OBJ_PATH)/%.o: $(SRC_PATH)/%.c $(DEP_PATH)/%.d
@echo -n Making $@ ...
@$(CC) -c $(CFLAGS) $(INC_DIRS) $< -o $@
@echo done!
$(DEP_PATH)/%.d: $(SRC_PATH)/%.c
# $(CC) -MM $(CFLAGS) $(INC_DIRS) $< | \
# sed "s/$*\.o[ :]*/$(subst /,\/, $(OBJ_PATH))\/$*.o $(subst /,\/, $(DEP_PATH))\/$*.d : /g"> $@
@echo -n Making $@ ...
@$(CC) -MM $(CFLAGS) $(INC_DIRS) $< | \
sed "s/$*\.o[ :]*/$(subst /,\/, $(DEP_PATH))\/$*.d : /g"> $@
@echo done!
-include $(DEP_FILES)