From f5b1761406c48a8188e070b4d824ce93a19e320b Mon Sep 17 00:00:00 2001 From: Elijah Insua Date: Fri, 21 Sep 2012 00:41:31 -0700 Subject: [PATCH] Add support for overriding DEVICE and PROGRAMMER By setting environment variables. example: PROGRAMMER=-c arduino -P /dev/tty.usbmodemfa131 make flash --- Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 922f2b6..1659460 100755 --- a/Makefile +++ b/Makefile @@ -27,26 +27,26 @@ # is connected. # FUSES ........ Parameters for avrdude to flash the fuses appropriately. -DEVICE = atmega328p +DEVICE ?= atmega328p CLOCK = 16000000 -PROGRAMMER = -c avrisp2 -P usb +PROGRAMMER ?= -c avrisp2 -P usb OBJECTS = main.o motion_control.o gcode.o spindle_control.o serial.o protocol.o stepper.o \ eeprom.o settings.o planner.o nuts_bolts.o limits.o print.o # FUSES = -U hfuse:w:0xd9:m -U lfuse:w:0x24:m FUSES = -U hfuse:w:0xd2:m -U lfuse:w:0xff:m -# update that line with this when programmer is back up: -# FUSES = -U hfuse:w:0xd7:m -U lfuse:w:0xff:m +# update that line with this when programmer is back up: +# FUSES = -U hfuse:w:0xd7:m -U lfuse:w:0xff:m # Tune the lines below only if you know what you are doing: -AVRDUDE = avrdude $(PROGRAMMER) -p $(DEVICE) -B 10 -F -COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -I. -ffunction-sections +AVRDUDE = avrdude $(PROGRAMMER) -p $(DEVICE) -B 10 -F +COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -I. -ffunction-sections # symbolic targets: all: grbl.hex .c.o: - $(COMPILE) -c $< -o $@ + $(COMPILE) -c $< -o $@ .S.o: $(COMPILE) -x assembler-with-cpp -c $< -o $@ @@ -90,4 +90,4 @@ disasm: main.elf avr-objdump -d main.elf cpp: - $(COMPILE) -E main.c + $(COMPILE) -E main.c