-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
70 lines (55 loc) · 1.85 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
AS = arm-none-eabi-as
CPP = arm-none-eabi-cpp
CC = arm-none-eabi-gcc
OBJCOPY = arm-none-eabi-objcopy
RPI1 = -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s \
-nostartfiles
CSTD = -std=c99
WARNINGS = -Wall -Wextra -Wformat=2 -pedantic \
-Wfloat-equal -Wundef -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \
-Wstrict-overflow=5 -Wwrite-strings \
-Wdouble-promotion
ERRORS = -Werror -pedantic-errors -Wno-error=unused-result -Wno-error=cast-align
DEFINES = -D_DEFAULT_SOURCE
INCLUDES = -I libarmc
DEPSINFO = -MD -MP
OPTIMIZE = -O0 -DDEBUG
ifeq ($(BUILD),release)
OPTIMIZE = -O0 -DNDEBUG
endif
ASFLAGS = $(RPI1)
CFLAGS = $(RPI1) $(CSTD) $(WARNINGS) $(ERRORS) $(DEFINES) $(INCLUDES) $(DEPSINFO) $(OPTIMIZE)
LDFLAGS = $(RPI1) -Wl,-T,libarmc/rpi.x -L libarmc -L assets
LDLIBS = -lc -larmc -lassets -lm
OBJCOPYFLAGS = -O binary
CHECKPATCH_IGNORE = VOLATILE,NEW_TYPEDEFS
BINARIES = kernel.img
.SUFFIXES: .c .o
.PHONY: all assets libarmc clean release
all: checksrc assets $(BINARIES)
kernel.elf: $(patsubst %.c,%.o,$(wildcard *.c)) libarmc/libarmc.a assets/assets.a libarmc/rpi.x
$(CC) $(LDFLAGS) $(LOADLIBES) -o $@ $(filter %.o,$^) $(LDLIBS)
assets:
$(MAKE) -C assets
libarmc:
$(MAKE) -C libarmc
assets/assets.h: assets
assets/assets.a: assets
game.c: assets/assets.h
draw.c: assets/assets.h
splash.c: assets/assets.h
text.c: assets/assets.h
splash.c: assets/assets.h
libarmc/libarmc.a: libarmc
%.img: %.elf
$(OBJCOPY) $(OBJCOPYFLAGS) $< $@
clean:
$(RM) $(BINARIES) $(wildcard *.elf) $(wildcard *.o) $(wildcard *.d)
$(MAKE) -C libarmc clean
$(MAKE) -C assets clean
release:
make "BUILD=release"
checksrc:
scripts/checkpatch.pl --quiet --ignore $(CHECKPATCH_IGNORE) --no-tree -file $(wildcard *.c) $(wildcard *.h)
-include $(wildcard *.d)