You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.1 KiB
Makefile

PROJ = avr-eb
CC = avr-gcc
OBJCOPY = avr-objcopy
CPU = atmega88
CFLAGS += -Os -g -mmcu=$(CPU) -Wall
CFLAGS += -Wa,-adhlns=$(<:%.c=%.lst)
CLDFLAGS += -mmcu=$(CPU) -Wl,-Map=$(@:%.elf=%.map)
TESTOBJS += testnode.o testhbw.o
RELAISOBJS += relaisnode.o relaishbw.o
IO6OBJS += io6node.o io6hbw.o
all: testnode.hex relaisnode.hex io6node.hex
testnode.o: testnode.c hbw.h hw.h testhw.h
$(CC) $(CFLAGS) -DTESTNODE -c $< -o $@
testhbw.o: hbw.c hbw.h hw.h testhw.h
$(CC) $(CFLAGS) -DTESTNODE -c $< -o $@
testnode.elf: $(TESTOBJS)
$(CC) $(CLDFLAGS) -o $@ $(TESTOBJS)
relaisnode.o: relaisnode.c hbw.h hw.h relaishw.h
$(CC) $(CFLAGS) -DRELAISNODE -c $< -o $@
relaishbw.o: hbw.c hbw.h hw.h relaishw.h
$(CC) $(CFLAGS) -DRELAISNODE -c $< -o $@
relaisnode.elf: $(RELAISOBJS)
$(CC) $(CLDFLAGS) -o $@ $(RELAISOBJS)
io6node.o: io6node.c hbw.h hw.h io6hw.h
$(CC) $(CFLAGS) -DIO6NODE -c $< -o $@
io6hbw.o: hbw.c hbw.h hw.h io6hw.h
$(CC) $(CFLAGS) -DIO6NODE -c $< -o $@
io6node.elf: $(IO6OBJS)
$(CC) $(CLDFLAGS) -o $@ $(IO6OBJS)
%hex:%elf
$(OBJCOPY) -j .text -j .data -O srec $< $@
clean:
rm -f *.hex *.elf *.o *.lst *.map