menelaus/Makefile

46 lines
1.3 KiB
Makefile
Raw Normal View History

2014-12-04 04:00:25 +00:00
MCU=atmega32u4
F_CPU=16000000
LAYOUT?=qwerty
2014-12-04 04:00:25 +00:00
2019-07-03 04:43:13 +00:00
USB=/dev/ttyACM0
2014-12-04 04:00:25 +00:00
build: $(LAYOUT).hex
2014-12-04 04:00:25 +00:00
upload: $(LAYOUT).hex
@echo "Put your device in bootloader mode now..."
@echo "Classic Atreus: connect GND pin to RST pin twice in under a secod."
@echo "Keyboardio Atreus: press the button on the underside of the board."
2019-07-03 04:43:13 +00:00
while [ ! -r $(USB) ]; do sleep 1; done; \
avrdude -p $(MCU) -c avr109 -U flash:w:$(LAYOUT).hex -P $(USB)
2014-12-04 04:00:25 +00:00
2019-07-02 03:01:10 +00:00
test: ; racket test.rkt
clean: ; -rm -f $(LAYOUT){,.hex} *.o *.elf *.s
count: ; cloc menelaus.scm keycodes.scm $(LAYOUT).scm
2014-12-04 04:00:25 +00:00
$(LAYOUT).hex: $(LAYOUT).elf
avr-size $(LAYOUT).elf
avr-objcopy --output-target=ihex $(LAYOUT).elf $(LAYOUT).hex
2014-12-04 04:00:25 +00:00
$(LAYOUT).s: $(LAYOUT).scm menelaus.scm keycodes.scm
microscheme -m LEO $(LAYOUT).scm
2014-12-04 04:00:25 +00:00
%.elf: %.s usb_keyboard.s
avr-gcc -mmcu=$(MCU) -o $(LAYOUT).elf $(LAYOUT).s usb_keyboard.s
2014-12-04 04:00:25 +00:00
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
2019-07-02 03:01:10 +00:00
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