-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (41 loc) · 1.12 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
48
49
50
51
52
53
54
55
56
BUILD_DIR := build
CFLAGS := -std=c11 -Wall -pedantic -O2
test: test-sds test-vector test-deque test-heap test-dict test-rbtree test-bitset
test-sds: sds
$(MAKE) -C sds
test-vector: vector
$(MAKE) -C vector
test-deque: deque
$(MAKE) -C deque
test-heap: heap
$(MAKE) -C heap
test-dict: dict
$(MAKE) -C dict
test-rbtree: rbtree
$(MAKE) -C rbtree
test-bitset: bitset
$(MAKE) -C bitset
clean:
$(MAKE) clean -C sds
$(MAKE) clean -C vector
$(MAKE) clean -C deque
$(MAKE) clean -C heap
$(MAKE) clean -C dict
$(MAKE) clean -C rbtree
$(MAKE) clean -C bitset
rm -rf $(BUILD_DIR)
PREFIX := /usr/local
HEADERS := $(shell find . -name '*.h')
SOURCES := sds/sds.c bitset/bitset.c
$(BUILD_DIR)/sds.o: sds/sds.c sds/sds.h
@mkdir -p $(BUILD_DIR)
$(CC) -o $@ -c sds/sds.c $(CFLAGS)
$(BUILD_DIR)/bitset.o: bitset/bitset.c bitset/bitset.h
@mkdir -p $(BUILD_DIR)
$(CC) -o $@ -c bitset/bitset.c $(CFLAGS)
install: $(BUILD_DIR)/sds.o $(BUILD_DIR)/bitset.o
ar rcs $(BUILD_DIR)/libcp.a $^
cp $(BUILD_DIR)/libcp.a $(PREFIX)/lib/
cp $(HEADERS) $(PREFIX)/include/
cp $(SOURCES) $(PREFIX)/include/
cp combine.py $(PREFIX)/bin/combine