blob: ddb3bd12ff3d5ffcba59f8232c4d13bc11d89e98 [file] [log] [blame]
luny479178a2014-06-18 12:33:29 +08001
2include $(PRJ_PATH)/make/$(OS)_opt.mk
3
4include $(PRJ_PATH)/make/tools.mk
5
6obj: $(OBJ_LIST)
7 $(OBJ_LOOP)
8
9dep: build_dir $(DEP_LIST)
10 $(DEP_LOOP)
11
12$(OBJ_LIST): %.o : %.c %.d
xiaofeis6ac65322015-10-18 19:47:33 +080013 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $(DST_DIR)/$@
luny479178a2014-06-18 12:33:29 +080014
15$(DEP_LIST) : %.d : %.c
xiaofeis6ac65322015-10-18 19:47:33 +080016 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MM $< > $(DST_DIR)/$@.tmp
luny479178a2014-06-18 12:33:29 +080017 sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $(DST_DIR)/$@.tmp > $(DST_DIR)/$@
18 $(RM) -f $(DST_DIR)/$@.tmp;
19
20build_dir: $(DST_DIR)
21
22$(DST_DIR):
23 $(MKDIR) -p $(DST_DIR)
24
25.PHONY: clean
26clean: clean_o clean_d
27 $(CLEAN_LOOP)
28
29.PHONY: clean_o
30clean_o: clean_obj
31 $(CLEAN_OBJ_LOOP)
32
33.PHONY: clean_d
34clean_d: clean_dep
35 $(CLEAN_DEP_LOOP)
36
37clean_obj:
38ifneq (,$(word 1, $(OBJ_FILE)))
39 $(RM) -f $(OBJ_FILE)
40endif
41
42clean_dep:
43ifneq (,$(word 1, $(DEP_FILE)))
44 $(RM) -f $(DEP_FILE)
45endif
46
47ifneq (,$(word 1, $(DEP_FILE)))
48 sinclude $(DEP_FILE)
49endif