forked from thewhoo/ifj15
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
42 lines (30 loc) · 953 Bytes
/
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
CC=gcc
CFLAGS=-Wall -Wextra -pedantic -O2 -std=c99
CFLAGS_DBG=-Wall -Wextra -pedantic -g -std=c99
# coverage tool - gcovr
COVERAGE_FLAGS=-Wall -Wextra -pedantic -fprofile-arcs -ftest-coverage -fPIC -O0 -std=c99
PROJECT=ifj
RM=rm -f
SRC_FILES = $(wildcard *.c)
HEADER_FILES = $(wildcard *.h)
OBJ_FILES = $(patsubst %.c, %.o, $(SRC_FILES))
DBG_OBJ_FILES = $(patsubst %.c, %.dbg.o, $(SRC_FILES))
.PHONY: all debug dbg coverage release pack clean
all: release
debug: dbg
coverage: CFLAGS = $(COVERAGE_FLAGS)
coverage: clean release
release: $(OBJ_FILES)
$(CC) $(CFLAGS) $^ -o $(PROJECT)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
dbg: $(DBG_OBJ_FILES)
$(CC) $(CFLAGS_DBG) $^ -o $(PROJECT)
%.dbg.o: %.c
$(CC) $(CFLAGS_DBG) -DDEBUG_MODE -c $< -o $@
pack:
@cp doc/dokumentace.pdf .
tar -czf xposto02.tgz $(SRC_FILES) $(HEADER_FILES) rozdeleni dokumentace.pdf Makefile
@rm -f dokumentace.pdf
clean:
$(RM) $(PROJECT) $(OBJ_FILES) $(DBG_OBJ_FILES)