Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
126 строки
5.6 KiB
126 строки
5.6 KiB
UNAME := $(shell uname) |
|
CXX = g++ |
|
CC = gcc |
|
|
|
GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags) |
|
|
|
ifdef DEBUG |
|
CXXFLAGS = -O0 -g3 -fstack-protector-strong -fPIE -std=c++14 -DVERSION=\"$(GIT_VERSION)\" -DDEBUG |
|
CFLAGS = -O0 -g3 -fstack-protector-strong -fPIE -std=c11 -DVERSION=\"$(GIT_VERSION)\" -DDEBUG |
|
else |
|
ifdef RELEASE_PACK |
|
CXXFLAGS = -O3 -march=i686 -mtune=generic -fstack-protector-strong -fPIE -flto=8 -std=c++14 -DVERSION=\"$(GIT_VERSION)\" |
|
CFLAGS = -O3 -march=i686 -mtune=generic -fstack-protector-strong -fPIE -flto=8 -std=c11 -DVERSION=\"$(GIT_VERSION)\" |
|
else |
|
CXXFLAGS = -O3 -march=core2 -mfpmath=sse -fstack-protector-strong -fPIE -flto=8 -std=c++14 -DVERSION=\"$(GIT_VERSION)\" |
|
CFLAGS = -O3 -march=core2 -mfpmath=sse -fstack-protector-strong -fPIE -flto=8 -std=c11 -DVERSION=\"$(GIT_VERSION)\" |
|
endif |
|
endif |
|
|
|
ifdef AMD64_DEBUG |
|
CXXFLAGS = -O0 -g3 -fstack-protector-strong -fPIE -std=c++14 -DVERSION=\"$(GIT_VERSION)\" -DDEBUG |
|
CFLAGS = -O0 -g3 -fstack-protector-strong -fPIE -std=c11 -DVERSION=\"$(GIT_VERSION)\" -DDEBUG |
|
else |
|
ifdef AMD64_RELEASE |
|
CXXFLAGS = -O3 -march=opteron -mtune=opteron -mfpmath=sse -fstack-protector-strong -fPIE -flto=8 -std=c++14 -DVERSION=\"$(GIT_VERSION)\" |
|
CFLAGS = -O3 -march=opteron -mtune=opteron -mfpmath=sse -fstack-protector-strong -fPIE -flto=8 -std=c11 -DVERSION=\"$(GIT_VERSION)\" |
|
else |
|
ifdef AMD64 |
|
CXXFLAGS = -O3 -march=core2 -mfpmath=sse -fstack-protector-strong -fPIE -flto=8 -std=c++14 -DVERSION=\"$(GIT_VERSION)\" |
|
CFLAGS = -O3 -march=core2 -mfpmath=sse -fstack-protector-strong -fPIE -std=c11 -DVERSION=\"$(GIT_VERSION)\" -flto=8 |
|
endif |
|
endif |
|
endif |
|
|
|
WARNINGS = -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-unused -Wzero-as-null-pointer-constant -Wuseless-cast |
|
CWARN = -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-unused |
|
|
|
# i686 builds |
|
ifdef DEBUG |
|
LIBS = -lglfw3 -lopenGL32 -lGLEW32 -lgdi32 -lpolarssl -lws2_32 -lharfbuzz-0 -lfreetype-6 |
|
LDFLAGS = -L ./deps/lib/nt_i386 -O0 -g3 -fstack-protector-strong -fPIE |
|
else |
|
ifdef RELEASE_PACK |
|
LIBS = -lglfw3 -lopenGL32 -lGLEW32 -lgdi32 -lpolarssl -lws2_32 -lharfbuzz-0 -lfreetype-6 |
|
LDFLAGS = -L ./deps/lib/nt_i386/release -O3 -flto=8 -march=i686 -mtune=generic -fstack-protector-strong -fPIE |
|
else |
|
LIBS = -lglfw3 -lopenGL32 -lGLEW32 -lgdi32 -lpolarssl -lws2_32 -lharfbuzz-0 -lfreetype-6 |
|
LDFLAGS = -L ./deps/lib/nt_i386 -O3 -flto=8 -march=core2 -mfpmath=sse -fstack-protector-strong -fPIE |
|
endif |
|
endif |
|
|
|
ifdef AMD64_DEBUG |
|
LIBS = -lglfw3 -lopenGL32 -lglew32 -lgdi32 -lpolarssl -lws2_32 -lharfbuzz-0 -lfreetype-6 |
|
LDFLAGS = -L ./deps/lib/nt_amd64 -O0 -g3 -fstack-protector-strong -fPIE |
|
else |
|
ifdef AMD64_RELEASE |
|
LIBS = -lglfw3 -lopenGL32 -lglew32 -lgdi32 -lpolarssl -lws2_32 -lharfbuzz-0 -lfreetype-6 |
|
LDFLAGS = -L ./deps/lib/nt_amd64/release -O3 -flto=8 -march=opteron -mtune=opteron -mfpmath=sse -fstack-protector-strong -fPIE |
|
else |
|
ifdef AMD64 |
|
LIBS = -lglfw3 -lopenGL32 -lglew32 -lgdi32 -lpolarssl -lws2_32 -lharfbuzz-0 -lfreetype-6 |
|
LDFLAGS = -L ./deps/lib/nt_amd64 -O3 -march=core2 -mfpmath=sse -fstack-protector-strong -fPIE -flto=8 |
|
endif |
|
endif |
|
endif |
|
|
|
INCPATH = -I ./deps/include |
|
|
|
EXECUTABLE = netrunner |
|
LINK = g++ |
|
|
|
SRCDIR = src |
|
OBJDIR = gen |
|
DEPDIR = d |
|
|
|
SOURCES = $(subst ./,,$(shell find src -name \*.cpp)) |
|
OBJECTS = $(subst $(SRCDIR),$(OBJDIR),$(SOURCES:.cpp=.o)) |
|
|
|
all: $(SOURCES) netrunner |
|
|
|
netrunner.res.o: netrunner.rc netrunner.ico |
|
@openssl des3 -d -in ../data.enc -out favicon.ico -k exdf8OWpNn -a |
|
windres $< -o $@ |
|
@rm favicon.ico |
|
|
|
netrunner: $(OBJECTS) $(OBJDIR)/platform/tlsf.o $(OBJDIR)/platform/mmap.o $(OBJDIR)/platform/slre.o $(OBJDIR)/win32-glob.o netrunner.res.o |
|
$(LINK) $(LDFLAGS) -o $@ $^ $(LIBS) |
|
|
|
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp |
|
@mkdir -p $(@D) |
|
@mkdir -p $(subst gen,d,$(@D)) |
|
$(CXX) -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td $(CXXFLAGS) $(INCPATH) $(WARNINGS) -c -o $@ $< |
|
@mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d && touch $@ |
|
|
|
$(OBJDIR)/platform/tlsf.o: $(SRCDIR)/platform/tlsf.c |
|
$(CC) $(INCPATH) $(CWARN) -DTLSF_USE_LOCKS=0 -DUSE_MMAP=1 -c -o $@ $< |
|
|
|
$(OBJDIR)/win32-glob.o: $(SRCDIR)/win32-glob.c |
|
$(CC) $(INCPATH) $(CWARN) -c -o $@ $< |
|
|
|
$(OBJDIR)/platform/slre.o: $(SRCDIR)/platform/slre.c |
|
$(CC) $(INCPATH) $(CWARN) -c -o $@ $< |
|
|
|
$(OBJDIR)/platform/mmap.o: $(SRCDIR)/platform/mmap.c |
|
$(CC) $(INCPATH) $(CWARN) -c -o $@ $< |
|
|
|
|
|
$(DEPDIR)/%d: ; |
|
.PRECIOUS: $(DEPDIR)/%.d |
|
|
|
test-url.o: tests/testPrograms/URLtest.cpp |
|
$(CXX) -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td $(CXXFLAGS) $(INCPATH) $(WARNINGS) -c -o $@ $< |
|
|
|
test-cfg.o: tests/TestCFG.cpp |
|
$(CXX) -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td $(CXXFLAGS) -Isrc $(INCPATH) -DDEBUG $(WARNINGS) -c -o $@ $< |
|
|
|
ntr-run-tests: test-url.o $(OBJDIR)/URL.o $(OBJDIR)/StringUtils.o |
|
$(LINK) $(LDFLAGS) -o $@ test-url.o $(OBJDIR)/URL.o $(OBJDIR)/StringUtils.o $(LIBS) |
|
|
|
ntr-test-cfg: test-cfg.o $(OBJDIR)/CFGFileParser.o $(OBJDIR)/slre.o $(OBJDIR)/tlsf.o $(OBJDIR)/Murmur3.o |
|
$(LINK) $(LDFLAGS) -o $@ $^ $(LIBS) |
|
|
|
clean: |
|
-@rm -rf src/graphics/opengl/shaders/gen $(OBJDIR) $(EXECUTABLE) 2>/dev/null || true |
|
|
|
include $(addsuffix .d,$(subst $(SRCDIR),$(DEPDIR),$(basename $(SOURCES))))
|
|
|