Makefile fixes and added link-time optimisation
Noticed the mistakes while compiling with Clang on Arch.
This commit is contained in:
parent
53b39cfa72
commit
5a9553cb30
1 changed files with 8 additions and 10 deletions
18
Makefile
18
Makefile
|
@ -1,5 +1,6 @@
|
||||||
ifeq ($(RELEASE), 1)
|
ifeq ($(RELEASE), 1)
|
||||||
CXXFLAGS = -O3 -s
|
CXXFLAGS = -O3 -flto
|
||||||
|
LDFLAGS = -s
|
||||||
FILENAME_DEF = release
|
FILENAME_DEF = release
|
||||||
else
|
else
|
||||||
CXXFLAGS = -O0 -g
|
CXXFLAGS = -O0 -g
|
||||||
|
@ -34,17 +35,13 @@ ifeq ($(WINDOWS), 1)
|
||||||
LIBS += -lkernel32
|
LIBS += -lkernel32
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CXXFLAGS += -std=c++98 `sdl2-config --cflags` `pkg-config freetype2 --cflags` -MMD -MP -MF $@.d
|
CXXFLAGS += -std=c++98 `pkg-config sdl2 --cflags` `pkg-config freetype2 --cflags` -MMD -MP -MF $@.d
|
||||||
LIBS += `pkg-config freetype2 --libs`
|
|
||||||
|
|
||||||
ifeq ($(STATIC), 1)
|
ifeq ($(STATIC), 1)
|
||||||
CXXFLAGS += `sdl2-config --static-libs` -static
|
LDFLAGS += -static
|
||||||
LIBS += -lharfbuzz -lfreetype -lbz2 -lpng -lz -lgraphite2
|
LIBS += `pkg-config sdl2 --libs --static` `pkg-config freetype2 --libs --static` -lfreetype
|
||||||
ifeq ($(WINDOWS), 1)
|
|
||||||
LIBS += -lRpcrt4 -lDwrite -lusp10
|
|
||||||
endif
|
|
||||||
else
|
else
|
||||||
CXXFLAGS += `sdl2-config --libs`
|
LIBS += `pkg-config sdl2 --libs` `pkg-config freetype2 --libs`
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# For an accurate result to the original's code, compile in alphabetical order
|
# For an accurate result to the original's code, compile in alphabetical order
|
||||||
|
@ -206,7 +203,8 @@ all: build/$(FILENAME)
|
||||||
|
|
||||||
build/$(FILENAME): $(OBJECTS)
|
build/$(FILENAME): $(OBJECTS)
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@$(CXX) $(CXXFLAGS) $^ -o $@ $(LIBS)
|
@echo Linking
|
||||||
|
@$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
|
||||||
@echo Finished compiling: $@
|
@echo Finished compiling: $@
|
||||||
|
|
||||||
obj/$(FILENAME)/%.o: src/%.cpp
|
obj/$(FILENAME)/%.o: src/%.cpp
|
||||||
|
|
Loading…
Add table
Reference in a new issue