-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (22 loc) · 889 Bytes
/
Makefile
File metadata and controls
30 lines (22 loc) · 889 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
CFLAGS = -Wall -Wextra -ggdb3 -Iinclude
LFLAGS = -ldl -lm
FUNC_TESTS_SRC = $(wildcard prog/*.c)
FUNC_TESTS_BIN = $(subst prog, bin, $(FUNC_TESTS_SRC:%.c=%.exe))
UNIT_TESTS_SRC = $(wildcard tests/*.c)
UNIT_TESTS_BIN = $(subst tests, bin/tests, $(UNIT_TESTS_SRC:%.c=%.exe))
UNIT_TESTS_HOWTO_SRC = $(wildcard tests/howto/*.c)
UNIT_TESTS_HOWTO_BIN = $(subst tests/howto, bin/tests/howto, $(UNIT_TESTS_HOWTO_SRC:%.c=%.exe))
SRC = $(wildcard src/*.c)
OBJ = $(SRC:%.c=%.o)
INCLUDES = $(wildcard include/*/*.h)
all : $(FUNC_TESTS_BIN) $(UNIT_TESTS_BIN) $(UNIT_TESTS_HOWTO_BIN)
bin/%.exe : prog/%.o $(OBJ) $(INCLUDES)
@mkdir -p bin
$(CC) $(OBJ) $< $(LFLAGS) -o $@
bin/tests/%.exe : tests/%.o $(OBJ) $(INCLUDES)
@mkdir -p bin/tests/howto
$(CC) $(OBJ) $< $(LFLAGS) -o $@
clean :
$(RM) $(OBJ)
$(RM) $(FUNC_TESTS_BIN) $(UNIT_TESTS_BIN) $(UNIT_TESTS_HOWTO_BIN)
find . -name "*~" -delete