-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
35 lines (25 loc) · 755 Bytes
/
Makefile
File metadata and controls
35 lines (25 loc) · 755 Bytes
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
CC ?= gcc
CFLAGS ?= -Wall \
-D_FORTIFY_SOURCE=2 \
-Wextra -Wcast-align -Wcast-qual -Wpointer-arith \
-Waggregate-return -Wunreachable-code -Wfloat-equal \
-Wformat=2 -Wredundant-decls -Wundef \
-Wdisabled-optimization -Wshadow -Wmissing-braces \
-Wstrict-aliasing=2 -Wstrict-overflow=5 -Wconversion \
-Wno-unused-parameter \
-pedantic -std=c11 -Isrc -Itest
CFLAGS_DEBUG := -g -DDEBUG
CFLAGS_RELEASE := -O3
all: debug
debug: CFLAGS += $(CFLAGS_DEBUG)
debug: cbor
release: CFLAGS += $(CFLAGS_RELEASE)
release: cbor
cbor: build/test/main.o build/test/cjson/cJSON.o build/src/cbor.o
$(CC) $^ -o $@ $(CFLAGS)
build/%.o: %.c
@mkdir -p $(dir $@)
$(CC) -o $@ -c $< $(CFLAGS)
.PHONY: debug release
clean:
rm -rf build