-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (66 loc) · 2.4 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
71
72
73
74
75
76
77
78
79
80
81
82
83
AR := arm-none-eabi-ar
CC := arm-none-eabi-gcc
HOSTCC := cc
HOSTCXX := c++
HOSTLD := c++
SUBMODULES := libopencm3 agg
OPENCM3_DIR := submodules/libopencm3
AGG_DIR := submodules/agg
CPPFLAGS := -DSTM32F4
CPPFLAGS += -Isrc -Iinclude -I$(OPENCM3_DIR)/include
TARGET_ARCH := -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
CFLAGS := -MD -std=gnu99 \
-Wall -Wundef -Wextra -Wshadow -Werror \
-Wimplicit-function-declaration -Wredundant-decls \
-Wmissing-prototypes -Wstrict-prototypes \
-g -O3
LDFLAGS := --static -nostartfiles \
-Lsrc -L$(OPENCM3_DIR)/lib \
-Tstm32f4-1bitsy.ld -Wl,--gc-sections
POST_LDFLAGS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group
LDLIB_OPENCM3 := -lopencm3_stm32f4
# Included makefiles populate these.
DFILES :=
DIRT :=
EXAMPLE_ELVES :=
all: opencm3 agg lib examples
include src/Dir.make
include pixmaps/Dir.make
include examples/Dir.make
clean:
$(RM) -r $(DIRT) $(DFILES)
realclean: clean
$(MAKE) -C $(OPENCM3_DIR) clean
$(MAKE) -C $(AGG_DIR) clean
$(MAKE) -C $(AGG_DIR)/examples/macosx_sdl clean
find $(AGG_DIR) -name '*.o' -exec rm -f '{}' ';'
opencm3:
# # XXX libopencm3 can't stop rebuilding the world.
@ [ -f $(OPENCM3_DIR)/lib/libopencm3_stm32f4.a ] || \
$(MAKE) -C $(OPENCM3_DIR) TARGETS=stm32/f4
agg:
# # XXX submake is too noisy.
@ $(MAKE) -s -C $(AGG_DIR) --no-print-directory
@ $(MAKE) -s \
-C $(AGG_DIR)/examples/macosx_sdl \
--no-print-directory \
freetype
examples: $(EXAMPLE_ELVES)
ifeq ($(wildcard $(OPENCM3_DIR)/*),)
missing_submodule := libopencm3
endif
ifeq ($(wildcard $(AGG_DIR)/*),)
missing_submodule := agg
endif
ifdef missing_submodule
# Hack: newline variable
# https://stackoverflow.com/questions/17055773
define n
endef
$(error $(missing_submodule) submodule is not initialized.$n\
please run:$n\
$$ git submodule init$n\
$$ git submodule update$n\
before running make)
endif
-include $(DFILES)