Added Makefile dependency generation, and did some cleanup
This commit is contained in:
parent
1546e6ed4e
commit
a5860afeb9
1 changed files with 16 additions and 11 deletions
27
Makefile
27
Makefile
|
@ -1,13 +1,14 @@
|
||||||
ifeq ($(RELEASE), 1)
|
ifeq ($(RELEASE), 1)
|
||||||
CXXFLAGS := -O3 -s
|
CXXFLAGS = -O3 -s
|
||||||
FILENAME_DEF = release
|
FILENAME_DEF = release
|
||||||
else
|
else
|
||||||
CXXFLAGS := -O0 -g
|
CXXFLAGS = -O0 -g
|
||||||
FILENAME_DEF = debug
|
FILENAME_DEF = debug
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(JAPANESE), 1)
|
ifeq ($(JAPANESE), 1)
|
||||||
CXXFLAGS += -DJAPANESE
|
CXXFLAGS += -DJAPANESE
|
||||||
|
|
||||||
ifeq ($(RELEASE), 1)
|
ifeq ($(RELEASE), 1)
|
||||||
FILENAME_DEF = releasejp
|
FILENAME_DEF = releasejp
|
||||||
else
|
else
|
||||||
|
@ -28,16 +29,17 @@ ifeq ($(WINDOWS), 1)
|
||||||
ifeq ($(JAPANESE), 1)
|
ifeq ($(JAPANESE), 1)
|
||||||
LIBS += -liconv
|
LIBS += -liconv
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CXXFLAGS += -DWINDOWS
|
CXXFLAGS += -DWINDOWS
|
||||||
LIBS += -lkernel32
|
LIBS += -lkernel32
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CXXFLAGS += `sdl2-config --cflags` `pkg-config freetype2 --cflags`
|
CXXFLAGS += `sdl2-config --cflags` `pkg-config freetype2 --cflags` -MMD -MP -MF $@.d
|
||||||
LIBS += `sdl2-config --static-libs` `pkg-config freetype2 --libs`
|
LIBS += `sdl2-config --static-libs` `pkg-config freetype2 --libs`
|
||||||
|
|
||||||
ifeq ($(STATIC), 1)
|
ifeq ($(STATIC), 1)
|
||||||
CXXFLAGS += -static
|
CXXFLAGS += -static
|
||||||
LIBS += -lharfbuzz -lfreetype -lbz2 -lpng -lz -lgraphite2 -lRpcrt4 -lDwrite -lusp10
|
LIBS += -lharfbuzz -lfreetype -lbz2 -lpng -lz -lgraphite2 -lRpcrt4 -lDwrite -lusp10
|
||||||
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
|
||||||
|
@ -188,27 +190,28 @@ ifneq ($(WINDOWS), 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
OBJECTS = $(addprefix obj/$(FILENAME)/, $(addsuffix .o, $(SOURCES)))
|
OBJECTS = $(addprefix obj/$(FILENAME)/, $(addsuffix .o, $(SOURCES)))
|
||||||
|
DEPENDENCIES = $(addprefix obj/$(FILENAME)/, $(addsuffix .o.d, $(SOURCES)))
|
||||||
|
|
||||||
ifeq ($(WINDOWS), 1)
|
ifeq ($(WINDOWS), 1)
|
||||||
OBJECTS += obj/$(FILENAME)/win_icon.o
|
OBJECTS += obj/$(FILENAME)/win_icon.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: build/$(FILENAME)
|
all: build/$(FILENAME)
|
||||||
|
|
||||||
build/$(FILENAME): $(OBJECTS)
|
build/$(FILENAME): $(OBJECTS)
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@g++ $(CXXFLAGS) $^ -o $@ $(LIBS)
|
@$(CXX) $(CXXFLAGS) $^ -o $@ $(LIBS)
|
||||||
@echo Finished compiling: $@
|
@echo Finished compiling: $@
|
||||||
|
|
||||||
obj/$(FILENAME)/%.o: src/%.cpp
|
obj/$(FILENAME)/%.o: src/%.cpp
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@echo Compiling $^
|
@echo Compiling $<
|
||||||
@g++ $(CXXFLAGS) $^ -o $@ -c
|
@$(CXX) $(CXXFLAGS) $< -o $@ -c
|
||||||
|
|
||||||
obj/$(FILENAME)/Resource.o: src/Resource.cpp $(addprefix src/Resource/, $(addsuffix .h, $(RESOURCES)))
|
obj/$(FILENAME)/Resource.o: src/Resource.cpp $(addprefix src/Resource/, $(addsuffix .h, $(RESOURCES)))
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@echo Compiling $<
|
@echo Compiling $<
|
||||||
@g++ $(CXXFLAGS) $< -o $@ -c
|
@$(CXX) $(CXXFLAGS) $< -o $@ -c
|
||||||
|
|
||||||
src/Resource/%.h: res/% obj/bin2h
|
src/Resource/%.h: res/% obj/bin2h
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
|
@ -218,7 +221,9 @@ src/Resource/%.h: res/% obj/bin2h
|
||||||
obj/bin2h: res/bin2h.c
|
obj/bin2h: res/bin2h.c
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@echo Compiling $^
|
@echo Compiling $^
|
||||||
@gcc -O3 -s -static $^ -o $@
|
@$(CC) -O3 -s -static $^ -o $@
|
||||||
|
|
||||||
|
include $(wildcard $(DEPENDENCIES))
|
||||||
|
|
||||||
obj/$(FILENAME)/win_icon.o: res/ICON/ICON.rc res/ICON/0.ico res/ICON/ICON_MINI.ico
|
obj/$(FILENAME)/win_icon.o: res/ICON/ICON.rc res/ICON/0.ico res/ICON/ICON_MINI.ico
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
|
|
Loading…
Add table
Reference in a new issue