-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
82 lines (67 loc) · 1.79 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
REFPKGS = cmd
SRCPKGS = util
LIBPKGS = $(REFPKGS) $(SRCPKGS)
MAIN = main
LIBS = $(addprefix -l, $(LIBPKGS))
SRCLIBS = $(addsuffix .a, $(addprefix lib, $(SRCPKGS)))
dummy:
@echo "Error: please use make <d | a | b | linux | clean | cleanall | ctags>"
.PHONY : d a b
d: ADT = dlist
a: ADT = array
b: ADT = bst
d: ADTFLAG = -DTEST_DLIST
a: ADTFLAG = -DTEST_ARRAY
b: ADTFLAG = -DTEST_BST
d a b: clean clean all
EXEC = adtTest.$(ADT)
all: libs main
libs:
@for pkg in $(SRCPKGS); \
do \
echo "Checking $$pkg..."; \
cd src/$$pkg; \
make -f make.$$pkg --no-print-directory PKGNAME=$$pkg; \
cd ../..; \
done
main:
@echo "Checking $(MAIN)..."
@cd src/$(MAIN); \
make -f make.$(MAIN) --no-print-directory ADTFLAG=$(ADTFLAG) \
INCLIB="$(LIBS)" EXEC=$(EXEC);
@ln -fs bin/$(EXEC) .
# @strip bin/$(EXEC)
clean:
@for pkg in $(SRCPKGS); \
do \
echo "Cleaning $$pkg..."; \
cd src/$$pkg; \
make -f make.$$pkg --no-print-directory PKGNAME=$$pkg clean; \
cd ../..; \
done
@echo "Cleaning $(MAIN)..."
@cd src/$(MAIN); make -f make.$(MAIN) --no-print-directory clean
@echo "Removing $(SRCLIBS)..."
@cd lib; rm -f $(SRCLIBS)
@echo "Removing $(EXEC)..."
@rm -f bin/$(EXEC)
cleanall: clean
@echo "Removing bin/*..."
@rm -f bin/*
ctags:
@rm -f src/tags
@for pkg in $(SRCPKGS) main; \
do \
echo "Tagging $$pkg..."; \
cd src; ctags -a $$pkg/*.cpp $$pkg/*.h; cd ..; \
done
@echo "Tagging $(MAIN)..."
@cd src; ctags -a $(MAIN)/*.cpp $(MAIN)/*.h
linux mac:
@for pkg in $(REFPKGS); \
do \
cd lib; ln -sf lib$$pkg-$@.a lib$$pkg.a; cd ../..; \
done
@cd ref; ln -sf adtTest-$@.dlist adtTest.dlist; \
ln -sf adtTest-$@.array adtTest.array; \
ln -sf adtTest-$@.bst adtTest.bst