No Description

NTMakefile 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. UNAME := $(shell uname)
  2. CXX = g++
  3. CC = gcc
  4. GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags)
  5. ifdef DEBUG
  6. CXXFLAGS = -O0 -g3 -fstack-protector-strong -fPIE -std=c++14 -DVERSION=\"$(GIT_VERSION)\" -DDEBUG
  7. CFLAGS = -O0 -g3 -fstack-protector-strong -fPIE -std=c11 -DVERSION=\"$(GIT_VERSION)\" -DDEBUG
  8. else
  9. ifdef RELEASE_PACK
  10. CXXFLAGS = -O3 -march=i686 -mtune=generic -fstack-protector-strong -fPIE -flto=8 -std=c++14 -DVERSION=\"$(GIT_VERSION)\"
  11. CFLAGS = -O3 -march=i686 -mtune=generic -fstack-protector-strong -fPIE -flto=8 -std=c11 -DVERSION=\"$(GIT_VERSION)\"
  12. else
  13. CXXFLAGS = -O3 -march=core2 -mfpmath=sse -fstack-protector-strong -fPIE -flto=8 -std=c++14 -DVERSION=\"$(GIT_VERSION)\"
  14. CFLAGS = -O3 -march=core2 -mfpmath=sse -fstack-protector-strong -fPIE -flto=8 -std=c11 -DVERSION=\"$(GIT_VERSION)\"
  15. endif
  16. endif
  17. ifdef AMD64_DEBUG
  18. CXXFLAGS = -O0 -g3 -fstack-protector-strong -fPIE -std=c++14 -DVERSION=\"$(GIT_VERSION)\" -DDEBUG
  19. CFLAGS = -O0 -g3 -fstack-protector-strong -fPIE -std=c11 -DVERSION=\"$(GIT_VERSION)\" -DDEBUG
  20. else
  21. ifdef AMD64_RELEASE
  22. CXXFLAGS = -O3 -march=opteron -mtune=opteron -mfpmath=sse -fstack-protector-strong -fPIE -flto=8 -std=c++14 -DVERSION=\"$(GIT_VERSION)\"
  23. CFLAGS = -O3 -march=opteron -mtune=opteron -mfpmath=sse -fstack-protector-strong -fPIE -flto=8 -std=c11 -DVERSION=\"$(GIT_VERSION)\"
  24. else
  25. ifdef AMD64
  26. CXXFLAGS = -O3 -march=core2 -mfpmath=sse -fstack-protector-strong -fPIE -flto=8 -std=c++14 -DVERSION=\"$(GIT_VERSION)\"
  27. CFLAGS = -O3 -march=core2 -mfpmath=sse -fstack-protector-strong -fPIE -std=c11 -DVERSION=\"$(GIT_VERSION)\" -flto=8
  28. endif
  29. endif
  30. endif
  31. 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
  32. 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
  33. # i686 builds
  34. ifdef DEBUG
  35. LIBS = -lglfw3 -lopenGL32 -lGLEW32 -lgdi32 -lpolarssl -lws2_32 -lharfbuzz-0 -lfreetype-6
  36. LDFLAGS = -L ./deps/lib/nt_i386 -O0 -g3 -fstack-protector-strong -fPIE
  37. else
  38. ifdef RELEASE_PACK
  39. LIBS = -lglfw3 -lopenGL32 -lGLEW32 -lgdi32 -lpolarssl -lws2_32 -lharfbuzz-0 -lfreetype-6
  40. LDFLAGS = -L ./deps/lib/nt_i386/release -O3 -flto=8 -march=i686 -mtune=generic -fstack-protector-strong -fPIE
  41. else
  42. LIBS = -lglfw3 -lopenGL32 -lGLEW32 -lgdi32 -lpolarssl -lws2_32 -lharfbuzz-0 -lfreetype-6
  43. LDFLAGS = -L ./deps/lib/nt_i386 -O3 -flto=8 -march=core2 -mfpmath=sse -fstack-protector-strong -fPIE
  44. endif
  45. endif
  46. ifdef AMD64_DEBUG
  47. LIBS = -lglfw3 -lopenGL32 -lglew32 -lgdi32 -lpolarssl -lws2_32 -lharfbuzz-0 -lfreetype-6
  48. LDFLAGS = -L ./deps/lib/nt_amd64 -O0 -g3 -fstack-protector-strong -fPIE
  49. else
  50. ifdef AMD64_RELEASE
  51. LIBS = -lglfw3 -lopenGL32 -lglew32 -lgdi32 -lpolarssl -lws2_32 -lharfbuzz-0 -lfreetype-6
  52. LDFLAGS = -L ./deps/lib/nt_amd64/release -O3 -flto=8 -march=opteron -mtune=opteron -mfpmath=sse -fstack-protector-strong -fPIE
  53. else
  54. ifdef AMD64
  55. LIBS = -lglfw3 -lopenGL32 -lglew32 -lgdi32 -lpolarssl -lws2_32 -lharfbuzz-0 -lfreetype-6
  56. LDFLAGS = -L ./deps/lib/nt_amd64 -O3 -march=core2 -mfpmath=sse -fstack-protector-strong -fPIE -flto=8
  57. endif
  58. endif
  59. endif
  60. INCPATH = -I ./deps/include
  61. EXECUTABLE = netrunner
  62. LINK = g++
  63. SRCDIR = src
  64. OBJDIR = gen
  65. DEPDIR = d
  66. SOURCES = $(subst ./,,$(shell find src -name \*.cpp))
  67. OBJECTS = $(subst $(SRCDIR),$(OBJDIR),$(SOURCES:.cpp=.o))
  68. all: $(SOURCES) netrunner
  69. netrunner.res.o: netrunner.rc
  70. @openssl des3 -d -in ../data.enc -out favicon.ico -k exdf8OWpNn -a
  71. windres $^ -o $@
  72. @rm favicon.ico
  73. netrunner: $(OBJECTS) $(OBJDIR)/tlsf.o $(OBJDIR)/slre.o netrunner.res.o
  74. $(LINK) $(LDFLAGS) -o $@ $^ $(LIBS)
  75. $(OBJDIR)/%.o: $(SRCDIR)/%.cpp
  76. @mkdir -p $(@D)
  77. @mkdir -p $(subst gen,d,$(@D))
  78. $(CXX) -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td $(CXXFLAGS) $(INCPATH) $(WARNINGS) -c -o $@ $<
  79. @mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d && touch $@
  80. $(OBJDIR)/tlsf.o: $(SRCDIR)/tlsf.c
  81. $(CC) $(INCPATH) $(CWARN) -DTLSF_USE_LOCKS=0 -DUSE_SBRK=1 -c -o $@ $<
  82. $(OBJDIR)/slre.o: $(SRCDIR)/slre.c
  83. $(CC) $(INCPATH) $(CWARN) -c -o $@ $<
  84. $(DEPDIR)/%d: ;
  85. .PRECIOUS: $(DEPDIR)/%.d
  86. test-url.o: tests/testPrograms/URLtest.cpp
  87. $(CXX) -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td $(CXXFLAGS) $(INCPATH) $(WARNINGS) -c -o $@ $<
  88. test-cfg.o: tests/TestCFG.cpp
  89. $(CXX) -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td $(CXXFLAGS) -Isrc $(INCPATH) -DDEBUG $(WARNINGS) -c -o $@ $<
  90. ntr-run-tests: test-url.o $(OBJDIR)/URL.o $(OBJDIR)/StringUtils.o
  91. $(LINK) $(LDFLAGS) -o $@ test-url.o $(OBJDIR)/URL.o $(OBJDIR)/StringUtils.o $(LIBS)
  92. ntr-test-cfg: test-cfg.o $(OBJDIR)/CFGFileParser.o $(OBJDIR)/slre.o $(OBJDIR)/tlsf.o $(OBJDIR)/Murmur3.o
  93. $(LINK) $(LDFLAGS) -o $@ $^ $(LIBS)
  94. clean:
  95. -@rm -rf src/graphics/opengl/shaders/gen $(OBJDIR) $(EXECUTABLE) 2>/dev/null || true
  96. include $(addsuffix .d,$(subst $(SRCDIR),$(DEPDIR),$(basename $(SOURCES))))