ref: 5a9553cb300148a5ec918b4816d2564d287beb2e
parent: 53b39cfa725c5f2f3f41c2a49dbc8ab00737337e
author: Clownacy <[email protected]>
date: Sat Mar 2 18:15:08 EST 2019
Makefile fixes and added link-time optimisation Noticed the mistakes while compiling with Clang on Arch.
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
ifeq ($(RELEASE), 1)
- CXXFLAGS = -O3 -s
+ CXXFLAGS = -O3 -flto
+ LDFLAGS = -s
FILENAME_DEF = release
else
CXXFLAGS = -O0 -g
@@ -34,17 +35,13 @@
LIBS += -lkernel32
endif
-CXXFLAGS += -std=c++98 `sdl2-config --cflags` `pkg-config freetype2 --cflags` -MMD -MP -MF [email protected]
-LIBS += `pkg-config freetype2 --libs`
+CXXFLAGS += -std=c++98 `pkg-config sdl2 --cflags` `pkg-config freetype2 --cflags` -MMD -MP -MF [email protected]
ifeq ($(STATIC), 1)
- CXXFLAGS += `sdl2-config --static-libs` -static
- LIBS += -lharfbuzz -lfreetype -lbz2 -lpng -lz -lgraphite2
- ifeq ($(WINDOWS), 1)
- LIBS += -lRpcrt4 -lDwrite -lusp10
- endif
+ LDFLAGS += -static
+ LIBS += `pkg-config sdl2 --libs --static` `pkg-config freetype2 --libs --static` -lfreetype
else
- CXXFLAGS += `sdl2-config --libs`
+ LIBS += `pkg-config sdl2 --libs` `pkg-config freetype2 --libs`
endif
# For an accurate result to the original's code, compile in alphabetical order
@@ -206,7 +203,8 @@
build/$(FILENAME): $(OBJECTS)
@mkdir -p $(@D)
- @$(CXX) $(CXXFLAGS) $^ -o $@ $(LIBS)
+ @echo Linking
+ @$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
@echo Finished compiling: $@
obj/$(FILENAME)/%.o: src/%.cpp