~technomancy/menelaus

ref: 71e98173e8bc388874d4b2ea8a7092336a88a40c menelaus/Makefile -rw-r--r-- 1.3 KiB
71e98173Phil Hagelberg Fix reset function. 7 months ago
                                                                                
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
37
38
39
40
41
42
43
44
45
MCU=atmega32u4
F_CPU=16000000

LAYOUT?=qwerty

USB=/dev/ttyACM0

build: $(LAYOUT).hex

upload: $(LAYOUT).hex
	@echo "Put your device in bootloader mode now..."
	@echo "Classic Atreus: press reset key (usually fn+esc -> B)."
	@echo "Keyboardio Atreus: press the button on the underside of the board."
	while [ ! -r $(USB) ]; do sleep 1; done; \
	avrdude -p $(MCU) -c avr109 -U flash:w:$(LAYOUT).hex -P $(USB)

test: ; racket test.rkt

clean: ; -rm -f $(LAYOUT){,.hex} *.o *.elf *.s

count: ; cloc menelaus.scm keycodes.scm $(LAYOUT).scm

$(LAYOUT).hex: $(LAYOUT).elf
	avr-size $(LAYOUT).elf
	avr-objcopy --output-target=ihex $(LAYOUT).elf $(LAYOUT).hex

$(LAYOUT).s: $(LAYOUT).scm menelaus.scm keycodes.scm
	microscheme -m LEO $(LAYOUT).scm

%.elf: %.s usb_keyboard.s
	avr-gcc -mmcu=$(MCU) -o $(LAYOUT).elf $(LAYOUT).s usb_keyboard.s

usb_keyboard.s: usb_keyboard.h usb_keyboard.c
	avr-gcc -std=gnu99 -S -D F_CPU=$(F_CPU)UL -mmcu=$(MCU) -c \
	  -o usb_keyboard.s usb_keyboard.c

udev: /etc/udev/rules.d/a-star.rules

/etc/udev/rules.d/a-star.rules:
	echo "SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"1ffb\", \
	  ATTRS{idProduct}==\"0101\", ENV{ID_MM_DEVICE_IGNORE}=\"1\"" > $@
	echo "SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"1ffb\", \
	  ATTRS{idProduct}==\"2300\", ENV{ID_MM_DEVICE_IGNORE}=\"1\"" >> $@

.PHONY: build upload test clean count udev