Yue Lun | 03a82d9 | 2013-10-21 10:15:02 +0800 | [diff] [blame] | 1 | |
| 2 | include $(PRJ_PATH)/make/$(OS)_opt.mk |
| 3 | |
| 4 | include $(PRJ_PATH)/make/tools.mk |
| 5 | |
| 6 | obj: $(OBJ_LIST) |
| 7 | $(OBJ_LOOP) |
| 8 | |
| 9 | dep: 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 | |
| 20 | build_dir: $(DST_DIR) |
| 21 | |
| 22 | $(DST_DIR): |
| 23 | $(MKDIR) -p $(DST_DIR) |
| 24 | |
| 25 | .PHONY: clean |
| 26 | clean: clean_o clean_d |
| 27 | $(CLEAN_LOOP) |
| 28 | |
| 29 | .PHONY: clean_o |
| 30 | clean_o: clean_obj |
| 31 | $(CLEAN_OBJ_LOOP) |
| 32 | |
| 33 | .PHONY: clean_d |
| 34 | clean_d: clean_dep |
| 35 | $(CLEAN_DEP_LOOP) |
| 36 | |
| 37 | clean_obj: |
| 38 | ifneq (,$(word 1, $(OBJ_FILE))) |
| 39 | $(RM) -f $(OBJ_FILE) |
| 40 | endif |
| 41 | |
| 42 | clean_dep: |
| 43 | ifneq (,$(word 1, $(DEP_FILE))) |
| 44 | $(RM) -f $(DEP_FILE) |
| 45 | endif |
| 46 | |
| 47 | ifneq (,$(word 1, $(DEP_FILE))) |
| 48 | sinclude $(DEP_FILE) |
| 49 | endif |