From 98694a3cab902c3ef3d1bdab941980ed6c94d67d Mon Sep 17 00:00:00 2001 From: schodet Date: Tue, 2 Aug 2005 21:14:07 +0000 Subject: Ajout du support des fichiers asm. --- n/avr/make/Makefile.avr | 12 ++++++++++-- n/avr/make/Makefile.gen | 8 +++++--- n/avr/make/Makefile.host | 4 ++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/n/avr/make/Makefile.avr b/n/avr/make/Makefile.avr index 8485324..8f8030d 100644 --- a/n/avr/make/Makefile.avr +++ b/n/avr/make/Makefile.avr @@ -3,6 +3,7 @@ # Flags. AVR_CFLAGS = $(CFLAGS) -mmcu=$(AVR_MCU) +AVR_ASFLAGS = $(ASFLAGS) -mmcu=$(AVR_MCU) AVR_CPPFLAGS = $(CPPFLAGS) $(AVR_DEFS) AVR_LDFLAGS = $(LDFLAGS) AVR_LDLIBS = $(LDLIBS) $(AVR_LIBS) @@ -11,6 +12,7 @@ AVR_CC = avr-gcc AVR_OBJCOPY = avr-objcopy AVR_OBJDUMP = avr-objdump AVR_COMPILE.c = $(AVR_CC) $(AVR_CFLAGS) $(AVR_CPPFLAGS) -c +AVR_COMPILE.S = $(AVR_CC) $(AVR_ASFLAGS) $(AVR_CPPFLAGS) -c AVR_LINK.o = $(AVR_CC) $(AVR_CFLAGS) $(AVR_LDFLAGS) # Main rules. @@ -24,13 +26,16 @@ avr: elf lst hex AVR_PROGS += $(PROGS) AVR_ELFS = $(AVR_PROGS:%=%.avr.elf) AVR_SOURCES = $(filter-out %.host.c,$(SOURCES)) -AVR_OBJECTS = $(AVR_SOURCES:%.c=%.avr.o) +AVR_C_SOURCES = $(filter %.c,$(AVR_SOURCES)) +AVR_S_SOURCES = $(filter %.S,$(AVR_SOURCES)) +AVR_OBJECTS = $(AVR_C_SOURCES:%.c=%.avr.o) $(AVR_S_SOURCES:%.S=%.avr.o) elf: $(AVR_ELFS) lst: $(AVR_PROGS:%=%.avr.lst) define AVR_PROG_template -$(1).avr.elf: $$(patsubst %.c,%.avr.o,$$(filter-out %.host.c,$$($(1)_SOURCES))) +$(1).avr.elf: $$(patsubst %.S,%.avr.o,$$(patsubst %.c,%.avr.o,\ + $$(filter-out %.host.c,$$($(1)_SOURCES)))) endef $(foreach prog,$(AVR_PROGS),$(eval $(call AVR_PROG_template,$(prog)))) @@ -44,6 +49,9 @@ $(AVR_ELFS): %.avr.o: %.c $(AVR_COMPILE.c) -o $@ $< +%.avr.o: %.S + $(AVR_COMPILE.S) -o $@ $< + # Dependency checking. -include $(AVR_OBJECTS:%.avr.o=%.avr.d) diff --git a/n/avr/make/Makefile.gen b/n/avr/make/Makefile.gen index 7664b8a..a503e51 100644 --- a/n/avr/make/Makefile.gen +++ b/n/avr/make/Makefile.gen @@ -3,7 +3,8 @@ # Flags INCLUDES = -I$(BASE) -I$(BASE)/common -CFLAGS = -g -Wall -W -Wundef $(OPTIMIZE) +CFLAGS = -g -Wall -W -Wundef -Wno-unused-parameter $(OPTIMIZE) +ASFLAGS = -Wa,--gstabs CPPFLAGS = $(DEFS) $(INCLUDES) -MMD \ $(if $(CONFIGFILE),$(CONFIGFILE:%=-include %)) LDFLAGS = @@ -35,6 +36,7 @@ endef $(foreach prog,$(ALL_PROGS),$(eval $(call MODULES_template,$(prog)))) vpath %.c $(MODULES:%=$(BASE)/modules/%) +vpath %.S $(MODULES:%=$(BASE)/modules/%) # Compilation test rules. @@ -56,8 +58,8 @@ test: test.sub clean # Include other Makefiles. -ifneq (,$(filter-out %.c,$(SOURCES))) -$(error Sources should be c files) +ifneq (,$(filter-out %.c %.avr.S,$(SOURCES))) +$(error Sources should be .c or .avr.S files) endif ifneq (,$(ALL_PROGS)) diff --git a/n/avr/make/Makefile.host b/n/avr/make/Makefile.host index e46c2b0..3fd343f 100644 --- a/n/avr/make/Makefile.host +++ b/n/avr/make/Makefile.host @@ -20,13 +20,13 @@ host: exe HOST_PROGS += $(PROGS) HOST_EXES = $(HOST_PROGS:%=%.host) -HOST_SOURCES = $(filter-out %.avr.c,$(SOURCES)) +HOST_SOURCES = $(filter-out %.avr.c %.avr.S,$(SOURCES)) HOST_OBJECTS = $(HOST_SOURCES:%.c=%.host.o) exe: $(HOST_EXES) define AVR_PROG_template -$(1).host: $$(patsubst %.c,%.host.o,$$(filter-out %.avr.c,$$($(1)_SOURCES))) +$(1).host: $$(patsubst %.c,%.host.o,$$(filter-out %.avr.c %.avr.S,$$($(1)_SOURCES))) endef $(foreach prog,$(HOST_PROGS),$(eval $(call AVR_PROG_template,$(prog)))) -- cgit v1.2.3