-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
70 lines (45 loc) · 1.14 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
# GNU makefile for Efficient C for ARM examples
# Tools
# set $(prefix) to point to cross-compiling gcc etc
cc_ ?= $(prefix)clang
ar_ ?= $(prefix)ar
link_ ?= $(prefix)clang
# Tool flags
ccflags = -c -std=c99 $(cpu) $(warnings) $(includes) -MMD
arflags = rc
linkflags =
# Compiler options
cpu =
warnings = -Wall -Wundef -Wpointer-arith -Wuninitialized \
-Wcast-align -Wwrite-strings -Wstrict-prototypes -Wunused \
-Wmissing-prototypes -Wmissing-declarations \
-Wnested-externs -Winline -Wno-unused -Wno-long-long -W \
-Wshadow
# -Wcast-qual disabled due to the amount of spam
includes = -Iinclude
# Combined tool and flags
cc = $(cc_) $(ccflags)
ar = $(ar_) $(arflags)
link = $(link_) $(linkflags)
# Rule patterns
.SUFFIXES: .o
.c.o:; $(cc) -Os -DNDEBUG $< -o $@
# Names
lib = libarm.a
# Objects
src = $(shell find . -name "*.c")
objs = $(src:.c=.o)
deps = $(src:.c=.d)
# Targets
.PHONY: release all clean
$(lib): $(objs)
$(ar) $@ $(objs)
release: $(lib)
@echo 'release' built
all: release apps
@echo 'all' built
clean:
-rm -f $(objs) $(deps)
@echo Cleaned
# Dependencies
-include $(deps)