mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r22177) -Fix: make sure the right endianness is chosen with cross-compiling, and strndup is available in the binary for more exotic platforms
This commit is contained in:
parent
25c7bdde66
commit
59e42ea178
|
@ -39,11 +39,15 @@ getoptdata.o: $(SRC_DIR)/misc/getoptdata.cpp $(SRC_DIR)/misc/getoptdata.h
|
||||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/misc/%.cpp=%.cpp)'
|
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/misc/%.cpp=%.cpp)'
|
||||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
|
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
|
||||||
|
|
||||||
|
string.o: $(SRC_DIR)/string.cpp endian_host.h
|
||||||
|
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||||
|
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
|
||||||
|
|
||||||
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
|
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
|
||||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/misc/%.cpp=%.cpp)'
|
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/misc/%.cpp=%.cpp)'
|
||||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
|
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
|
||||||
|
|
||||||
$(SETTINGSGEN): alloc_func.o ini_load.o settingsgen.o getoptdata.o
|
$(SETTINGSGEN): alloc_func.o ini_load.o settingsgen.o getoptdata.o string.o
|
||||||
$(E) '$(STAGE) Compiling and Linking $@'
|
$(E) '$(STAGE) Compiling and Linking $@'
|
||||||
$(Q)$(CXX_BUILD) $(LDFLAGS_BUILD) $^ -o $@
|
$(Q)$(CXX_BUILD) $(LDFLAGS_BUILD) $^ -o $@
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#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 */
|
/* Else include endian[target/host].h, which has the endian-type, autodetected by the Makefile */
|
||||||
#if defined(STRGEN)
|
#if defined(STRGEN) || defined(SETTINGSGEN)
|
||||||
#include "endian_host.h"
|
#include "endian_host.h"
|
||||||
#else
|
#else
|
||||||
#include "endian_target.h"
|
#include "endian_target.h"
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check for mismatching 'architectures' */
|
/* Check for mismatching 'architectures' */
|
||||||
#if !defined(STRGEN) && ((__LP64__ && !defined(_SQ64)) || (!__LP64__ && defined(_SQ64)))
|
#if !defined(STRGEN) && !defined(SETTINGSGEN) && ((__LP64__ && !defined(_SQ64)) || (!__LP64__ && defined(_SQ64)))
|
||||||
# error "Compiling 64 bits without _SQ64 set! (or vice versa)"
|
# error "Compiling 64 bits without _SQ64 set! (or vice versa)"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -151,11 +151,11 @@ char *strecpy(char *dst, const char *src, const char *last)
|
||||||
*dst = '\0';
|
*dst = '\0';
|
||||||
|
|
||||||
if (dst == last && *src != '\0') {
|
if (dst == last && *src != '\0') {
|
||||||
#ifdef STRGEN
|
#if defined(STRGEN) || defined(SETTINGSGEN)
|
||||||
error("String too long for destination buffer");
|
error("String too long for destination buffer");
|
||||||
#else /* STRGEN */
|
#else /* STRGEN || SETTINGSGEN */
|
||||||
DEBUG(misc, 0, "String too long for destination buffer");
|
DEBUG(misc, 0, "String too long for destination buffer");
|
||||||
#endif /* STRGEN */
|
#endif /* STRGEN || SETTINGSGEN */
|
||||||
}
|
}
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue