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
| objects := $(subst .c,.o,$(sources)) dependencies := $(subst .c,.d,$(sources)) include_dirs := .. ../../include CPPFLAGS += $(addprefix -I ,$(include_dirs))
vpath %.h $(include_dirs) .PHONY: library library: $(library) $(library): $(objects) $(AR) $(ARFLAGS) $@ $^
.PHONY: clean clean: $(RM) $(objects) $(program) $(library) $(dependencies) $(extra_clean) ifneq "$(MAKECMDGOALS)" "clean" -include $(dependencies) endif
%.c %.h: %.y $(YACC.y) --defines $< $(MV) y.tab.c $*.c $(MV) y.tab.h $*.h %.d: %.c $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -M $< | \ $(SED) 's,\($*\.o\) *:,\1 $@: ,' > $@.tmp $(MV) $@.tmp $@
|