-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·51 lines (37 loc) · 1.17 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
include conf.mk
include common.mk
$(shell $(call pinfo,"Making dependencies..."))
$(shell make -f deps.mk deps >/dev/null)
$(shell $(call pinfo,"Done"))
include $(DEP_FILES)
lib.so: $(OBJ_FILES)
@$(call pinfo,"Linking...")
$(CC) -g -shared $(W_FLAGS) $(I_FLAGS) $(L_FLAGS) $^ -o lib.so
@$(call psucc,"Linked into lib.so")
@$(call pinfo,"Copying lib.so to python...")
cp $@ python/lib.so
@$(call psucc,"Copied lib.so to python")
OBJFLAGS= $(D_FLAGS) $(W_FLAGS) $(I_FLAGS) $(F_FLAGS) -fPIC
obj/%.o: src/%.c
@$(call pinfo,"Creating object file $@...")
mkdir -p $(@D)
$(CC) -c -g $(OBJFLAGS) --std=$(STD) $< -o $@
@$(call psucc,"Created object file $@")
test/%.out: test/%.c $(OBJ_FILES)
@$(call pinfo,"Creating test executable $@...")
$(CC) -g $(D_FLAGS) $(W_FLAGS) $(L_FLAGS) $(I_FLAGS) --std=$(STD) $^ -o $@
@$(call psucc,"Created test executable $@")
clean_dep:
@$(call pinfo,"Removing dep/*")
rm -rf dep/*
clean_obj:
@$(call pinfo,"Removing obj/*")
rm -rf obj/*
clean_test:
@$(call pinfo,"Removing test/*/test.out")
rm test/*/test.out
clean: clean_dep clean_obj clean_test
obj: $(OBJ_FILES)
lib: lib.so
.PHONY: clean clean_dep clean_obj obj lib
.DEFAULT_GOAL := all