summaryrefslogtreecommitdiff
path: root/n/avr
diff options
context:
space:
mode:
authorschodet2005-07-05 18:42:21 +0000
committerschodet2005-07-05 18:42:21 +0000
commita6285f0fdfd60fb274bd20ff2bf6f5113cb99184 (patch)
tree2ec922f475abccfdef2e8d9fc3431103b273b823 /n/avr
parent17d13beb6936653fb74f481a5c29cb9a876ed08d (diff)
Ajout du mode de tests.
Corrections de bugs.
Diffstat (limited to 'n/avr')
-rw-r--r--n/avr/make/Makefile.avr1
-rw-r--r--n/avr/make/Makefile.gen44
-rw-r--r--n/avr/make/Makefile.host1
3 files changed, 37 insertions, 9 deletions
diff --git a/n/avr/make/Makefile.avr b/n/avr/make/Makefile.avr
index c2ea9da..36b7589 100644
--- a/n/avr/make/Makefile.avr
+++ b/n/avr/make/Makefile.avr
@@ -5,6 +5,7 @@
AVR_CFLAGS = $(CFLAGS) -mmcu=$(AVR_MCU)
AVR_CPPFLAGS = $(CPPFLAGS) $(AVR_DEFS)
AVR_LDFLAGS = $(LDFLAGS)
+AVR_LDLIBS = $(LDLIBS) $(AVR_LIBS)
AVR_CC = avr-gcc
AVR_OBJCOPY = avr-objcopy
diff --git a/n/avr/make/Makefile.gen b/n/avr/make/Makefile.gen
index c68ce73..baa18d0 100644
--- a/n/avr/make/Makefile.gen
+++ b/n/avr/make/Makefile.gen
@@ -2,13 +2,12 @@
# Flags {{{1
-INCLUDES = -I$(BASE)
-OPTIMIZE =
-CFLAGS = -g -Wall -W -Wundef -Werror $(OPTIMIZE)
-DEFS =
+INCLUDES = -I$(BASE) -I$(BASE)/common
+CFLAGS = -g -Wall -W -Wundef $(OPTIMIZE)
CPPFLAGS = $(DEFS) $(INCLUDES) -MMD \
$(if $(CONFIGFILE),$(CONFIGFILE:%=-include %))
LDFLAGS =
+LDLIBS = $(LIBS)
# Main rules. {{{1
@@ -20,13 +19,11 @@ all: avr host
SOURCES = $(foreach prog,$(PROGS),$($(prog)_SOURCES))
-ifneq (,$(filter-out %.c,$(SOURCES)))
-$(error Sources should be c files)
-endif
-
# Modules. {{{1
+ifneq (,$(MODULES))
include $(MODULES:%=$(BASE)/modules/%/Makefile.module)
+endif
define MODULES_template
$(1)_SOURCES += $(foreach module,$(MODULES),$($(module)_SOURCES))
@@ -36,10 +33,39 @@ $(foreach prog,$(PROGS),$(eval $(call MODULES_template,$(prog))))
vpath %.c $(MODULES:%=$(BASE)/modules/%)
+# Compilation test rules. {{{1
+
+define TEST_MCU_template
+test.sub::
+ $$(MAKE) CONFIGFILE=$(1) AVR_MCU=$(2) clean elf
+endef
+
+define TEST_template
+$$(foreach mcu,$$(if $$($(1:%.h=%)_MCU),$$($(1:%.h=%)_MCU),$$(TEST_MCU)),\
+ $$(eval $$(call TEST_MCU_template,$(1),$$(mcu))))
+test.sub::
+ $$(MAKE) CONFIGFILE=$(1) clean host
+endef
+
+$(foreach config,$(TEST_CONFIGFILES),$(eval $(call TEST_template,$(config))))
+
+test: test.sub clean
+
# Include other Makefiles. {{{1
+ifneq (,$(filter-out %.c,$(SOURCES)))
+$(error Sources should be c files)
+endif
+
+ifneq (,$(PROGS))
include $(BASE)/make/Makefile.avr
include $(BASE)/make/Makefile.host
+else
+avr:
+host:
+clean.avr:
+clean.host:
+endif
# Rules for building the doc. {{{1
@@ -51,7 +77,7 @@ doc: $(DOC)
%.exd: $(EXTRACTDOC)
test -n "$^" && extractdoc $^ > $@ || true
-# Cleanning. {{{1
+# Cleaning. {{{1
clean: clean.avr clean.host
rm -f *.bak *~ $(DOC) *.exd $(EXTRA_CLEAN_FILES)
diff --git a/n/avr/make/Makefile.host b/n/avr/make/Makefile.host
index 9b3c8ce..f0b47d8 100644
--- a/n/avr/make/Makefile.host
+++ b/n/avr/make/Makefile.host
@@ -5,6 +5,7 @@
HOST_CFLAGS = $(CFLAGS)
HOST_CPPFLAGS = $(CPPFLAGS) $(HOST_DEFS) -DHOST=1
HOST_LDFLAGS = $(LDFLAGS)
+HOST_LDLIBS = $(LDLIBS) $(HOST_LIBS)
HOST_COMPILE.c = $(CC) $(HOST_CFLAGS) $(HOST_CPPFLAGS) -c
HOST_LINK.o = $(CC) $(HOST_CFLAGS) $(HOST_LDFLAGS)