summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschodet2005-03-06 17:46:36 +0000
committerschodet2005-03-06 17:46:36 +0000
commit4578af27dd2919a5c3315f570a4424016f1e9c11 (patch)
tree4631955dba6722364fb5b9011924e2911fef7040
parenta68e744c37fc34f9957935f09ab7e56489fdee9a (diff)
Mise à jour Makefile.
-rw-r--r--n/avr/rs232/Makefile4
-rw-r--r--n/avr/rs232/Makefile.avr58
-rw-r--r--n/avr/rs232/Makefile.module1
3 files changed, 40 insertions, 23 deletions
diff --git a/n/avr/rs232/Makefile b/n/avr/rs232/Makefile
index a70b2e0..d1e82f2 100644
--- a/n/avr/rs232/Makefile
+++ b/n/avr/rs232/Makefile
@@ -1,5 +1,5 @@
PROGS = test_rs232
-SOURCES = test_rs232.c rs232.c
+test_rs232_OBJECTS = test_rs232.c rs232.c
DOC = rs232.html
EXTRACTDOC = rs232.c avrconfig.h
MODULES =
@@ -14,3 +14,5 @@ DEFS =
LIBS =
include Makefile.avr
+
+test_rs232.elf: $(test_rs232_OBJECTS)
diff --git a/n/avr/rs232/Makefile.avr b/n/avr/rs232/Makefile.avr
index 01c9b7b..6a4324d 100644
--- a/n/avr/rs232/Makefile.avr
+++ b/n/avr/rs232/Makefile.avr
@@ -1,52 +1,68 @@
+# Makefile.avr 1.6
+#
# Flags. {{{1
-CC = avr-gcc
-
-CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) \
- $(if $(CONFIGFILE), $(CONFIGFILE:%=-include %))
-CPPFLAGS = $(DEFS) -Imodules
-LDFLAGS =
+CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET)
+CPPFLAGS = $(DEFS) -MMD $(INCLUDES) \
+ $(if $(CONFIGFILE), $(CONFIGFILE:%=-include %))
+INCLUDES = -Imodules
+LDFLAGS = $(CFLAGS)
+CC = avr-gcc
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
# Main rules. {{{1
-CSOURCES = $(filter %.c, $(SOURCES))
-SSOURCES = $(filter %.s, $(SOURCES))
-OBJECTS = $(CSOURCES:%.c=%.o) $(SSOURCES:%.s=%.o)
-ELFS = $(PROGS:%=%.elf)
-
all: elf lst hex
.PHONY: all clean elf lst doc text hex srec bin eeprom ehex esrec ebin
# Rules for modules. {{{1
-MODULESFILES = $(MODULES:%=modules/%/Makefile.module)
+VPATH = $(MODULES:%=modules/%)
-include $(MODULESFILES)
+modules_checkout: modules_co
-SOURCES += $(MODULESSOURCES)
+modules_co: $(MODULES:%=modules_co.%)
-$(MODULESFILES):
+$(MODULES:%=modules_co.%):
mkdir -p modules
- cd modules && cvs co $(@:modules/%/Makefile.module=%)
- test -f $@
+ cd modules && cvs co $(@:modules_co.%=%)
+
+modules_update: modules_up
+
+modules_up: $(MODULES:%=modules_up.%)
+
+$(MODULES:%=modules_up.%):
+ cd modules/$(@:modules_up.%=%) && cvs up
# General rules. {{{1
-elf: $(PROGS:%=%.elf)
+ELFS = $(PROGS:%=%.elf)
+OBJECTS = $(filter %.o,$(foreach prog,$(PROGS),$($(prog)_OBJECTS)))
+
+elf: $(ELFS)
lst: $(PROGS:%=%.lst)
-$(PROGS:%=%.elf): $(OBJECTS)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
+# Great piece of rules which only works in make 3.80+.
+# define PROG_template
+# $(1).elf: $$($(1)_OBJECTS)
+# endef
+#
+# $(foreach prog,$(PROGS),$(eval $(call PROG_template,$(prog))))
+
+$(ELFS):
+ $(LINK.o) $^ $(LDLIBS) -o $@
%.lst: %.elf
$(OBJDUMP) -h -S $< > $@
+# Dependency checking.
+-include $(OBJECTS:%.o=%.d)
+
clean:
- rm -f *.o $(OBJECTS) $(PROGS:%=%.elf) *.lst *.map *.bak *~
+ rm -f *.o *.d $(ELFS) *.lst *.map *.bak *~
rm -f $(DOC) *.exd $(EXTRA_CLEAN_FILES) $(TEXTS) $(EEPROMS)
# Rules for building the doc. {{{1
diff --git a/n/avr/rs232/Makefile.module b/n/avr/rs232/Makefile.module
deleted file mode 100644
index 5c35d79..0000000
--- a/n/avr/rs232/Makefile.module
+++ /dev/null
@@ -1 +0,0 @@
-MODULESSOURCES += modules/n/avr/rs232/rs232.c