CXXFLAGS=-std=c++17 -O0 -g -pg -no-pie -pipe -MMD -Wall -Wextra RELEASE_CXXFLAGS=-std=c++17 -O3 -pipe -MMD -Wall -Wextra LDFLAGS=-lsqlite3 -lpthread -lcrypto -lstdc++fs #currently default g++ versions in most distros do not usually support c++17 well enough CXX=g++-8.2.0 SOURCES=$(wildcard *.cpp) SOURCES+=$(wildcard gateway/*.cpp) SOURCES+=$(wildcard handlers/*.cpp) SOURCES+=$(wildcard database/*.cpp) SOURCES+=$(wildcard cache/*.cpp) HEADERS=$(wildcard *.h) HEADERS+=$(wildcard gateway/*.h) HEADERS+=$(wildcard handlers/*.h) HEADERS+=$(wildcard database/*.h) HEADERS+=$(wildcard cache/*.h) OBJECTS=$(patsubst %.cpp, %.o, $(SOURCES)) WIKIOBJECTS=$(filter-out test.o, $(OBJECTS)) TESTOBJECTS=$(filter-out qswiki.o, $(OBJECTS)) DEPENDS = ${WIKIOBJECTS:.o=.d} -include ${DEPENDS} # Points to the root of Google Test, relative to where this file is. # Remember to tweak this if you move this file. GTEST_DIR = /home/data/SOURCES/gtest/googletest GTESTS_TESTDIR = ./tests/ GTEST_CXXFLAGS=-std=c++17 -isystem $(GTEST_DIR)/include -I$(GTEST_DIR) -g -O0 -pipe -Wall -Wextra GTEST_LDFLAGS=-lsqlite3 -g -O0 -lpthread -lcrypto -lstdc++fs GTEST_OBJECTS=$(filter-out qswiki.o, $(WIKIOBJECTS)) .DEFAULT_GOAL := qswiki release: CXXFLAGS=$(RELEASE_CXXFLAGS) release: qswiki qswiki: $(WIKIOBJECTS) $(CXX) $(WIKIOBJECTS) ${LDFLAGS} -I database/hdr -o qswiki test: $(TESTOBJECTS) $(CXX) $(TESTOBJECTS) ${LDFLAGS} -o test gtest: $(GTESTS_TESTDIR)/*.cpp $(GTEST_OBJECTS) $(CXX) -o gtest $(GTESTS_TESTDIR)/*.cpp $(GTEST_OBJECTS) $(GTEST_CXXFLAGS) $(GTEST_DIR)/src/gtest_main.cc $(GTEST_DIR)/src/gtest-all.cc $(GTEST_LDFLAGS) %.o:%.cpp $(CXX) ${CXXFLAGS} ${LDFLAGS} -I database/hdr -c -o $@ $< clean: rm -f $(OBJECTS) $(DEPENDS)