-
Notifications
You must be signed in to change notification settings - Fork 6
/
makefile
40 lines (31 loc) · 1.21 KB
/
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
37
38
39
40
CFLAGS = -V -mmcs51 --model-large --xram-size 0x1800 --xram-loc 0x0000 --code-size 0xec00 --stack-auto --Werror -Isrc --opt-code-speed
CC = sdcc
TARGET = build
DEFINES = \
-DSDA_BIT=P1_0 -DSDA_DIR=P1_DIR -DSDA_PU=P1_PU -DSDA_MASK="(1 << 0)" \
-DSCL_BIT=P0_1 -DSCL_DIR=P0_DIR -DSCL_PU=P0_PU -DSCL_MASK="(1 << 1)"
USB_HID_OBJS = \
hid.rel hid_dualshock3.rel hid_guncon3.rel hid_keyboard.rel hid_mouse.rel \
hid_switch.rel hid_xbox.rel
USB_OBJS = \
cdc_device.rel hid_device.rel usb_device.rel usb_host.rel $(USB_HID_OBJS)
OBJS = \
adc.rel ch559.rel flash.rel gpio.rel i2c.rel led.rel pwm1.rel serial.rel \
timer3.rel uart1.rel $(USB_OBJS)
.PHONY: all clean build
all: build $(TARGET).bin
clean:
rm -rf build $(TARGET).bin
.SILENT:
build:
mkdir -p build
build/%.rel: src/%.c src/*.h src/usb/*.h src/usb/hid/*.h
$(CC) -c $(CFLAGS) $(DEFINES) -o $@ $<
build/%.rel: src/usb/%.c src/*.h src/usb/*.h src/usb/hid/*.h
$(CC) -c $(CFLAGS) $(DEFINES) -o $@ $<
build/%.rel: src/usb/hid/%.c src/*.h src/usb/*.h src/usb/hid/*.h
$(CC) -c $(CFLAGS) $(DEFINES) -o $@ $<
build/$(TARGET).ihx: $(addprefix build/,$(OBJS))
$(CC) $(CFLAGS) $(addprefix build/,$(OBJS)) -o $@
%.bin: build/%.ihx
sdobjcopy -I ihex -O binary $< $@