blob: 961bc3720abee6a9d726dd34a6ab0c005c7f2665 (
plain)
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
|
PROJECTNAME=ymake
SRC=main.cpp ymake.cpp Builder.cpp ProcessRunner.cpp file.cpp
OBJ=$(SRC:.cpp=.o)
YSCAN=yscan
YSCAN_SRC=yscan-main.cpp yscan.cpp file.cpp
YSCAN_OBJ=$(YSCAN_SRC:.cpp=.o)
TEST=test-ymake
TEST_SRC=test-ymake.cpp
TEST_OBJ=$(TEST_SRC:.cpp=.o)
all: $(PROJECTNAME) $(YSCAN)
LDLIBS += -lreichwein -lfmt
CXXFLAGS += \
-std=c++17 \
-I/usr/src/googletest/googletest/include \
-I/usr/src/googletest/googlemock/include \
-I/usr/src/googletest/googletest \
-I/usr/src/googletest/googlemock
$(PROJECTNAME): $(OBJ)
$(CXX) $(LDFLAGS) $^ $(LDLIBS) $(LIBS) -o $@
$(YSCAN): $(YSCAN_OBJ)
$(CXX) $(LDFLAGS) $^ $(LDLIBS) $(LIBS) -o $@
$(TEST): libgmock.a $(TEST_OBJ)
$(CXX) $(LDFLAGS) $^ $(LDLIBS) $(LIBS) -o $@
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
libgmock.a:
$(CXX) $(CXXFLAGS) -c /usr/src/googletest/googletest/src/gtest-all.cc
$(CXX) $(CXXFLAGS) -c /usr/src/googletest/googlemock/src/gmock-all.cc
$(CXX) $(CXXFLAGS) -c /usr/src/googletest/googlemock/src/gmock_main.cc
ar -rv libgmock.a gmock-all.o gtest-all.o gmock_main.o
test: $(TEST)
./$(TEST)
install:
mkdir -p $(DESTDIR)/usr/bin
cp $(PROJECTNAME) $(DESTDIR)/usr/bin/
cp $(YSCAN) $(DESTDIR)/usr/bin/
clean:
-rm -f *.o $(PROJECTNAME) $(YSCAN) $(TEST)
-dh_clean
deb:
dpkg-buildpackage -rfakeroot
.PHONY: clean install all deb
|