mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-10 07:11:46 +00:00
Move cross-make-mingw.sh's functionality to the Makefile and remove it
This commit is contained in:
parent
e4151c1d55
commit
b720b60295
5 changed files with 35 additions and 70 deletions
26
Makefile
26
Makefile
|
@ -478,7 +478,7 @@ else # ifeq darwin
|
||||||
ifeq ($(PLATFORM),mingw32)
|
ifeq ($(PLATFORM),mingw32)
|
||||||
|
|
||||||
# Some MinGW installations define CC to cc, but don't actually provide cc,
|
# Some MinGW installations define CC to cc, but don't actually provide cc,
|
||||||
# so explicitly use gcc instead (which is the only option anyway)
|
# so check that CC points to a real binary and use gcc if it doesn't
|
||||||
ifeq ($(call bin_path, $(CC)),)
|
ifeq ($(call bin_path, $(CC)),)
|
||||||
CC=gcc
|
CC=gcc
|
||||||
endif
|
endif
|
||||||
|
@ -487,6 +487,30 @@ ifeq ($(PLATFORM),mingw32)
|
||||||
WINDRES=windres
|
WINDRES=windres
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CROSS_COMPILING),1)
|
||||||
|
# If CC is already set to something generic, we probably want to use
|
||||||
|
# something more specific
|
||||||
|
ifneq ($(findstring $(CC),cc gcc),)
|
||||||
|
CC=
|
||||||
|
endif
|
||||||
|
|
||||||
|
# We need to figure out the correct compiler
|
||||||
|
ifeq ($(CC),)
|
||||||
|
ifeq ($(ARCH),x86_64)
|
||||||
|
MINGW_PREFIXES=amd64-mingw32msvc x86_64-w64-mingw32
|
||||||
|
endif
|
||||||
|
ifeq ($(ARCH),x86)
|
||||||
|
MINGW_PREFIXES=i586-mingw32msvc i686-w64-mingw32
|
||||||
|
endif
|
||||||
|
|
||||||
|
CC=$(strip $(foreach MINGW_PREFIX, $(MINGW_PREFIXES), \
|
||||||
|
$(call bin_path, $(MINGW_PREFIX)-gcc)))
|
||||||
|
|
||||||
|
WINDRES=$(strip $(foreach MINGW_PREFIX, $(MINGW_PREFIXES), \
|
||||||
|
$(call bin_path, $(MINGW_PREFIX)-windres)))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
|
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
|
||||||
-DUSE_ICON
|
-DUSE_ICON
|
||||||
|
|
||||||
|
|
14
README
14
README
|
@ -64,15 +64,11 @@ Installation, for *nix
|
||||||
point releases.
|
point releases.
|
||||||
2. Run 'make copyfiles'.
|
2. Run 'make copyfiles'.
|
||||||
|
|
||||||
It is also possible to cross compile for Windows under *nix using MinGW. A
|
It is also possible to cross compile for Windows under *nix using MinGW. Your
|
||||||
script is available to build a cross compilation environment from
|
distribution may have mingw32 packages available. On debian/Ubuntu, you need to
|
||||||
http://www.libsdl.org/extras/win32/cross/build-cross.sh. The gcc/binutils
|
install 'mingw-w64'. Thereafter cross compiling is simply a case running
|
||||||
version numbers that the script downloads may need to be altered.
|
'PLATFORM=mingw32 ARCH=x86 make' in place of 'make'. ARCH may also be set to
|
||||||
Alternatively, your distribution may have mingw32 packages available. On
|
x86_64.
|
||||||
debian/Ubuntu, these are mingw32, mingw32-runtime and mingw32-binutils. Cross
|
|
||||||
compiling is simply a case of using './cross-make-mingw.sh' in place of 'make',
|
|
||||||
though you may find you need to change the value of the variables in this
|
|
||||||
script to match your environment.
|
|
||||||
|
|
||||||
The following variables may be set, either on the command line or in
|
The following variables may be set, either on the command line or in
|
||||||
Makefile.local:
|
Makefile.local:
|
||||||
|
|
|
@ -4,19 +4,18 @@ failed=0;
|
||||||
|
|
||||||
# check if testing mingw
|
# check if testing mingw
|
||||||
if [ "$CC" = "i686-w64-mingw32-gcc" ]; then
|
if [ "$CC" = "i686-w64-mingw32-gcc" ]; then
|
||||||
MAKE=./cross-make-mingw.sh
|
export PLATFORM=mingw32
|
||||||
haveExternalLibs=0
|
haveExternalLibs=0
|
||||||
else
|
else
|
||||||
MAKE=make
|
|
||||||
haveExternalLibs=1
|
haveExternalLibs=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Default Build
|
# Default Build
|
||||||
($MAKE clean release) || failed=1;
|
(make clean release) || failed=1;
|
||||||
|
|
||||||
# Test additional options
|
# Test additional options
|
||||||
if [ $haveExternalLibs -eq 1 ]; then
|
if [ $haveExternalLibs -eq 1 ]; then
|
||||||
($MAKE clean release USE_CODEC_VORBIS=1 USE_FREETYPE=1) || failed=1;
|
(make clean release USE_CODEC_VORBIS=1 USE_FREETYPE=1) || failed=1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $failed -eq 1 ]; then
|
if [ $failed -eq 1 ]; then
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Note: This works in Linux and cygwin
|
|
||||||
|
|
||||||
if [ "$ARCH" = "x86_64" ];
|
|
||||||
then
|
|
||||||
CMD_PREFIX="amd64-mingw32msvc x86_64-w64-mingw32"
|
|
||||||
else
|
|
||||||
CMD_PREFIX="i586-mingw32msvc i686-w64-mingw32"
|
|
||||||
export ARCH=x86
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$CC" = "cc" ] || [ "$CC" = "gcc" ];
|
|
||||||
then
|
|
||||||
CC=
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "X$CC" = "X" ]; then
|
|
||||||
for check in $CMD_PREFIX; do
|
|
||||||
full_check="${check}-gcc"
|
|
||||||
which "$full_check" > /dev/null 2>&1
|
|
||||||
if [ "$?" = "0" ]; then
|
|
||||||
export CC="$full_check"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "X$WINDRES" = "X" ]; then
|
|
||||||
for check in $CMD_PREFIX; do
|
|
||||||
full_check="${check}-windres"
|
|
||||||
which "$full_check" > /dev/null 2>&1
|
|
||||||
if [ "$?" = "0" ]; then
|
|
||||||
export WINDRES="$full_check"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "X$WINDRES" = "X" -o "X$CC" = "X" ]; then
|
|
||||||
echo "Error: Must define or find WINDRES and CC"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
export PLATFORM=mingw32
|
|
||||||
|
|
||||||
exec make $*
|
|
|
@ -9,17 +9,8 @@ then
|
||||||
export USE_FREETYPE=1
|
export USE_FREETYPE=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$PLATFORM" = "mingw32" ];
|
|
||||||
then
|
|
||||||
MAKE=./cross-make-mingw.sh
|
|
||||||
else
|
|
||||||
MAKE=make
|
|
||||||
fi
|
|
||||||
|
|
||||||
CORES=`awk '/^processor/ { N++} END { print N }' /proc/cpuinfo`
|
CORES=`awk '/^processor/ { N++} END { print N }' /proc/cpuinfo`
|
||||||
|
|
||||||
# Default Build
|
make -j${CORES} clean ${BUILD_TYPE}
|
||||||
($MAKE -j${CORES} clean ${BUILD_TYPE})
|
|
||||||
SUCCESS=$?
|
|
||||||
|
|
||||||
exit ${SUCCESS}
|
exit $?
|
||||||
|
|
Loading…
Reference in a new issue