-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (35 loc) · 1.13 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
# Global directories
INCLUDE_DIR = include
SRC_DIR = src
TARGET_DIR = target
CC = cc # NOTE: is this architecture-specific enough?
CFLAGS = -g -I../include
LFC_CFLAGS = $(CFLAGS) -c
TESTS_CFLAGS = $(CFLAGS) -o tests
CLIBS = -lm
TESTS_CLIBS = -L. -llfc $(CLIBS)
# TODO: this needs a lot of work to be as sophisticated as it should be
.PHONY: tests collections utils clean
all: liblfc.a
liblfc.a: $(TARGET_DIR) collections utils
ar -rc -v $(TARGET_DIR)/$@ $(TARGET_DIR)/*.o # stitch all the obj files into an archive
-rm $(TARGET_DIR)/*.o # remove the obj files
tests: $(TARGET_DIR) liblfc.a
cd $(TARGET_DIR) && $(CC) $(TESTS_CFLAGS) \
../$(SRC_DIR)/lfc/collections/tests/*.c \
../$(SRC_DIR)/lfc/utils/tests/*.c \
../$(SRC_DIR)/tests/*.c \
$(TESTS_CLIBS)
collections: $(TARGET_DIR)
cd $(TARGET_DIR) && $(CC) $(LFC_CFLAGS) \
../$(SRC_DIR)/lfc/collections/*.c \
../$(SRC_DIR)/internals/collections/*.c \
$(CLIBS)
utils: $(TARGET_DIR)
cd $(TARGET_DIR) && $(CC) $(LFC_CFLAGS) \
../$(SRC_DIR)/lfc/utils/*.c \
$(CLIBS)
$(TARGET_DIR):
mkdir -p $@
clean:
-rm -rf target