# Makefile.gen - General Makefile. # Flags {{{1 INCLUDES = -Imodules OPTIMIZE = CFLAGS = -g -Wall $(OPTIMIZE) DEFS = CPPFLAGS = $(DEFS) $(INCLUDES) -MMD \ $(if $(CONFIGFILE),$(CONFIGFILE:%=-include %)) LDFLAGS = # Main rules. {{{1 all: avr host .PHONY: all clean doc # General rules. {{{1 SOURCES = $(foreach prog,$(PROGS),$($(prog)_SOURCES)) ifneq (,$(filter-out %.c,$(SOURCES))) $(error Sources should be c files) endif # Modules. {{{1 include $(MODULES:%=$(BASE)/modules/%/Makefile.module) define MODULES_template $(1)_SOURCES += $(foreach module,$(MODULES),$($(module)_SOURCES)) endef $(foreach prog,$(PROGS),$(eval $(call MODULES_template,$(prog)))) vpath %.c $(MODULES:%=$(BASE)/modules/%) # Include other Makefiles. {{{1 include $(BASE)/make/Makefile.avr include $(BASE)/make/Makefile.host # Rules for building the doc. {{{1 doc: $(DOC) %.html: %.txt %.exd aft $< %.exd: $(EXTRACTDOC) test -n "$^" && extractdoc $^ > $@ || true # Cleanning. {{{1 clean: clean.avr clean.host rm -f *.bak *~ $(DOC) *.exd $(EXTRA_CLEAN_FILES)