heptagon-arduino/lcd_hept/Makefile
2020-12-27 12:44:25 +01:00

42 lines
764 B
Makefile

CC = avr-gcc
OBJCOPY = avr-objcopy
AVRDUDE = avrdude
CFLAGS = -Os -DF_CPU=16000000UL -mmcu=atmega328p
SERIAL = /dev/cu.usbmodem141401
ADDR = $(shell heptc -where)/c
TARGET = prog
LIB = arduinolib
MAIN = main
.PHONY: all clean flash
all: $(TARGET).hex
flash: $(TARGET).hex
$(AVRDUDE) -F -V -c arduino -p ATMEGA328P -P $(SERIAL) -b 115200 \
-U flash:w:$<
$(TARGET).hex: $(TARGET)
$(OBJCOPY) -O ihex -R .eeprom $< $@
$(TARGET): $(TARGET).o
$(CC) $(CFLAGS) -o $@ *.o
$(TARGET).o : $(TARGET).c
$(CC) -g $(CFLAGS) -c -I $(ADDR) -I . $(LIB).c $(TARGET)_c/*.c $(MAIN).c
$(TARGET).c:
heptc $(LIB).epi
heptc -target c $(TARGET).ept
clean:
rm -f $(TARGET) $(TARGET).hex $(TARGET).o $(TARGET).log $(TARGET).mls
rm -f *.o *.epci
rm -r $(TARGET)_c