-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
56 lines (39 loc) · 1.62 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
TARGETS = calico-firmware
all: $(TARGETS)
.PHONY: $(TARGETS)
firmware: build/calico-firmware.elf build/calico-firmware.hex build/calico-firmware.lss
CC = avr-gcc -std=c99
AVROC = avr-objcopy
AVROD = avr-objdump
AVRUP = avrdude
CFLAGS = -mmcu=atmega328p -Wall -gdwarf-2 -O3 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Ikilolib -Isrc/main/calico -Isrc/main/calico/firmware -ISpaceTimeVStig/src/main/virtual-stigmergy
CFLAGS += -DF_CPU=8000000
FLASH = -R .eeprom -R .fuse -R .lock -R .signature
EEPROM = -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0
KILOLIB = kilolib/build/kilolib.a
driver:
gcc -shared -o libkilobotcalicodriver.so -fPIC src/main/kiloCommander.c src/main/calico/driver/kilobotCalicoDriver.c -Isrc/main -Isrc/main/calico -Isrc/main/calico/driver
driver-mac: driver
mv libkilobotcalicodriver.so libkilobotcalicodriver.dylib
server: driver
gcc src/main/kiloCommanderExampleCalicoServer.c -Isrc/main -Isrc/main/calico -Isrc/main/calico/driver -L. -lkilobotcalicodriver -o server
chmod +x server
$(KILOLIB):
make -C kilolib build/kilolib.a
%.lss: %.elf
$(AVROD) -d -S $< > $@
%.hex: %.elf
$(AVROC) -O ihex $(FLASH) $< $@
%.eep: %.elf
$(AVROC) -O ihex $(EEPROM) $< $@
%.bin: %.elf
$(AVROC) -O binary $(FLASH) $< $@
build:
mkdir -p $@
build/calico-firmware.elf: $(KILOLIB) | build
$(CC) $(CFLAGS) -o $@ SpaceTimeVStig/src/main/virtual-stigmergy/vs.c src/main/calico/firmware/kilobotCalicoFirmwareDefault.c src/main/calico/firmware/kilobotCalicoFirmwareHelper.c $(KILOLIB)
clean:
rm -rf $(KILOLIB)
rm -rf build
rm -rf server
rm -rf libkilobotcalicodriver.so