-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
42 lines (31 loc) · 824 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
SRC_DIR := src
TEST_DIR := tests
BIN_DIR := bin
CHECK404_DIR := check404
CC := gcc
PROBLEM_SET := ex1 ex2
CPPFLAGS := -Iinclude -MMD -MP
CFLAGS := -Wall
DLL_FLAGS := -fPIC -shared
LDFLAGS := -Llib
LDLIBS := -lm
.PHONY: all clean install
all: $(PROBLEM_SET)
./dll:
@mkdir -p ./dll
install:
@cd ./$(TEST_DIR)/$(CHECK404_DIR); $(MAKE) install
test: all
python3 ./$(TEST_DIR)/$(CHECK404_DIR)/check404.py
@$(MAKE) -s clean
$(PROBLEM_SET): $(BIN_DIR) ./dll
@$(CC) $(SRC_DIR)/$(@).c $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $(BIN_DIR)/[email protected]
@$(CC) $(SRC_DIR)/$(@).c $(CFLAGS) $(DLL_FLAGS) $(LDFLAGS) $(LDLIBS) -o ./dll/$(@).so
$(BIN_DIR):
@mkdir -p $(BIN_DIR)
run: $(filter-out run, $(MAKECMDGOALS))
@for i in $^; do ./$(BIN_DIR)/$$i.out; done
@$(MAKE) -s clean
clean:
@$(RM) -rf $(BIN_DIR)
@$(RM) -rf ./dll