diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 25 |
1 files changed, 23 insertions, 2 deletions
@@ -7,10 +7,19 @@ 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 += -lfmt -lreichwein -CXXFLAGS += -std=c++17 +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 $@ @@ -18,9 +27,21 @@ $(PROJECTNAME): $(OBJ) $(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/ |