blob: a72c239831ad91777578f367586bc734092a4849 [file] [log] [blame]
Yue Lun03a82d92013-10-21 10:15:02 +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
13 $(CC) $(CFLAGS) -c $< -o $(DST_DIR)/$@
14
15$(DEP_LIST) : %.d : %.c
16 $(CC) $(CFLAGS) -MM $< > $(DST_DIR)/$@.tmp
17 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