From: Pat Thoyts Date: Fri, 3 May 2019 20:16:38 +0000 (+0100) Subject: Makefile: support unix builds X-Git-Url: https://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=avr%2Ftimer-demo.git Makefile: support unix builds --- diff --git a/Makefile b/Makefile index 9724f46..c0ff095 100644 --- a/Makefile +++ b/Makefile @@ -6,10 +6,16 @@ F_CPU := 16000000UL INC := -I. AVRDUDE := avrdude -c usbasp -p $(DEVICE) -C $(AVR_DIR)\etc\avrdude.conf +uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') + CC := avr-gcc LD := avr-gcc OBJCOPY := avr-objcopy +ifeq ($(uname_S),Windows) RM := del >NUL +else +RM := rm -f +endif CFLAGS :=-Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-align -Wshadow \ -std=gnu99 -fshort-enums -pedantic-errors -Os -mcall-prologues \ -mmcu=$(DEVICE) -DF_CPU=$(F_CPU) @@ -26,10 +32,10 @@ all: $(PROJECT).hex %.hex: %.elf $(QUIET_OBJCOPY) -j .text -j .data -O ihex $< $@ - + %.elf: %.o $(QUIET_LD) $(LDFLAGS) $< -o $@ - + %.o: %.c $(QUIET_CC) $(CFLAGS) $(INC) -c $<