3 # This file is part of OpenTTD.
4 # OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
5 # OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
6 # See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 SETTINGSGEN = !!SETTINGSGEN!!
9 ENDIAN_CHECK = !!ENDIAN_CHECK!!
11 CXX_BUILD = !!CXX_BUILD!!
12 CFLAGS_BUILD = !!CFLAGS_BUILD!!
13 CXXFLAGS_BUILD = !!CXXFLAGS_BUILD!!
14 LDFLAGS_BUILD = !!LDFLAGS_BUILD!!
16 SETTING_OBJS_DIR = !!SETTING_OBJS_DIR!!
18 ENDIAN_TARGETS := endian_host.h endian_target.h $(ENDIAN_CHECK)
20 # Check if we want to show what we are doing
31 settingsgen.o: $(SRC_DIR)/settingsgen/settingsgen.cpp $(SRC_DIR)/string_func.h $(SRC_DIR)/strings_type.h $(SRC_DIR)/misc/getoptdata.h $(SRC_DIR)/ini_type.h $(SRC_DIR)/core/smallvec_type.hpp $(SRC_DIR)/safeguards.h
32 $(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
33 $(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
35 alloc_func.o: $(SRC_DIR)/core/alloc_func.cpp endian_host.h $(SRC_DIR)/safeguards.h
36 $(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
37 $(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
39 getoptdata.o: $(SRC_DIR)/misc/getoptdata.cpp $(SRC_DIR)/misc/getoptdata.h $(SRC_DIR)/safeguards.h
40 $(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/misc/%.cpp=%.cpp)'
41 $(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
43 string.o: $(SRC_DIR)/string.cpp endian_host.h $(SRC_DIR)/safeguards.h
44 $(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
45 $(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
47 ini_load.o: $(SRC_DIR)/ini_load.cpp $(SRC_DIR)/core/alloc_func.hpp $(SRC_DIR)/core/mem_func.hpp $(SRC_DIR)/ini_type.h $(SRC_DIR)/string_func.h $(SRC_DIR)/safeguards.h
48 $(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
49 $(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
51 $(SETTINGSGEN): alloc_func.o string.o ini_load.o settingsgen.o getoptdata.o
52 $(E) '$(STAGE) Compiling and Linking $@'
53 $(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) $(LDFLAGS_BUILD) $^ -o $@
55 table/settings.h: $(SETTINGSGEN) $(SRC_DIR)/table/settings.h.preamble $(SRC_DIR)/table/settings.h.postamble $(SRC_DIR)/table/*.ini
56 $(E) '$(STAGE) Generating $@'
58 $(Q)./$(SETTINGSGEN) -o table/settings.h -b $(SRC_DIR)/table/settings.h.preamble -a $(SRC_DIR)/table/settings.h.postamble $(SRC_DIR)/table/*.ini
60 # The targets to compile the endian-code
62 endian_host.h: $(ENDIAN_CHECK)
63 $(E) '$(STAGE) Testing endianness for host'
64 $(Q)./$(ENDIAN_CHECK) > $@
66 $(ENDIAN_CHECK): $(SRC_DIR)/endian_check.cpp
67 $(E) '$(STAGE) Compiling and Linking $@'
68 $(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) $(LDFLAGS_BUILD) $< -o $@
73 $(E) '$(STAGE) Cleaning up settings files'
74 $(Q)rm -f settingsgen.o alloc_func.o getoptdata.o ini_load.o $(SETTINGSGEN) $(ENDIAN_TARGETS) table/settings.h
78 .PHONY: all mrproper depend clean