You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. UNAME := $(shell uname)
  2. CXX = g++
  3. GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags)
  4. CXXFLAGS = -O3 -flto=8 -std=c++14 -DVERSION=\"$(GIT_VERSION)\"
  5. WARNINGS = -Werror -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
  6. LIBS = -lglfw -lGL -lGLEW -lfreetype -lharfbuzz -lmbedtls -lmbedcrypto -lmbedx509
  7. LDFLAGS = -O3 -flto=8
  8. INCPATH = -I /usr/include/freetype2 -I /usr/include/harfbuzz
  9. MD5SUM = md5sum
  10. ifeq ($(UNAME), Darwin)
  11. CXXFLAGS = -O3 -std=c++1y -DVERSION=\"$(GIT_VERSION)\"
  12. WARNINGS =
  13. ifneq ("$(wildcard /usr/local/lib/libglfw3.a)","")
  14. LIBS = -lglfw3 -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo -lGLEW -lfreetype -lharfbuzz -lmbedtls -lmbedcrypto -lmbedx509 \
  15. else
  16. LIBS = -lglfw3 -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo -lGLEW -lfreetype -lharfbuzz -lmbedtls -lmbedcrypto -lmbedx509
  17. endif
  18. LDFLAGS = -O3 -L/usr/local/lib
  19. INCPATH = -I /usr/local/include -I /usr/local/include/freetype2 -I /usr/local/include/harfbuzz
  20. MD5SUM = md5
  21. endif
  22. EXECUTABLE = netrunner
  23. LINK = g++
  24. SRCDIR = src
  25. OBJDIR = gen
  26. DEPDIR = d
  27. SOURCES = $(subst ./,,$(shell find src -name \*.cpp))
  28. OBJECTS = $(subst $(SRCDIR),$(OBJDIR),$(SOURCES:.cpp=.o))
  29. all: $(SOURCES) netrunner
  30. netrunner: $(OBJECTS)
  31. $(LINK) $(LDFLAGS) -o $@ $^ $(LIBS)
  32. $(OBJDIR)/%.o: $(SRCDIR)/%.cpp
  33. @mkdir -p $(@D)
  34. @mkdir -p $(subst gen,d,$(@D))
  35. $(CXX) -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td $(CXXFLAGS) $(INCPATH) $(WARNINGS) -c -o $@ $<
  36. @mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d && touch $@
  37. $(DEPDIR)/%d: ;
  38. .PRECIOUS: $(DEPDIR)/%.d
  39. test-url.o: tests/testPrograms/URLtest.cpp
  40. $(CXX) -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td $(CXXFLAGS) $(INCPATH) $(WARINGS) -c -o $@ $<
  41. ntr-run-tests: test-url.o $(OBJDIR)/URL.o $(OBJDIR)/StringUtils.o
  42. $(LINK) $(LDFLAGS) -o $@ test-url.o $(OBJDIR)/URL.o $(OBJDIR)/StringUtils.o $(LIBS)
  43. clean:
  44. -@rm -rf $(OBJDIR) $(EXECUTABLE) 2>/dev/null || true
  45. include $(addsuffix .d,$(subst $(SRCDIR),$(DEPDIR),$(basename $(SOURCES))))