qswiki/Makefile

74 строки
2.2 KiB
Makefile
Исходник Постоянная ссылка Обычный вид История

2018-11-03 17:12:20 +01:00
2021-10-19 12:47:57 +02:00
CPPSTD=c++20
CXXFLAGS=-std=$(CPPSTD) -O0 -g -no-pie -pipe -MMD -Wall -Wextra
RELEASE_CXXFLAGS=-std=$(CPPSTD) -O3 -pipe -MMD -Wall -Wextra
LDFLAGS=-lsqlite3 -lpthread -lcrypto -lstdc++fs
INCLUDEFLAGS=-I submodules/sqlitemoderncpp/hdr -I submodules/cpp-httplib -I submodules/exile.h
2018-11-03 17:12:20 +01:00
CXX=g++
2018-11-03 17:12:20 +01:00
SOURCES=$(wildcard *.cpp)
SOURCES+=$(wildcard gateway/*.cpp)
SOURCES+=$(wildcard handlers/*.cpp)
SOURCES+=$(wildcard database/*.cpp)
SOURCES+=$(wildcard cache/*.cpp)
SOURCES+=$(wildcard sandbox/*.cpp)
SOURCES+=$(wildcard dynamic/*.cpp)
2018-11-03 17:12:20 +01:00
HEADERS=$(wildcard *.h)
HEADERS+=$(wildcard gateway/*.h)
HEADERS+=$(wildcard handlers/*.h)
HEADERS+=$(wildcard database/*.h)
HEADERS+=$(wildcard cache/*.h)
HEADERS+=$(wildcard sandbox/*.h)
HEADERS+=$(wildcard dynamic/*.h)
2018-11-03 17:12:20 +01:00
OBJECTS=$(patsubst %.cpp, %.o, $(SOURCES))
WIKIOBJECTS=$(filter-out test.o, $(OBJECTS))
TESTOBJECTS=$(filter-out qswiki.o, $(OBJECTS))
DEPENDS = ${WIKIOBJECTS:.o=.d}
-include ${DEPENDS}
2018-11-03 17:12:20 +01:00
# 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/
2021-10-19 12:47:57 +02:00
GTEST_CXXFLAGS=-std=$(CPPSTD) -isystem $(GTEST_DIR)/include -I$(GTEST_DIR) -g -O0 -pipe -Wall -Wextra
2018-11-03 17:12:20 +01:00
GTEST_LDFLAGS=-lsqlite3 -g -O0 -lpthread -lcrypto -lstdc++fs
GTEST_OBJECTS=$(filter-out qswiki.o, $(WIKIOBJECTS))
.DEFAULT_GOAL := qswiki
release: CXXFLAGS=$(RELEASE_CXXFLAGS)
2021-10-10 12:01:52 +02:00
profile: CXXFLAGS=$(RELEASE_CXXFLAGS) -pg
profile: LDFLAGS+= -pg
2018-11-03 17:12:20 +01:00
release: qswiki
2021-10-10 12:01:52 +02:00
profile: qswiki
exile.o: submodules/exile.h/exile.c
$(CC) -std=c99 -DHAVE_LANDLOCK=0 -c submodules/exile.h/exile.c -o exile.o
qswiki: $(WIKIOBJECTS) exile.o
$(CXX) $(WIKIOBJECTS) exile.o ${LDFLAGS} ${INCLUDEFLAGS} -o qswiki
2018-11-03 17:12:20 +01:00
test: $(TESTOBJECTS)
2018-11-03 17:12:20 +01:00
$(CXX) $(TESTOBJECTS) ${LDFLAGS} -o test
2018-11-03 17:12:20 +01:00
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)
2018-11-03 17:12:20 +01:00
%.o:%.cpp
$(CXX) ${CXXFLAGS} ${INCLUDEFLAGS} -c -o $@ $<
2018-11-03 17:12:20 +01:00
version.o:version.cpp
$(CXX) ${CXXFLAGS} ${INCLUDEFLAGS} -DGITCOMMIT=\"$(shell git rev-parse --short HEAD)\" -c -o $@ $<
2018-11-03 17:12:20 +01:00
clean:
rm -f exile.o $(OBJECTS) $(DEPENDS)
2018-11-03 17:12:20 +01:00