mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: remove endian_check in favour of __BYTE_ORDER macro (Rubidium) (#6762)
This commit is contained in:
parent
aef69443e7
commit
0165fe1283
|
@ -6,7 +6,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/>.
|
# 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/>.
|
||||||
|
|
||||||
STRGEN = !!STRGEN!!
|
STRGEN = !!STRGEN!!
|
||||||
ENDIAN_CHECK = !!ENDIAN_CHECK!!
|
|
||||||
SRC_DIR = !!SRC_DIR!!
|
SRC_DIR = !!SRC_DIR!!
|
||||||
LANG_DIR = !!LANG_DIR!!
|
LANG_DIR = !!LANG_DIR!!
|
||||||
BIN_DIR = !!BIN_DIR!!
|
BIN_DIR = !!BIN_DIR!!
|
||||||
|
@ -25,11 +24,6 @@ ifeq ($(LANG_SUPPRESS), yes)
|
||||||
LANG_ERRORS = >/dev/null 2>&1
|
LANG_ERRORS = >/dev/null 2>&1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Make sure endian_host.h is reachable as if it was in the src/ dir
|
|
||||||
CFLAGS_BUILD += -I $(LANG_OBJS_DIR)
|
|
||||||
|
|
||||||
ENDIAN_TARGETS := endian_host.h endian_target.h $(ENDIAN_CHECK)
|
|
||||||
|
|
||||||
# Check if we want to show what we are doing
|
# Check if we want to show what we are doing
|
||||||
ifdef VERBOSE
|
ifdef VERBOSE
|
||||||
Q =
|
Q =
|
||||||
|
@ -43,19 +37,19 @@ RES := $(shell mkdir -p $(BIN_DIR)/lang )
|
||||||
|
|
||||||
all: table/strings.h $(LANGS)
|
all: table/strings.h $(LANGS)
|
||||||
|
|
||||||
strgen_base.o: $(SRC_DIR)/strgen/strgen_base.cpp $(SRC_DIR)/strgen/strgen.h endian_host.h $(SRC_DIR)/table/control_codes.h $(SRC_DIR)/table/strgen_tables.h $(SRC_DIR)/safeguards.h
|
strgen_base.o: $(SRC_DIR)/strgen/strgen_base.cpp $(SRC_DIR)/strgen/strgen.h $(SRC_DIR)/table/control_codes.h $(SRC_DIR)/table/strgen_tables.h $(SRC_DIR)/safeguards.h
|
||||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSTRGEN -c -o $@ $<
|
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSTRGEN -c -o $@ $<
|
||||||
|
|
||||||
strgen.o: $(SRC_DIR)/strgen/strgen.cpp $(SRC_DIR)/strgen/strgen.h endian_host.h $(SRC_DIR)/table/control_codes.h $(SRC_DIR)/table/strgen_tables.h $(SRC_DIR)/safeguards.h
|
strgen.o: $(SRC_DIR)/strgen/strgen.cpp $(SRC_DIR)/strgen/strgen.h $(SRC_DIR)/table/control_codes.h $(SRC_DIR)/table/strgen_tables.h $(SRC_DIR)/safeguards.h
|
||||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSTRGEN -c -o $@ $<
|
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSTRGEN -c -o $@ $<
|
||||||
|
|
||||||
string.o: $(SRC_DIR)/string.cpp endian_host.h $(SRC_DIR)/safeguards.h
|
string.o: $(SRC_DIR)/string.cpp $(SRC_DIR)/safeguards.h
|
||||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSTRGEN -c -o $@ $<
|
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSTRGEN -c -o $@ $<
|
||||||
|
|
||||||
alloc_func.o: $(SRC_DIR)/core/alloc_func.cpp endian_host.h $(SRC_DIR)/safeguards.h
|
alloc_func.o: $(SRC_DIR)/core/alloc_func.cpp $(SRC_DIR)/safeguards.h
|
||||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSTRGEN -c -o $@ $<
|
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSTRGEN -c -o $@ $<
|
||||||
|
|
||||||
|
@ -80,21 +74,11 @@ $(LANGS): %.lng: $(LANG_DIR)/%.txt $(STRGEN) lang/english.txt
|
||||||
$(E) '$(STAGE) Compiling language $(*F)'
|
$(E) '$(STAGE) Compiling language $(*F)'
|
||||||
$(Q)./$(STRGEN) $(STRGEN_FLAGS) -s $(LANG_DIR) -d $(LANG_OBJS_DIR) $< $(LANG_ERRORS) && cp $@ $(BIN_DIR)/lang || true # Do not fail all languages when one fails
|
$(Q)./$(STRGEN) $(STRGEN_FLAGS) -s $(LANG_DIR) -d $(LANG_OBJS_DIR) $< $(LANG_ERRORS) && cp $@ $(BIN_DIR)/lang || true # Do not fail all languages when one fails
|
||||||
|
|
||||||
# The targets to compile the endian-code
|
|
||||||
|
|
||||||
endian_host.h: $(ENDIAN_CHECK)
|
|
||||||
$(E) '$(STAGE) Testing endianness for host'
|
|
||||||
$(Q)./$(ENDIAN_CHECK) > $@
|
|
||||||
|
|
||||||
$(ENDIAN_CHECK): $(SRC_DIR)/endian_check.cpp
|
|
||||||
$(E) '$(STAGE) Compiling and Linking $@'
|
|
||||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) $(LDFLAGS_BUILD) $< -o $@
|
|
||||||
|
|
||||||
depend:
|
depend:
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(E) '$(STAGE) Cleaning up language files'
|
$(E) '$(STAGE) Cleaning up language files'
|
||||||
$(Q)rm -f strgen.o string.o alloc_func.o getoptdata.o table/strings.h $(STRGEN) $(LANGS) $(LANGS:%=$(BIN_DIR)/lang/%) lang/english.* $(ENDIAN_TARGETS)
|
$(Q)rm -f strgen.o string.o alloc_func.o getoptdata.o table/strings.h $(STRGEN) $(LANGS) $(LANGS:%=$(BIN_DIR)/lang/%) lang/english.*
|
||||||
|
|
||||||
mrproper: clean
|
mrproper: clean
|
||||||
$(Q)rm -rf $(BIN_DIR)/lang
|
$(Q)rm -rf $(BIN_DIR)/lang
|
||||||
|
|
|
@ -6,7 +6,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/>.
|
# 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/>.
|
||||||
|
|
||||||
SETTINGSGEN = !!SETTINGSGEN!!
|
SETTINGSGEN = !!SETTINGSGEN!!
|
||||||
ENDIAN_CHECK = !!ENDIAN_CHECK!!
|
|
||||||
SRC_DIR = !!SRC_DIR!!
|
SRC_DIR = !!SRC_DIR!!
|
||||||
CXX_BUILD = !!CXX_BUILD!!
|
CXX_BUILD = !!CXX_BUILD!!
|
||||||
CFLAGS_BUILD = !!CFLAGS_BUILD!!
|
CFLAGS_BUILD = !!CFLAGS_BUILD!!
|
||||||
|
@ -15,8 +14,6 @@ LDFLAGS_BUILD = !!LDFLAGS_BUILD!!
|
||||||
STAGE = !!STAGE!!
|
STAGE = !!STAGE!!
|
||||||
SETTING_OBJS_DIR = !!SETTING_OBJS_DIR!!
|
SETTING_OBJS_DIR = !!SETTING_OBJS_DIR!!
|
||||||
|
|
||||||
ENDIAN_TARGETS := endian_host.h endian_target.h $(ENDIAN_CHECK)
|
|
||||||
|
|
||||||
# Check if we want to show what we are doing
|
# Check if we want to show what we are doing
|
||||||
ifdef VERBOSE
|
ifdef VERBOSE
|
||||||
Q =
|
Q =
|
||||||
|
@ -32,7 +29,7 @@ settingsgen.o: $(SRC_DIR)/settingsgen/settingsgen.cpp $(SRC_DIR)/string_func.h $
|
||||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
|
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
|
||||||
|
|
||||||
alloc_func.o: $(SRC_DIR)/core/alloc_func.cpp endian_host.h $(SRC_DIR)/safeguards.h
|
alloc_func.o: $(SRC_DIR)/core/alloc_func.cpp $(SRC_DIR)/safeguards.h
|
||||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
|
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
|
||||||
|
|
||||||
|
@ -40,7 +37,7 @@ getoptdata.o: $(SRC_DIR)/misc/getoptdata.cpp $(SRC_DIR)/misc/getoptdata.h $(SRC_
|
||||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/misc/%.cpp=%.cpp)'
|
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/misc/%.cpp=%.cpp)'
|
||||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
|
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
|
||||||
|
|
||||||
string.o: $(SRC_DIR)/string.cpp endian_host.h $(SRC_DIR)/safeguards.h
|
string.o: $(SRC_DIR)/string.cpp $(SRC_DIR)/safeguards.h
|
||||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
|
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
|
||||||
|
|
||||||
|
@ -57,21 +54,11 @@ table/settings.h: $(SETTINGSGEN) $(SRC_DIR)/table/settings.h.preamble $(SRC_DIR)
|
||||||
@mkdir -p table
|
@mkdir -p table
|
||||||
$(Q)./$(SETTINGSGEN) -o table/settings.h -b $(SRC_DIR)/table/settings.h.preamble -a $(SRC_DIR)/table/settings.h.postamble $(SRC_DIR)/table/*.ini
|
$(Q)./$(SETTINGSGEN) -o table/settings.h -b $(SRC_DIR)/table/settings.h.preamble -a $(SRC_DIR)/table/settings.h.postamble $(SRC_DIR)/table/*.ini
|
||||||
|
|
||||||
# The targets to compile the endian-code
|
|
||||||
|
|
||||||
endian_host.h: $(ENDIAN_CHECK)
|
|
||||||
$(E) '$(STAGE) Testing endianness for host'
|
|
||||||
$(Q)./$(ENDIAN_CHECK) > $@
|
|
||||||
|
|
||||||
$(ENDIAN_CHECK): $(SRC_DIR)/endian_check.cpp
|
|
||||||
$(E) '$(STAGE) Compiling and Linking $@'
|
|
||||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) $(LDFLAGS_BUILD) $< -o $@
|
|
||||||
|
|
||||||
depend:
|
depend:
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(E) '$(STAGE) Cleaning up settings files'
|
$(E) '$(STAGE) Cleaning up settings files'
|
||||||
$(Q)rm -f settingsgen.o alloc_func.o getoptdata.o ini_load.o $(SETTINGSGEN) $(ENDIAN_TARGETS) table/settings.h
|
$(Q)rm -f settingsgen.o alloc_func.o getoptdata.o ini_load.o $(SETTINGSGEN) table/settings.h
|
||||||
|
|
||||||
mrproper: clean
|
mrproper: clean
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,7 @@ SCRIPT_SRC_DIR = !!SCRIPT_SRC_DIR!!
|
||||||
MEDIA_DIR = !!MEDIA_DIR!!
|
MEDIA_DIR = !!MEDIA_DIR!!
|
||||||
TTD = !!TTD!!
|
TTD = !!TTD!!
|
||||||
STRGEN = !!STRGEN!!
|
STRGEN = !!STRGEN!!
|
||||||
ENDIAN_CHECK = !!ENDIAN_CHECK!!
|
|
||||||
DEPEND = !!DEPEND!!
|
DEPEND = !!DEPEND!!
|
||||||
ENDIAN_FORCE = !!ENDIAN_FORCE!!
|
|
||||||
OS = !!OS!!
|
OS = !!OS!!
|
||||||
STAGE = !!STAGE!!
|
STAGE = !!STAGE!!
|
||||||
MAKEDEPEND = !!MAKEDEPEND!!
|
MAKEDEPEND = !!MAKEDEPEND!!
|
||||||
|
@ -40,7 +38,6 @@ SORT = !!SORT!!
|
||||||
AWK = !!AWK!!
|
AWK = !!AWK!!
|
||||||
CONFIG_CACHE_COMPILER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_COMPILER!!
|
CONFIG_CACHE_COMPILER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_COMPILER!!
|
||||||
CONFIG_CACHE_LINKER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_LINKER!!
|
CONFIG_CACHE_LINKER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_LINKER!!
|
||||||
CONFIG_CACHE_ENDIAN = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_ENDIAN!!
|
|
||||||
CONFIG_CACHE_SOURCE = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_SOURCE!!
|
CONFIG_CACHE_SOURCE = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_SOURCE!!
|
||||||
CONFIG_CACHE_VERSION = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_VERSION!!
|
CONFIG_CACHE_VERSION = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_VERSION!!
|
||||||
|
|
||||||
|
@ -52,19 +49,16 @@ OBJS := $(OBJS_C) $(OBJS_CPP) $(OBJS_MM) $(OBJS_RC)
|
||||||
SRCS := !!SRCS!!
|
SRCS := !!SRCS!!
|
||||||
|
|
||||||
# All C-files depend on those 3 files
|
# All C-files depend on those 3 files
|
||||||
FILE_DEP := $(CONFIG_CACHE_COMPILER) endian_target.h
|
FILE_DEP := $(CONFIG_CACHE_COMPILER)
|
||||||
# Create all dirs and subdirs
|
# Create all dirs and subdirs
|
||||||
RES := $(shell mkdir -p $(BIN_DIR) $(sort $(dir $(OBJS))))
|
RES := $(shell mkdir -p $(BIN_DIR) $(sort $(dir $(OBJS))))
|
||||||
|
|
||||||
# Make sure endian_target.h is reasable as if it was in the src/ dir
|
|
||||||
CFLAGS += -I $(SRC_OBJS_DIR) -I $(LANG_OBJS_DIR) -I $(SETTING_OBJS_DIR)
|
CFLAGS += -I $(SRC_OBJS_DIR) -I $(LANG_OBJS_DIR) -I $(SETTING_OBJS_DIR)
|
||||||
CFLAGS_MAKEDEP += -I $(SRC_OBJS_DIR) -I $(LANG_OBJS_DIR) -I $(SETTING_OBJS_DIR)
|
CFLAGS_MAKEDEP += -I $(SRC_OBJS_DIR) -I $(LANG_OBJS_DIR) -I $(SETTING_OBJS_DIR)
|
||||||
ifdef SCRIPT_SRC_DIR
|
ifdef SCRIPT_SRC_DIR
|
||||||
CFLAGS_MAKEDEP += -I $(SCRIPT_SRC_DIR)
|
CFLAGS_MAKEDEP += -I $(SCRIPT_SRC_DIR)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ENDIAN_TARGETS := endian_target.h $(ENDIAN_CHECK)
|
|
||||||
|
|
||||||
# Check if we want to show what we are doing
|
# Check if we want to show what we are doing
|
||||||
ifdef VERBOSE
|
ifdef VERBOSE
|
||||||
Q =
|
Q =
|
||||||
|
@ -108,7 +102,6 @@ endif
|
||||||
# This helps to recompile if flags change
|
# This helps to recompile if flags change
|
||||||
RES := $(shell if [ "`cat $(CONFIG_CACHE_COMPILER) 2>/dev/null`" != "$(CFLAGS) $(CXXFLAGS)" ]; then echo "$(CFLAGS) $(CXXFLAGS)" > $(CONFIG_CACHE_COMPILER); fi )
|
RES := $(shell if [ "`cat $(CONFIG_CACHE_COMPILER) 2>/dev/null`" != "$(CFLAGS) $(CXXFLAGS)" ]; then echo "$(CFLAGS) $(CXXFLAGS)" > $(CONFIG_CACHE_COMPILER); fi )
|
||||||
RES := $(shell if [ "`cat $(CONFIG_CACHE_LINKER) 2>/dev/null`" != "$(LDFLAGS) $(LIBS)" ]; then echo "$(LDFLAGS) $(LIBS)" > $(CONFIG_CACHE_LINKER); fi )
|
RES := $(shell if [ "`cat $(CONFIG_CACHE_LINKER) 2>/dev/null`" != "$(LDFLAGS) $(LIBS)" ]; then echo "$(LDFLAGS) $(LIBS)" > $(CONFIG_CACHE_LINKER); fi )
|
||||||
RES := $(shell if [ "`cat $(CONFIG_CACHE_ENDIAN) 2>/dev/null`" != "$(ENDIAN_FORCE)" ]; then echo "$(ENDIAN_FORCE)" > $(CONFIG_CACHE_ENDIAN); fi )
|
|
||||||
|
|
||||||
# If there is a change in the source-file-list, make sure we recheck the deps
|
# If there is a change in the source-file-list, make sure we recheck the deps
|
||||||
RES := $(shell if [ "`cat $(CONFIG_CACHE_SOURCE) 2>/dev/null`" != "$(SRCS)" ]; then echo "$(SRCS)" > $(CONFIG_CACHE_SOURCE); fi )
|
RES := $(shell if [ "`cat $(CONFIG_CACHE_SOURCE) 2>/dev/null`" != "$(SRCS)" ]; then echo "$(SRCS)" > $(CONFIG_CACHE_SOURCE); fi )
|
||||||
|
@ -121,7 +114,7 @@ DEP_MASK := %.d
|
||||||
DEPS := $(OBJS:%.o=%.d)
|
DEPS := $(OBJS:%.o=%.d)
|
||||||
|
|
||||||
# Only include the deps if we are compiling everything
|
# Only include the deps if we are compiling everything
|
||||||
ifeq ($(filter $(ENDIAN_TARGETS) %.o clean mrproper, $(MAKECMDGOALS)),)
|
ifeq ($(filter %.o clean mrproper, $(MAKECMDGOALS)),)
|
||||||
-include $(DEPS)
|
-include $(DEPS)
|
||||||
else
|
else
|
||||||
# In case we want to compile a single target, include the .d file for it
|
# In case we want to compile a single target, include the .d file for it
|
||||||
|
@ -155,7 +148,7 @@ DEP_MASK :=
|
||||||
DEPS := Makefile.dep
|
DEPS := Makefile.dep
|
||||||
|
|
||||||
# Only include the deps if we are not cleaning
|
# Only include the deps if we are not cleaning
|
||||||
ifeq ($(filter $(ENDIAN_TARGETS) depend clean mrproper, $(MAKECMDGOALS)),)
|
ifeq ($(filter depend clean mrproper, $(MAKECMDGOALS)),)
|
||||||
-include Makefile.dep
|
-include Makefile.dep
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -273,16 +266,6 @@ ifeq ($(OS), DOS)
|
||||||
$(Q)$(ROOT_DIR)/os/dos/make_dos_binary_selfcontained.sh $(SRC_OBJS_DIR)/$@
|
$(Q)$(ROOT_DIR)/os/dos/make_dos_binary_selfcontained.sh $(SRC_OBJS_DIR)/$@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# The targets to compile the endian-code
|
|
||||||
|
|
||||||
endian_target.h: $(ENDIAN_CHECK) $(CONFIG_CACHE_ENDIAN)
|
|
||||||
$(E) '$(STAGE) Testing endianness for target'
|
|
||||||
$(Q)./$(ENDIAN_CHECK) $(ENDIAN_FORCE) > $@
|
|
||||||
|
|
||||||
$(ENDIAN_CHECK): $(SRC_DIR)/endian_check.cpp
|
|
||||||
$(E) '$(STAGE) Compiling and Linking $@'
|
|
||||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) $(LDFLAGS_BUILD) $< -o $@
|
|
||||||
|
|
||||||
# Revision files
|
# Revision files
|
||||||
|
|
||||||
$(SRC_DIR)/rev.cpp: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/rev.cpp.in
|
$(SRC_DIR)/rev.cpp: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/rev.cpp.in
|
||||||
|
@ -297,7 +280,7 @@ depend: $(DEPS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(E) '$(STAGE) Cleaning up object files'
|
$(E) '$(STAGE) Cleaning up object files'
|
||||||
$(Q)rm -f $(DEPS) $(OBJS) $(TTD) $(DEPEND) $(TTD:%=$(BIN_DIR)/%) $(BIN_DIR)/baseset/openttd.32.bmp $(CONFIG_CACHE_COMPILER) $(CONFIG_CACHE_LINKER) $(CONFIG_CACHE_ENDIAN) $(CONFIG_CACHE_SOURCE) $(ENDIAN_TARGETS)
|
$(Q)rm -f $(DEPS) $(OBJS) $(TTD) $(DEPEND) $(TTD:%=$(BIN_DIR)/%) $(BIN_DIR)/baseset/openttd.32.bmp $(CONFIG_CACHE_COMPILER) $(CONFIG_CACHE_LINKER) $(CONFIG_CACHE_SOURCE)
|
||||||
|
|
||||||
mrproper: clean
|
mrproper: clean
|
||||||
$(Q)rm -f $(SRC_DIR)/rev.cpp $(SRC_DIR)/os/windows/ottdres.rc
|
$(Q)rm -f $(SRC_DIR)/rev.cpp $(SRC_DIR)/os/windows/ottdres.rc
|
||||||
|
|
27
config.lib
27
config.lib
|
@ -31,7 +31,6 @@ set_default() {
|
||||||
awk="awk"
|
awk="awk"
|
||||||
pkg_config="pkg-config"
|
pkg_config="pkg-config"
|
||||||
os="DETECT"
|
os="DETECT"
|
||||||
endian="AUTO"
|
|
||||||
cpu_type="DETECT"
|
cpu_type="DETECT"
|
||||||
config_log="config.log"
|
config_log="config.log"
|
||||||
prefix_dir="/usr/local"
|
prefix_dir="/usr/local"
|
||||||
|
@ -108,7 +107,6 @@ set_default() {
|
||||||
awk
|
awk
|
||||||
pkg_config
|
pkg_config
|
||||||
os
|
os
|
||||||
endian
|
|
||||||
cpu_type
|
cpu_type
|
||||||
config_log
|
config_log
|
||||||
prefix_dir
|
prefix_dir
|
||||||
|
@ -222,9 +220,6 @@ detect_params() {
|
||||||
--lipo) prev_p="lipo";;
|
--lipo) prev_p="lipo";;
|
||||||
--lipo=*) lipo="$optarg";;
|
--lipo=*) lipo="$optarg";;
|
||||||
|
|
||||||
--endian) prev_p="endian";;
|
|
||||||
--endian=*) endian="$optarg";;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Alias --prefix with --prefix-dir, for compatibility with GNU autotools
|
# Alias --prefix with --prefix-dir, for compatibility with GNU autotools
|
||||||
|
@ -531,7 +526,6 @@ check_params() {
|
||||||
# Some params want to be in full uppercase, else they might not work as
|
# Some params want to be in full uppercase, else they might not work as
|
||||||
# expected.. fix that here
|
# expected.. fix that here
|
||||||
|
|
||||||
endian=`echo $endian | tr '[a-z]' '[A-Z]'`
|
|
||||||
os=`echo $os | tr '[a-z]' '[A-Z]'`
|
os=`echo $os | tr '[a-z]' '[A-Z]'`
|
||||||
cpu_type=`echo $cpu_type | tr '[a-z]' '[A-Z]'`
|
cpu_type=`echo $cpu_type | tr '[a-z]' '[A-Z]'`
|
||||||
|
|
||||||
|
@ -547,17 +541,6 @@ check_params() {
|
||||||
|
|
||||||
# Check if all params have valid values
|
# Check if all params have valid values
|
||||||
|
|
||||||
# Endian only allows AUTO, LE and, BE
|
|
||||||
if [ -z "`echo $endian | egrep '^(AUTO|LE|BE|PREPROCESSOR)$'`" ]; then
|
|
||||||
log 1 "configure: error: invalid option --endian=$endian"
|
|
||||||
log 1 " Available options are: --endian=[AUTO|LE|BE]"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ "$endian" = "PREPROCESSOR" ] && [ "$os" != "OSX" ]; then
|
|
||||||
log 1 "configure: error: invalid option --endian=$endian"
|
|
||||||
log 1 " PREPROCESSOR is only available for OSX"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
# OS only allows DETECT, UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, MORPHOS, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, and DOS
|
# OS only allows DETECT, UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, MORPHOS, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, and DOS
|
||||||
if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS)$'`" ]; then
|
if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS)$'`" ]; then
|
||||||
log 1 "configure: error: invalid option --os=$os"
|
log 1 "configure: error: invalid option --os=$os"
|
||||||
|
@ -890,12 +873,6 @@ check_params() {
|
||||||
|
|
||||||
detect_sort
|
detect_sort
|
||||||
|
|
||||||
if [ "$os" = "OSX" ] && [ "$endian" = "AUTO" ]; then
|
|
||||||
endian="PREPROCESSOR"
|
|
||||||
fi
|
|
||||||
|
|
||||||
log 1 "checking endianness... $endian"
|
|
||||||
|
|
||||||
# Suppress language errors when there is a version defined, indicating a release
|
# Suppress language errors when there is a version defined, indicating a release
|
||||||
# It just isn't pretty if any release produces warnings in the languages.
|
# It just isn't pretty if any release produces warnings in the languages.
|
||||||
if [ -f "$ROOT_DIR/version" ]; then
|
if [ -f "$ROOT_DIR/version" ]; then
|
||||||
|
@ -3161,17 +3138,14 @@ make_sed() {
|
||||||
s@!!INSTALL_DIR!!@$install_dir@g;
|
s@!!INSTALL_DIR!!@$install_dir@g;
|
||||||
s@!!BINARY_NAME!!@$binary_name@g;
|
s@!!BINARY_NAME!!@$binary_name@g;
|
||||||
s@!!STRGEN!!@$STRGEN@g;
|
s@!!STRGEN!!@$STRGEN@g;
|
||||||
s@!!ENDIAN_CHECK!!@$ENDIAN_CHECK@g;
|
|
||||||
s@!!DEPEND!!@$DEPEND@g;
|
s@!!DEPEND!!@$DEPEND@g;
|
||||||
s@!!SETTINGSGEN!!@$SETTINGSGEN@g;
|
s@!!SETTINGSGEN!!@$SETTINGSGEN@g;
|
||||||
s@!!ENDIAN_FORCE!!@$endian@g;
|
|
||||||
s@!!STAGE!!@$STAGE@g;
|
s@!!STAGE!!@$STAGE@g;
|
||||||
s@!!MAKEDEPEND!!@$makedepend@g;
|
s@!!MAKEDEPEND!!@$makedepend@g;
|
||||||
s@!!CFLAGS_MAKEDEP!!@$cflags_makedep@g;
|
s@!!CFLAGS_MAKEDEP!!@$cflags_makedep@g;
|
||||||
s@!!SORT!!@$sort@g;
|
s@!!SORT!!@$sort@g;
|
||||||
s@!!CONFIG_CACHE_COMPILER!!@config.cache.compiler@g;
|
s@!!CONFIG_CACHE_COMPILER!!@config.cache.compiler@g;
|
||||||
s@!!CONFIG_CACHE_LINKER!!@config.cache.linker@g;
|
s@!!CONFIG_CACHE_LINKER!!@config.cache.linker@g;
|
||||||
s@!!CONFIG_CACHE_ENDIAN!!@config.cache.endian@g;
|
|
||||||
s@!!CONFIG_CACHE_SOURCE!!@config.cache.source@g;
|
s@!!CONFIG_CACHE_SOURCE!!@config.cache.source@g;
|
||||||
s@!!CONFIG_CACHE_VERSION!!@config.cache.version@g;
|
s@!!CONFIG_CACHE_VERSION!!@config.cache.version@g;
|
||||||
s@!!CONFIG_CACHE_SOURCE_LIST!!@config.cache.source.list@g;
|
s@!!CONFIG_CACHE_SOURCE_LIST!!@config.cache.source.list@g;
|
||||||
|
@ -3406,7 +3380,6 @@ showhelp() {
|
||||||
echo " DETECT/UNIX/OSX/FREEBSD/DRAGONFLY/OPENBSD/"
|
echo " DETECT/UNIX/OSX/FREEBSD/DRAGONFLY/OPENBSD/"
|
||||||
echo " NETBSD/MORPHOS/HPUX/BEOS/SUNOS/CYGWIN/"
|
echo " NETBSD/MORPHOS/HPUX/BEOS/SUNOS/CYGWIN/"
|
||||||
echo " MINGW/OS2/DOS/HAIKU"
|
echo " MINGW/OS2/DOS/HAIKU"
|
||||||
echo " --endian=ENDIAN set the endian of the HOST (AUTO/LE/BE)"
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Paths:"
|
echo "Paths:"
|
||||||
echo " --prefix-dir=dir specifies the prefix for all installed"
|
echo " --prefix-dir=dir specifies the prefix for all installed"
|
||||||
|
|
|
@ -81,7 +81,6 @@ fi
|
||||||
|
|
||||||
TTD="openttd$EXE"
|
TTD="openttd$EXE"
|
||||||
STRGEN="strgen$EXE"
|
STRGEN="strgen$EXE"
|
||||||
ENDIAN_CHECK="endian_check$EXE"
|
|
||||||
DEPEND="depend$EXE"
|
DEPEND="depend$EXE"
|
||||||
SETTINGSGEN="settings_gen$EXE"
|
SETTINGSGEN="settings_gen$EXE"
|
||||||
|
|
||||||
|
|
|
@ -29,11 +29,11 @@
|
||||||
#if defined(WIN32) || defined(__OS2__) || defined(WIN64)
|
#if defined(WIN32) || defined(__OS2__) || defined(WIN64)
|
||||||
#define TTD_ENDIAN TTD_LITTLE_ENDIAN
|
#define TTD_ENDIAN TTD_LITTLE_ENDIAN
|
||||||
#elif !defined(TESTING)
|
#elif !defined(TESTING)
|
||||||
/* Else include endian[target/host].h, which has the endian-type, autodetected by the Makefile */
|
#include <sys/param.h>
|
||||||
#if defined(STRGEN) || defined(SETTINGSGEN)
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
#include "endian_host.h"
|
#define TTD_ENDIAN TTD_LITTLE_ENDIAN
|
||||||
#else
|
#else
|
||||||
#include "endian_target.h"
|
#define TTD_ENDIAN TTD_BIG_ENDIAN
|
||||||
#endif
|
#endif
|
||||||
#endif /* WIN32 || __OS2__ || WIN64 */
|
#endif /* WIN32 || __OS2__ || WIN64 */
|
||||||
|
|
||||||
|
|
|
@ -1,78 +0,0 @@
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of OpenTTD.
|
|
||||||
* 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.
|
|
||||||
* 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.
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file endian_check.cpp
|
|
||||||
* This pretty simple file checks if the system is LITTLE_ENDIAN or BIG_ENDIAN
|
|
||||||
* it does that by putting a 1 and a 0 in an array, and read it out as one
|
|
||||||
* number. If it is 1, it is LITTLE_ENDIAN, if it is 256, it is BIG_ENDIAN
|
|
||||||
*
|
|
||||||
* After that it outputs the contents of an include files (endian.h)
|
|
||||||
* that says or TTD_LITTLE_ENDIAN, or TTD_BIG_ENDIAN. Makefile takes
|
|
||||||
* care of the real writing to the file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
/** Supported endian types */
|
|
||||||
enum Endian {
|
|
||||||
ENDIAN_LITTLE, ///< little endian
|
|
||||||
ENDIAN_BIG, ///< big endian
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shortcut to printf("#define TTD_ENDIAN TTD_*_ENDIAN")
|
|
||||||
* @param endian endian type to define
|
|
||||||
*/
|
|
||||||
static inline void printf_endian(Endian endian)
|
|
||||||
{
|
|
||||||
printf("#define TTD_ENDIAN %s\n", endian == ENDIAN_LITTLE ? "TTD_LITTLE_ENDIAN" : "TTD_BIG_ENDIAN");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Main call of the endian_check program
|
|
||||||
* @param argc argument count
|
|
||||||
* @param argv arguments themselves
|
|
||||||
* @return exit code
|
|
||||||
*/
|
|
||||||
int main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
unsigned char endian_test[2] = { 1, 0 };
|
|
||||||
int force_BE = 0, force_LE = 0, force_PREPROCESSOR = 0;
|
|
||||||
|
|
||||||
if (argc > 1 && strcmp(argv[1], "BE") == 0) force_BE = 1;
|
|
||||||
if (argc > 1 && strcmp(argv[1], "LE") == 0) force_LE = 1;
|
|
||||||
if (argc > 1 && strcmp(argv[1], "PREPROCESSOR") == 0) force_PREPROCESSOR = 1;
|
|
||||||
|
|
||||||
printf("#ifndef ENDIAN_H\n#define ENDIAN_H\n");
|
|
||||||
|
|
||||||
if (force_LE == 1) {
|
|
||||||
printf_endian(ENDIAN_LITTLE);
|
|
||||||
} else if (force_BE == 1) {
|
|
||||||
printf_endian(ENDIAN_BIG);
|
|
||||||
} else if (force_PREPROCESSOR == 1) {
|
|
||||||
/* Support for universal binaries on OSX
|
|
||||||
* Universal binaries supports both PPC and x86
|
|
||||||
* If a compiler for OSX gets this setting, it will always pick the correct endian and no test is needed
|
|
||||||
*/
|
|
||||||
printf("#ifdef __BIG_ENDIAN__\n");
|
|
||||||
printf_endian(ENDIAN_BIG);
|
|
||||||
printf("#else\n");
|
|
||||||
printf_endian(ENDIAN_LITTLE);
|
|
||||||
printf("#endif\n");
|
|
||||||
} else if (*(short*)endian_test == 1 ) {
|
|
||||||
printf_endian(ENDIAN_LITTLE);
|
|
||||||
} else {
|
|
||||||
printf_endian(ENDIAN_BIG);
|
|
||||||
}
|
|
||||||
printf("#endif\n");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
Reference in New Issue