]> the.earth.li Git - temper-clone.git/blob - Makefile
Add basic Makefile targeting Digispark
[temper-clone.git] / Makefile
1 DEVICE = attiny85
2 F_CPU = 16500000
3
4 CFLAGS = -Iusbdrv -Ilibs-device -I.
5 AVRCC = avr-gcc -Wall -Os -DF_CPU=$(F_CPU) $(CFLAGS) -mmcu=$(DEVICE)
6
7 OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o \
8         libs-device/osccalASM.o main.o
9
10 all: main.hex
11
12 main.elf: $(OBJECTS) usbconfig.h
13         $(AVRCC) -o main.elf $(OBJECTS)
14
15 main.hex: main.elf
16         avr-objcopy -j .text -j .data -O ihex main.elf main.hex
17         avr-size main.hex
18
19 clean:
20         rm -f $(OBJECTS) main.elf main.hex
21
22 # Build rules to use AVRCC rather than the host CC
23
24 .c.o:
25         $(AVRCC) -c $< -o $@
26
27 .S.o:
28         $(AVRCC) -x assembler-with-cpp -c $< -o $@
29
30 # Hard coded dependencies for the usbdrv bits; otherwise changes to
31 # usbconfig.h don't result in enough bits getting recompiled.
32
33 libs-device/osccalASM.o: libs-device/osccalASM.S usbdrv/usbdrv.h usbconfig.h \
34  libs-device/osccal.h usbdrv/usbportability.h
35
36 usbdrv/oddebug.o: usbdrv/oddebug.c usbdrv/oddebug.h usbdrv/usbportability.h
37
38 usbdrv/usbdrv.o: usbdrv/usbdrv.c usbdrv/usbdrv.h usbconfig.h \
39  libs-device/osccal.h usbdrv/usbportability.h usbdrv/oddebug.h
40
41 usbdrv/usbdrvasm.o: usbdrv/usbdrvasm.S usbdrv/usbportability.h \
42  usbdrv/usbdrv.h usbconfig.h libs-device/osccal.h usbdrv/usbdrvasm165.inc \
43  usbdrv/asmcommon.inc