From b2ee9e5b739c8ce03458589e069428841069ccd6 Mon Sep 17 00:00:00 2001 From: schodet Date: Thu, 24 Jun 2004 23:12:42 +0000 Subject: Intégration de doc dans le Makefile. --- n/avr/howto/Makefile | 78 ++++++++++++++++++++++++++++++++++++++++++++++- n/avr/howto/avr-Makefile | 69 ----------------------------------------- n/avr/howto/howto-avr.txt | 4 +-- 3 files changed, 79 insertions(+), 72 deletions(-) delete mode 100644 n/avr/howto/avr-Makefile (limited to 'n/avr/howto') diff --git a/n/avr/howto/Makefile b/n/avr/howto/Makefile index 3d013f6..bbc542e 100644 --- a/n/avr/howto/Makefile +++ b/n/avr/howto/Makefile @@ -1,4 +1,80 @@ -doc: howto-avr.html +PRG = example +OBJECTS = example.o +DOC = howto-avr.html +# atmega8, atmega8535, atmega128... +MCU_TARGET = atmega8 +# -O2 : speed +# -Os : size +OPTIMIZE = -O2 + +DEFS = +LIBS = + +# You should not have to change anything below here. + +CC = avr-gcc + +CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) +CPPFLAGS = $(DEFS) +LDFLAGS = -Wl,-Map,$(PRG).map + +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump + +all: elf lst hex + +elf: $(PRG).elf +lst: $(PRG).lst + +$(PRG).elf: $(OBJECTS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) + +%.lst: %.elf + $(OBJDUMP) -h -S $< > $@ + +clean: + rm -f *.o $(PRG).elf *.bak + rm -f *.lst *.map $(EXTRA_CLEAN_FILES) + rm -f $(PRG).hex $(PRG).bin $(PRG).srec $(PRG)_eeprom.hex $(PRG)_eeprom.bin $(PRG)_eeprom.srec + +# Rules for building the doc. + +doc: $(DOC) %.html: %.txt aft $< + +# Rules for building the .text rom images. + +text: hex bin srec + +hex: $(PRG).hex +bin: $(PRG).bin +srec: $(PRG).srec + +%.hex: %.elf + $(OBJCOPY) -j .text -j .data -O ihex $< $@ + +%.srec: %.elf + $(OBJCOPY) -j .text -j .data -O srec $< $@ + +%.bin: %.elf + $(OBJCOPY) -j .text -j .data -O binary $< $@ + +# Rules for building the .eeprom rom images. + +eeprom: ehex ebin esrec + +ehex: $(PRG)_eeprom.hex +ebin: $(PRG)_eeprom.bin +esrec: $(PRG)_eeprom.srec + +%_eeprom.hex: %.elf + $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@ + +%_eeprom.srec: %.elf + $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@ + +%_eeprom.bin: %.elf + $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@ + diff --git a/n/avr/howto/avr-Makefile b/n/avr/howto/avr-Makefile deleted file mode 100644 index ec87ca3..0000000 --- a/n/avr/howto/avr-Makefile +++ /dev/null @@ -1,69 +0,0 @@ -PRG = example -OBJ = example.o -# Principalemet atmega8 ou atmega8535 -MCU_TARGET = atmega8 -OPTIMIZE = -O2 - -DEFS = -LIBS = - -# You should not have to change anything below here. - -CC = avr-gcc - -CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS) -LDFLAGS = -Wl,-Map,$(PRG).map - -OBJCOPY = avr-objcopy -OBJDUMP = avr-objdump - -all: elf lst hex - -elf: $(PRG).elf -lst: $(PRG).lst - -$(PRG).elf: $(OBJ) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) - -%.lst: %.elf - $(OBJDUMP) -h -S $< > $@ - -clean: - rm -f *.o $(PRG).elf *.bak - rm -f *.lst *.map $(EXTRA_CLEAN_FILES) - rm -f $(PRG).hex $(PRG).bin $(PRG).srec $(PRG)_eeprom.hex $(PRG)_eeprom.bin $(PRG)_eeprom.srec - -# Rules for building the .text rom images. - -text: hex bin srec - -hex: $(PRG).hex -bin: $(PRG).bin -srec: $(PRG).srec - -%.hex: %.elf - $(OBJCOPY) -j .text -j .data -O ihex $< $@ - -%.srec: %.elf - $(OBJCOPY) -j .text -j .data -O srec $< $@ - -%.bin: %.elf - $(OBJCOPY) -j .text -j .data -O binary $< $@ - -# Rules for building the .eeprom rom images. - -eeprom: ehex ebin esrec - -ehex: $(PRG)_eeprom.hex -ebin: $(PRG)_eeprom.bin -esrec: $(PRG)_eeprom.srec - -%_eeprom.hex: %.elf - $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@ - -%_eeprom.srec: %.elf - $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@ - -%_eeprom.bin: %.elf - $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@ - diff --git a/n/avr/howto/howto-avr.txt b/n/avr/howto/howto-avr.txt index 2376745..4647123 100644 --- a/n/avr/howto/howto-avr.txt +++ b/n/avr/howto/howto-avr.txt @@ -30,5 +30,5 @@ Sur les Windows, on peut faire fonctionner gcc avec AVR Studio. Pour la programmation, il y a avrdude, programmation de l'AVR avec 3 fils. -Le fichier avr-Makefile livré avec cet howto peut être utilisé pour compiler -les projets. +Le fichier Makefile livré avec cet howto peut être utilisé pour compiler les +projets. -- cgit v1.2.3