From 3742cbc92d0203080a57b93ca56cf6dc116e818f Mon Sep 17 00:00:00 2001 From: schodet Date: Fri, 22 Jul 2005 21:41:01 +0000 Subject: Ajout du support de AVR_PROGS et HOST_PROGS. Ajout du support de sous-modules. --- n/avr/make/Makefile.avr | 25 +++++++++++++------------ n/avr/make/Makefile.gen | 11 +++++++---- n/avr/make/Makefile.host | 5 +++-- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/n/avr/make/Makefile.avr b/n/avr/make/Makefile.avr index 36b7589..26f3fd1 100644 --- a/n/avr/make/Makefile.avr +++ b/n/avr/make/Makefile.avr @@ -21,18 +21,19 @@ avr: elf lst hex # General rules. {{{1 -AVR_ELFS = $(PROGS:%=%.avr.elf) +AVR_PROGS += $(PROGS) +AVR_ELFS = $(AVR_PROGS:%=%.avr.elf) AVR_SOURCES = $(filter-out %.host.c,$(SOURCES)) AVR_OBJECTS = $(AVR_SOURCES:%.c=%.avr.o) elf: $(AVR_ELFS) -lst: $(PROGS:%=%.avr.lst) +lst: $(AVR_PROGS:%=%.avr.lst) define AVR_PROG_template $(1).avr.elf: $$(patsubst %.c,%.avr.o,$$(filter-out %.host.c,$$($(1)_SOURCES))) endef -$(foreach prog,$(PROGS),$(eval $(call AVR_PROG_template,$(prog)))) +$(foreach prog,$(AVR_PROGS),$(eval $(call AVR_PROG_template,$(prog)))) $(AVR_ELFS): $(AVR_LINK.o) $^ $(AVR_LDLIBS) -o $@ @@ -48,13 +49,13 @@ $(AVR_ELFS): # Rules for building the .text rom images. {{{1 -TEXTS = $(PROGS:%=%.hex) $(PROGS:%=%.bin) $(PROGS:%=%.srec) +TEXTS = $(AVR_PROGS:%=%.hex) $(AVR_PROGS:%=%.bin) $(AVR_PROGS:%=%.srec) text: hex -hex: $(PROGS:%=%.hex) -bin: $(PROGS:%=%.bin) -srec: $(PROGS:%=%.srec) +hex: $(AVR_PROGS:%=%.hex) +bin: $(AVR_PROGS:%=%.bin) +srec: $(AVR_PROGS:%=%.srec) %.hex: %.avr.elf $(AVR_OBJCOPY) -j .text -j .data -O ihex $< $@ @@ -67,14 +68,14 @@ srec: $(PROGS:%=%.srec) # Rules for building the .eeprom rom images. {{{1 -EEPROMS = $(PROGS:%=%_eeprom.hex) $(PROGS:%=%_eeprom.bin) \ - $(PROGS:%=%_eeprom.srec) +EEPROMS = $(AVR_PROGS:%=%_eeprom.hex) $(AVR_PROGS:%=%_eeprom.bin) \ + $(AVR_PROGS:%=%_eeprom.srec) eeprom: ehex -ehex: $(PROGS:%=%_eeprom.hex) -ebin: $(PROGS:%=%_eeprom.bin) -esrec: $(PROGS:%=%_eeprom.srec) +ehex: $(AVR_PROGS:%=%_eeprom.hex) +ebin: $(AVR_PROGS:%=%_eeprom.bin) +esrec: $(AVR_PROGS:%=%_eeprom.srec) %_eeprom.hex: %.avr.elf $(AVR_OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@ diff --git a/n/avr/make/Makefile.gen b/n/avr/make/Makefile.gen index baa18d0..7e34c2b 100644 --- a/n/avr/make/Makefile.gen +++ b/n/avr/make/Makefile.gen @@ -17,19 +17,22 @@ all: avr host # General rules. {{{1 -SOURCES = $(foreach prog,$(PROGS),$($(prog)_SOURCES)) +ALL_PROGS = $(PROGS) $(AVR_PROGS) $(HOST_PROGS) +SOURCES = $(foreach prog,$(ALL_PROGS),$($(prog)_SOURCES)) # Modules. {{{1 +MODULES += host + ifneq (,$(MODULES)) include $(MODULES:%=$(BASE)/modules/%/Makefile.module) endif define MODULES_template -$(1)_SOURCES += $(foreach module,$(MODULES),$($(module)_SOURCES)) +$(1)_SOURCES += $(foreach module,$(MODULES),$($(subst /,_,$(module))_SOURCES)) endef -$(foreach prog,$(PROGS),$(eval $(call MODULES_template,$(prog)))) +$(foreach prog,$(ALL_PROGS),$(eval $(call MODULES_template,$(prog)))) vpath %.c $(MODULES:%=$(BASE)/modules/%) @@ -57,7 +60,7 @@ ifneq (,$(filter-out %.c,$(SOURCES))) $(error Sources should be c files) endif -ifneq (,$(PROGS)) +ifneq (,$(ALL_PROGS)) include $(BASE)/make/Makefile.avr include $(BASE)/make/Makefile.host else diff --git a/n/avr/make/Makefile.host b/n/avr/make/Makefile.host index f0b47d8..7241284 100644 --- a/n/avr/make/Makefile.host +++ b/n/avr/make/Makefile.host @@ -18,7 +18,8 @@ host: exe # General rules. {{{1 -HOST_EXES = $(PROGS:%=%.host) +HOST_PROGS += $(PROGS) +HOST_EXES = $(HOST_PROGS:%=%.host) HOST_SOURCES = $(filter-out %.avr.c,$(SOURCES)) HOST_OBJECTS = $(HOST_SOURCES:%.c=%.host.o) @@ -28,7 +29,7 @@ define AVR_PROG_template $(1).host: $$(patsubst %.c,%.host.o,$$(filter-out %.avr.c,$$($(1)_SOURCES))) endef -$(foreach prog,$(PROGS),$(eval $(call AVR_PROG_template,$(prog)))) +$(foreach prog,$(HOST_PROGS),$(eval $(call AVR_PROG_template,$(prog)))) $(HOST_EXES): $(HOST_LINK.o) $^ $(HOST_LDLIBS) -o $@ -- cgit v1.2.3