-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (38 loc) · 1.26 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
NAME = main
OBJECTS =
CFLAGS = -I$(CS107E)/include -g -Wall -Wpointer-arith
CFLAGS += -Og -std=c99 -ffreestanding
CFLAGS += -mapcs-frame -fno-omit-frame-pointer -mpoke-function-name
LDFLAGS = -nostdlib -T memmap -L. -L$(CS107E)/lib
LDLIBS = -lm -lpiextra -lpi -lgcc
MODULES = thermalCamera.o glextra.o stickFigure.o game.o
all : $(NAME).bin $(MODULES)
%.bin: %.elf
arm-none-eabi-objcopy $< -O binary $@
%.elf: %.o $(MODULES) start.o cstart.o
arm-none-eabi-gcc $(LDFLAGS) $^ $(LDLIBS) -o $@
%.o: %.c
arm-none-eabi-gcc $(CFLAGS) -c $< -o $@
%.o: %.s
arm-none-eabi-as $(ASFLAGS) $< -o $@
%.list: %.o
arm-none-eabi-objdump --no-show-raw-insn -d $< > $@
install: $(NAME).bin
rpi-install.py -p $<
clean:
rm -f *.o *.bin *.elf *.list *~
.PHONY: all clean install
.PRECIOUS: %.o %.elf
# empty recipe used to disable built-in rules for native build
%:%.c
%:%.o
define CS107E_ERROR_MESSAGE
ERROR - CS107E environment variable is not set.
Please set it to point to the `cs107e.github.io/cs107e` directory using the
command `export CS107E=<replace with path to your cs107e.github.io directory>/cs107e`.
To have this done automatically, add the above command to your shell
environment configuration file (e.g. ~/.bashrc)
endef
ifndef CS107E
$(error $(CS107E_ERROR_MESSAGE))
endif