-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (47 loc) · 901 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
RM=rm -f
CXX=g++
AR=ar
ARFLAGS=rcs
CPPFLAGS=
TEST_SRCS=test.cpp
TEST_OBJS=$(subst .cpp,.o,$(TEST_SRCS))
SRCS=csv.cpp
OBJS=$(subst .cpp,.o,$(SRCS))
LIB=libcsv.a
INSTALL=/usr/local
.PHONY: all
all: lib
# Building
.PHONY: lib
lib: $(LIB)
$(LIB): $(OBJS)
$(AR) $(ARFLAGS) $(LIB) $(OBJS)
test: $(TEST_OBJS) $(OBJS)
$(CXX) $(CPPFLAGS) $^ -o $@
# Installing
.PHONY: install
install: $(LIB)
cp $(LIB) $(INSTALL)/lib
cp csv.hpp $(INSTALL)/include
.PHONY: uninstall
uninstall:
$(RM) $(INSTALL)/lib/$(LIB)
$(RM) $(INSTALL)/include/csv.hpp
# Cleaning
.PHONY: clean
clean:
$(RM) $(OBJS)
$(RM) $(TEST_OBJS)
$(RM) $(LIB)
$(RM) test
.PHONY: distclean
distclean: clean
$(RM) *~ .depend
# Dependencies
.PHONY: depend
depend: .depend
.depend: $(SRCS) $(TEST_SRCS)
$(RM) ./.depend
$(CXX) $(CPPFLAGS) -MM $(SRCS) >> ./.depend;
$(CXX) $(CPPFLAGS) -MM $(TEST_SRCS) >> ./.depend;
include .depend