forked from technomancy/orestes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (26 loc) · 945 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
TARGET=orestes
MCU=atmega32u4
F_CPU=16000000
build: inline
avr-gcc -std=gnu99 -Os -D F_CPU=$(F_CPU)UL -mmcu=$(MCU) -c -o $(TARGET).o $(TARGET).c
avr-gcc -std=gnu99 -Os -D F_CPU=$(F_CPU)UL -mmcu=$(MCU) -c -o usb_keyboard.o usb_keyboard.c
avr-gcc -Wattributes -std=gnu99 -Os -D F_CPU=$(F_CPU)UL -mmcu=$(MCU) -c -o orestes_board.o orestes_board.c
avr-gcc -mmcu=$(MCU) usb_keyboard.o $(TARGET).o orestes_board.o -o $(TARGET)
avr-size $(TARGET)
avr-objcopy -O ihex -R .eeprom $(TARGET) $(TARGET).hex
SRC ?= orestes.fs
inline:
ruby -ne 'n ||= 0; puts "run(PSTR(\"#{$$_.chomp}\"));" unless $$_.chomp.empty?' orestes.fs > inlined.c
local:
gcc -std=gnu99 -c $(TARGET).c -o $(TARGET).o
gcc $(TARGET).o -o $(TARGET)
simulate: local
cat $(TARGET).fs | ./$(TARGET)
upload: build
teensy_loader_cli -w -mmcu=$(MCU) $(TARGET).hex
test: local
tests/run ./$(TARGET)
repl: local
./$(TARGET)
clean:
rm -f $(TARGET).o $(TARGET).hex $(TARGET)