From: Pat Thoyts Date: Wed, 12 Aug 2015 23:17:10 +0000 (+0100) Subject: Tidied up and reduced the verbosity of the makefile. X-Git-Url: https://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=d5cbb2c06a5deef0540a3a4cd72d9a667db305fb;p=avr%2Ftimer-demo.git Tidied up and reduced the verbosity of the makefile. Note: on windows installed MinGW to get mingw32-make but the avr-gcc compiler tools are provided from the Arduino IDE installation. Signed-off-by: Pat Thoyts --- diff --git a/Makefile b/Makefile index 1c0410f..9724f46 100644 --- a/Makefile +++ b/Makefile @@ -1,27 +1,43 @@ # -*- Makefile -*- -PROJECT=timer-demo -DEVICE =atmega328p -F_CPU =16000000UL -INC =-I. -AVRDUDE=avrdude -c usbasp -p $(DEVICE) -C $(AVR_DIR)\etc\avrdude.conf - -CC=avr-gcc -LD=avr-gcc -OBJCOPY=avr-objcopy -CFLAGS =-Wall -Os -mcall-prologues -mmcu=$(DEVICE) -DF_CPU=$(F_CPU) -LDFLAGS=-Wall -mmcu=$(DEVICE) +PROJECT := timer-demo +DEVICE := atmega328p +F_CPU := 16000000UL +INC := -I. +AVRDUDE := avrdude -c usbasp -p $(DEVICE) -C $(AVR_DIR)\etc\avrdude.conf + +CC := avr-gcc +LD := avr-gcc +OBJCOPY := avr-objcopy +RM := del >NUL +CFLAGS :=-Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-align -Wshadow \ + -std=gnu99 -fshort-enums -pedantic-errors -Os -mcall-prologues \ + -mmcu=$(DEVICE) -DF_CPU=$(F_CPU) +LDFLAGS := -Wall -mmcu=$(DEVICE) + +V := @ +Q := $(V:1=) +QUIET_CC = $(Q:@=@echo CC $@ &)$(CC) +QUIET_LD = $(Q:@=@echo LD $@ &)$(LD) +QUIET_OBJCOPY = $(Q:@=@echo OBJCOPY $@ &)$(OBJCOPY) +QUIET_AVRDUDE = $(Q:@=@echo AVRDUDE $@ &)$(AVRDUDE) all: $(PROJECT).hex %.hex: %.elf - $(OBJCOPY) -j .text -j .data -O ihex $< $@ + $(QUIET_OBJCOPY) -j .text -j .data -O ihex $< $@ %.elf: %.o - $(LD) $(LDFLAGS) $< -o $@ + $(QUIET_LD) $(LDFLAGS) $< -o $@ %.o: %.c - $(CC) $(CFLAGS) $(INC) -c $< + $(QUIET_CC) $(CFLAGS) $(INC) -c $< flash: $(PROJECT).hex - $(AVRDUDE) -U flash:w:$<:i \ No newline at end of file + $(QUIET_AVRDUDE) -U flash:w:$<:i + +clean: + -@$(RM) $(addprefix $(PROJECT), .elf .hex) + +.PHONY: clean +.SECONDARY: $(addsuffix .elf, $(PROJECT))