-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (46 loc) · 1018 Bytes
/
Makefile
File metadata and controls
67 lines (46 loc) · 1018 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
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
###
# Compiler Options
CC = clang
###
# Source Files
COLLECTION_SRC = $(wildcard src/Collection/*.c)
REGGIE_SRC = $(wildcard src/Reggie/*.c)
SRC = $(COLLECTION_SRC) $(REGGIE_SRC)
OBJ = $(addprefix obj/, $(notdir $(SRC:.c=.o)))
###
# Test Files
TEST_SRC = $(wildcard testsrc/*.c)
TEST_PRG = $(addprefix test/, $(notdir $(TEST_SRC:.c=)))
###
# Compiler Flags
CFLAGS = -I ./include -std=c11 -Wall -g
LFLAGS =
###
# Compile the Libraries
DYNAMIC = Reggie.so
STATIC = Reggie.a
all: $(DYNAMIC) $(STATIC)
$(DYNAMIC): $(OBJ)
$(CC) $(OBJ) $(LFLAGS) -o $@
$(STATIC): $(OBJ)
$(AR) -rcs $@ $(OBJ)
obj/%.o: src/Reggie/%.c | obj
$(CC) $< -c $(CFLAGS) -o $@
obj/%.o: src/Collection/%.c | obj
$(CC) $< -c $(CFLAGS) -o $@
obj:
mkdir -p obj
###
# Compile the Tests
test: $(TEST_PRG)
test/%: testsrc/%.c $(STATIC) | test_dir
$(CC) $< $(STATIC) $(CFLAGS) $(LIBS) -o $@
./$@
test_dir:
mkdir -p test
###
# Clean
clean:
rm -Rf $(OBJ) $(TEST_PRG) $(STATIC) $(DYNAMIC)
realclean: clean
rm -Rf ./obj ./test