Newer
Older
CXX = gpp
CC = gcc
GIT_VERSION := $(shell cat version.git)
PLATFORM := $(MACHTYPE)
CXXFLAGS = -O3 -march=i486 -flto=8 -DVERSION=\"$(GIT_VERSION)\" -DPLATFORM=\"$(PLATFORM)\" -fpermissive -fstack-protector-strong
CFLAGS = -O3 -flto=8 -march=i486 -std=c11 -DVERSION=\"$(GIT_VERSION)\" -fstack-protector-strong
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
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
LIBS = -lglfw -lGL -lGLEW -lharfbuzz -lpolarssl -lwatt -lnx11 -lnano-x -lfreetype2 -lpthread -Ld:/djgpp/lib
LDFLAGS = -O3 -flto=8 -march=i486 -fstack-protector-strong
INCPATH = -Ideps/include
SOURCES = $(subst ./,,$(shell find src -name *.cpp))
OBJECTS = $(subst $(SRCDIR),$(OBJDIR),$(SOURCES:.cpp=.o))
all: $(SOURCES) netrunner
netrunner: $(OBJECTS) $(OBJDIR)/tlsf.o
$(LINK) $(LDFLAGS) -o $@ $^ stub.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 $(DEPDIR)/$*.Td $(DEPDIR)/$*.d
touch $@
$(OBJDIR)/tlsf.o: $(SRCDIR)/tlsf.c
$(CC) $(INCPATH) $(CWARN) -DTLSF_USE_LOCKS=0 -DUSE_SBRK=1 -c -o $@ $<
$(DEPDIR)/%d: ;
.PRECIOUS: $(DEPDIR)/%.d
test-url.o: tests/testPrograms/URLtest.cpp
$(CXX) -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td $(CXXFLAGS) $(INCPATH) $(WARINGS) -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)
clean:
-@rm -rf src/graphics/opengl/shaders/gen $(OBJDIR) $(EXECUTABLE) 2> NUL | true
include $(addsuffix .d,$(subst $(SRCDIR),$(DEPDIR),$(basename $(SOURCES))))