Makefile improvements
* No longer produces .exe files on Linux * Made static linking optional (useful for Linux) * Minor cleanup
This commit is contained in:
parent
a6f65f66a6
commit
8f8c481b2d
1 changed files with 20 additions and 16 deletions
36
Makefile
36
Makefile
|
@ -1,19 +1,18 @@
|
||||||
RELEASE = 0
|
ifeq ($(RELEASE), 1)
|
||||||
|
CXXFLAGS := -O3 -s
|
||||||
ifeq ($(RELEASE), 0)
|
|
||||||
CXXFLAGS := -O0 -g -static -mconsole
|
|
||||||
FILENAME := debug
|
|
||||||
else
|
|
||||||
CXXFLAGS := -O3 -s -static
|
|
||||||
FILENAME := release
|
FILENAME := release
|
||||||
|
else
|
||||||
|
CXXFLAGS := -O0 -g -mconsole
|
||||||
|
FILENAME := debug
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(JAPANESE), 1)
|
ifeq ($(JAPANESE), 1)
|
||||||
CXXFLAGS += -DJAPANESE
|
CXXFLAGS += -DJAPANESE
|
||||||
ifeq ($(RELEASE), 0)
|
LIBS += -liconv
|
||||||
FILENAME := debugjp
|
ifeq ($(RELEASE), 1)
|
||||||
else
|
|
||||||
FILENAME := releasejp
|
FILENAME := releasejp
|
||||||
|
else
|
||||||
|
FILENAME := debugjp
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -22,7 +21,12 @@ CXXFLAGS += -DFIX_BUGS
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CXXFLAGS += `sdl2-config --cflags` `pkg-config freetype2 --cflags`
|
CXXFLAGS += `sdl2-config --cflags` `pkg-config freetype2 --cflags`
|
||||||
LIBS += `sdl2-config --static-libs` -lfreetype -lharfbuzz -lfreetype -lbz2 -lpng -lz -lgraphite2 -lRpcrt4 -lDwrite -lusp10 -liconv
|
LIBS += `sdl2-config --static-libs` `pkg-config freetype2 --libs`
|
||||||
|
|
||||||
|
ifeq ($(STATIC), 1)
|
||||||
|
CXXFLAGS += -static
|
||||||
|
LIBS += -lharfbuzz -lfreetype -lbz2 -lpng -lz -lgraphite2 -lRpcrt4 -lDwrite -lusp10
|
||||||
|
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
|
||||||
SOURCES = \
|
SOURCES = \
|
||||||
|
@ -130,9 +134,9 @@ endif
|
||||||
|
|
||||||
OBJECTS = $(addprefix obj/$(FILENAME)/, $(addsuffix .o, $(SOURCES)))
|
OBJECTS = $(addprefix obj/$(FILENAME)/, $(addsuffix .o, $(SOURCES)))
|
||||||
|
|
||||||
all: build/$(FILENAME).exe
|
all: build/$(FILENAME)
|
||||||
|
|
||||||
build/$(FILENAME).exe: $(OBJECTS)
|
build/$(FILENAME): $(OBJECTS)
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@g++ $(CXXFLAGS) $^ -o $@ $(LIBS)
|
@g++ $(CXXFLAGS) $^ -o $@ $(LIBS)
|
||||||
@echo Finished compiling: $@
|
@echo Finished compiling: $@
|
||||||
|
@ -147,12 +151,12 @@ obj/$(FILENAME)/Resource.o: src/Resource.cpp $(addprefix src/Resource/, $(addsuf
|
||||||
@echo Compiling $<
|
@echo Compiling $<
|
||||||
@g++ $(CXXFLAGS) $< -o $@ -c
|
@g++ $(CXXFLAGS) $< -o $@ -c
|
||||||
|
|
||||||
src/Resource/%.h: res/% obj/bin2h.exe
|
src/Resource/%.h: res/% obj/bin2h
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@echo Converting $<
|
@echo Converting $<
|
||||||
@obj/bin2h.exe $< $@
|
@obj/bin2h $< $@
|
||||||
|
|
||||||
obj/bin2h.exe: res/bin2h.c
|
obj/bin2h: res/bin2h.c
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@echo Compiling $^
|
@echo Compiling $^
|
||||||
@gcc -O3 -s -static $^ -o $@
|
@gcc -O3 -s -static $^ -o $@
|
||||||
|
|
Loading…
Add table
Reference in a new issue