Makefile.mingw: revise so that it works for both cross- and native-builds

This commit is contained in:
sezero
2018-09-11 23:00:02 +03:00
parent 50de6810a0
commit da8d31c9d5
10 changed files with 313 additions and 36 deletions

View File

@@ -9,6 +9,12 @@
#
# Available options:
#
# CROSS cross-compiler toolchain prefix
# Needed when cross-compiling e.g. on Linux,
# as opposed to compiling on native Windows.
# default = i686-pc-mingw32-
# (Note that a trailing '-' is necessary.)
#
# Environment variables:
# FX_GLIDE_HW build for the given ASIC (sst1, sst96, cvg, h3).
# default = h3

View File

@@ -15,6 +15,12 @@
#
# Available options:
#
# CROSS cross-compiler toolchain prefix
# Needed when cross-compiling e.g. on Linux,
# as opposed to compiling on native Windows.
# default = i686-pc-mingw32-
# (Note that a trailing '-' is necessary.)
#
# Environment variables:
# CPU optimize for the given processor.
# default = -mtune=pentium
@@ -58,16 +64,36 @@ GLIDE_LIBDIR = ../../lib
# tools
###############################################################################
CC = gcc
# default cross-toolchain prefix
DEF_CROSS=i686-pc-mingw32-
#DEF_CROSS=i686-w64-mingw32-
# detect if running under unix by finding 'rm' in $PATH :
ifeq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
WINMODE= 1
UNLINK = del $(subst /,\,$(1))
HOST_CC = $(CC)
else
WINMODE= 0
UNLINK = $(RM) $(1)
ifeq ($(CROSS),)
CROSS=$(DEF_CROSS)
endif
endif
CC = $(CROSS)gcc
AS = nasm
LD = $(CC)
RC = windres
DLLTOOL = dlltool
RC = $(CROSS)windres
DLLTOOL = $(CROSS)dlltool
STRIP = $(CROSS)strip
ifeq ($(WINMODE),1)
HOST_CC = $(CC)
else
#for cross-builds
HOST_CC = gcc
UNLINK = $(RM) $(1)
endif
###############################################################################
# defines
@@ -162,8 +188,12 @@ CFLAGS += -DGL_AMD3D
override USE_X86 = 1
endif
ifeq ($(WINMODE),1)
HOST_CFLAGS=$(CFLAGS)
else
# for cross-builds
HOST_CFLAGS=$(filter-out -mcpu=% -mtune=% -DFX_DLL_ENABLE -march=%,$(CFLAGS))
endif
###############################################################################
# objects
@@ -269,6 +299,12 @@ $(GLIDE_LIBDIR)/fxoem2x.dll:
# $(warning FxOem2x not enabled... Skipping fxoem2x.dll)
endif
strip:
$(STRIP) $(GLIDE_LIBDIR)/$(GLIDE_DLL)
#ifeq ($(FXOEM2X),1)
# $(STRIP) $(GLIDE_LIBDIR)/fxoem2x.dll
#endif
###############################################################################
# rules(2)
###############################################################################

View File

@@ -11,6 +11,12 @@
#
# Available options:
#
# CROSS cross-compiler toolchain prefix
# Needed when cross-compiling e.g. on Linux,
# as opposed to compiling on native Windows.
# default = i686-pc-mingw32-
# (Note that a trailing '-' is necessary.)
#
# Environment variables:
# H4=1 High speed Avenger.
# default = no
@@ -52,16 +58,36 @@ GLIDE_LIBDIR = ../../lib
# tools
###############################################################################
CC = gcc
# default cross-toolchain prefix
DEF_CROSS=i686-pc-mingw32-
#DEF_CROSS=i686-w64-mingw32-
# detect if running under unix by finding 'rm' in $PATH :
ifeq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
WINMODE= 1
UNLINK = del $(subst /,\,$(1))
HOST_CC = $(CC)
else
WINMODE= 0
UNLINK = $(RM) $(1)
ifeq ($(CROSS),)
CROSS=$(DEF_CROSS)
endif
endif
CC = $(CROSS)gcc
AS = nasm
LD = $(CC)
RC = windres
DLLTOOL = dlltool
RC = $(CROSS)windres
DLLTOOL = $(CROSS)dlltool
STRIP = $(CROSS)strip
ifeq ($(WINMODE),1)
HOST_CC = $(CC)
else
#for cross-builds
HOST_CC = gcc
UNLINK = $(RM) $(1)
endif
###############################################################################
# defines
@@ -152,11 +178,15 @@ ifeq ($(USE_X86),1)
CFLAGS += -DGL_X86
endif
ifeq ($(WINMODE),1)
HOST_CFLAGS=$(CFLAGS)
else
# for cross-builds
# note that with this, fxgasm outputs wrong (20 bytes shorter) SIZEOF_GC and SIZEOF_GrState
# values in fxgasm.h - everything else is the same (compared to fxgasm.h generated by MSVC 6).
# those two are not used by the asm sources, so we are good.
HOST_CFLAGS=$(filter-out -mcpu=% -mtune=% -DFX_DLL_ENABLE -DHWC_EXT_INIT=% -march=%,$(CFLAGS))
endif
###############################################################################
# objects
@@ -239,6 +269,9 @@ $(GLIDE_LIBDIR)/$(GLIDE_DLL): $(GLIDE_OBJECTS) $(GLIDE_RES)
$(GLIDE_LIBDIR)/$(GLIDE_IMP): $(GLIDE_LIBDIR)/$(GLIDE_DLL)
$(DLLTOOL) $(DLLTOOL_FLAGS) --dllname $(GLIDE_DLL) --input-def $(GLIDE_LIBDIR)/$(GLIDE_DEF) --output-lib $@
strip:
$(STRIP) $(GLIDE_LIBDIR)/$(GLIDE_DLL)
###############################################################################
# rules(2)
###############################################################################

View File

@@ -15,6 +15,12 @@
#
# Available options:
#
# CROSS cross-compiler toolchain prefix
# Needed when cross-compiling e.g. on Linux,
# as opposed to compiling on native Windows.
# default = i686-pc-mingw32-
# (Note that a trailing '-' is necessary.)
#
# Environment variables:
# FX_GLIDE_HW build for the given ASIC (either sst1, or sst96).
# default = sst1
@@ -53,16 +59,36 @@ GLIDE_LIBDIR = ../../lib
# tools
###############################################################################
CC = gcc
# default cross-toolchain prefix
DEF_CROSS=i686-pc-mingw32-
#DEF_CROSS=i686-w64-mingw32-
# detect if running under unix by finding 'rm' in $PATH :
ifeq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
WINMODE= 1
UNLINK = del $(subst /,\,$(1))
HOST_CC = $(CC)
else
WINMODE= 0
UNLINK = $(RM) $(1)
ifeq ($(CROSS),)
CROSS=$(DEF_CROSS)
endif
endif
CC = $(CROSS)gcc
AS = nasm
LD = $(CC)
RC = windres
DLLTOOL = dlltool
RC = $(CROSS)windres
DLLTOOL = $(CROSS)dlltool
STRIP = $(CROSS)strip
ifeq ($(WINMODE),1)
HOST_CC = $(CC)
else
#for cross-builds
HOST_CC = gcc
UNLINK = $(RM) $(1)
endif
###############################################################################
# defines
@@ -141,8 +167,12 @@ ifneq ($(USE_X86),1)
CFLAGS += -DGLIDE_USE_C_TRISETUP
endif
ifeq ($(WINMODE),1)
HOST_CFLAGS=$(CFLAGS)
else
# for cross-builds
HOST_CFLAGS=$(filter-out -mcpu=% -mtune=% -DFX_DLL_ENABLE -march=%,$(CFLAGS))
endif
###############################################################################
# objects
@@ -239,6 +269,9 @@ $(GLIDE_LIBDIR)/$(GLIDE_DLL): $(GLIDE_OBJECTS) $(GLIDE_RES)
$(GLIDE_LIBDIR)/$(GLIDE_IMP): $(GLIDE_LIBDIR)/$(GLIDE_DLL)
$(DLLTOOL) $(DLLTOOL_FLAGS) --dllname $(GLIDE_DLL) --input-def $(GLIDE_LIBDIR)/$(GLIDE_DEF) --output-lib $@
strip:
$(STRIP) $(GLIDE_LIBDIR)/$(GLIDE_DLL)
###############################################################################
# rules(2)
###############################################################################

View File

@@ -9,6 +9,12 @@
#
# Available options:
#
# CROSS cross-compiler toolchain prefix
# Needed when cross-compiling e.g. on Linux,
# as opposed to compiling on native Windows.
# default = i686-pc-mingw32-
# (Note that a trailing '-' is necessary.)
#
# Environment variables:
# FX_GLIDE_HW build for the given ASIC (sst1, sst96, cvg, h3, h5).
# default = h5

View File

@@ -9,6 +9,12 @@
#
# Available options:
#
# CROSS cross-compiler toolchain prefix
# Needed when cross-compiling e.g. on Linux,
# as opposed to compiling on native Windows.
# default = i686-pc-mingw32-
# (Note that a trailing '-' is necessary.)
#
# Environment variables:
# OPTFLAGS pass given optimization flags to compiler
# default = -O2 -ffast-math -mtune=pentium
@@ -56,16 +62,36 @@ TEXUS_EXEDIR = $(FX_GLIDE_SW)/bin
# tools
###############################################################################
CC = gcc
# default cross-toolchain prefix
DEF_CROSS=i686-pc-mingw32-
#DEF_CROSS=i686-w64-mingw32-
# detect if running under unix by finding 'rm' in $PATH :
ifeq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
WINMODE= 1
UNLINK = del $(subst /,\,$(1))
HOST_CC = $(CC)
else
WINMODE= 0
UNLINK = $(RM) $(1)
ifeq ($(CROSS),)
CROSS=$(DEF_CROSS)
endif
endif
CC = $(CROSS)gcc
AS = nasm
LD = $(CC)
RC = windres
DLLTOOL = dlltool
RC = $(CROSS)windres
DLLTOOL = $(CROSS)dlltool
STRIP = $(CROSS)strip
ifeq ($(WINMODE),1)
HOST_CC = $(CC)
else
#for cross-builds
HOST_CC = gcc
UNLINK = $(RM) $(1)
endif
###############################################################################
# defines
@@ -154,8 +180,12 @@ else
CFLAGS += -DGLIDE_USE_C_TRISETUP
endif
ifeq ($(WINMODE),1)
HOST_CFLAGS=$(CFLAGS)
else
# for cross-builds
HOST_CFLAGS=$(filter-out -mcpu=% -mtune=% -DFX_DLL_ENABLE -march=%,$(CFLAGS))
endif
###############################################################################
# objects
@@ -284,6 +314,12 @@ $(TEXUS_EXEDIR)/$(TEXUS_EXE): $(FX_GLIDE_SW)/texus2/cmd/cmd.c $(GLIDE_LIBDIR)/$(
# $(warning Texus2 not enabled... Skipping $(TEXUS_EXE))
#endif
strip:
$(STRIP) $(GLIDE_LIBDIR)/$(GLIDE_DLL)
#ifeq ($(TEXUS2),1)
# $(STRIP) $(TEXUS_EXEDIR)/$(TEXUS_EXE)
#endif
###############################################################################
# rules(2)
###############################################################################

View File

@@ -9,6 +9,12 @@
#
# Available options:
#
# CROSS cross-compiler toolchain prefix
# Needed when cross-compiling e.g. on Linux,
# as opposed to compiling on native Windows.
# default = i686-pc-mingw32-
# (Note that a trailing '-' is necessary.)
#
# Environment variables:
# H4=1 High speed Avenger.
# default = no
@@ -54,16 +60,36 @@ TEXUS_EXEDIR = $(FX_GLIDE_SW)/bin
# tools
###############################################################################
CC = gcc
# default cross-toolchain prefix
DEF_CROSS=i686-pc-mingw32-
#DEF_CROSS=i686-w64-mingw32-
# detect if running under unix by finding 'rm' in $PATH :
ifeq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
WINMODE= 1
UNLINK = del $(subst /,\,$(1))
HOST_CC = $(CC)
else
WINMODE= 0
UNLINK = $(RM) $(1)
ifeq ($(CROSS),)
CROSS=$(DEF_CROSS)
endif
endif
CC = $(CROSS)gcc
AS = nasm
LD = $(CC)
RC = windres
DLLTOOL = dlltool
RC = $(CROSS)windres
DLLTOOL = $(CROSS)dlltool
STRIP = $(CROSS)strip
ifeq ($(WINMODE),1)
HOST_CC = $(CC)
else
#for cross-builds
HOST_CC = gcc
UNLINK = $(RM) $(1)
endif
###############################################################################
# defines
@@ -151,11 +177,15 @@ override USE_DRAWTRI_ASM = 1
endif
endif
ifeq ($(WINMODE),1)
HOST_CFLAGS=$(CFLAGS)
else
# for cross-builds
# note that with this, fxgasm outputs wrong (20 bytes shorter) SIZEOF_GC and SIZEOF_GrState
# values in fxgasm.h - everything else is the same (compared to fxgasm.h generated by MSVC 6).
# those two are not used by the asm sources, so we are good.
HOST_CFLAGS=$(filter-out -mcpu=% -mtune=% -DFX_DLL_ENABLE -DHWC_EXT_INIT=% -march=%,$(CFLAGS))
endif
###############################################################################
# objects
@@ -274,6 +304,12 @@ $(TEXUS_EXEDIR)/$(TEXUS_EXE): $(FX_GLIDE_SW)/texus2/cmd/cmd.c $(GLIDE_LIBDIR)/$(
# $(warning Texus2 not enabled... Skipping $(TEXUS_EXE))
#endif
strip:
$(STRIP) $(GLIDE_LIBDIR)/$(GLIDE_DLL)
#ifeq ($(TEXUS2),1)
# $(STRIP) $(TEXUS_EXEDIR)/$(TEXUS_EXE)
#endif
###############################################################################
# rules(2)
###############################################################################

View File

@@ -9,6 +9,12 @@
#
# Available options:
#
# CROSS cross-compiler toolchain prefix
# Needed when cross-compiling e.g. on Linux,
# as opposed to compiling on native Windows.
# default = i686-pc-mingw32-
# (Note that a trailing '-' is necessary.)
#
# Environment variables:
# H4=1 High speed Avenger/Napalm.
# default = no
@@ -60,16 +66,36 @@ TEXUS_EXEDIR = $(FX_GLIDE_SW)/bin
# tools
###############################################################################
CC = gcc
# default cross-toolchain prefix
DEF_CROSS=i686-pc-mingw32-
#DEF_CROSS=i686-w64-mingw32-
# detect if running under unix by finding 'rm' in $PATH :
ifeq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
WINMODE= 1
UNLINK = del $(subst /,\,$(1))
HOST_CC = $(CC)
else
WINMODE= 0
UNLINK = $(RM) $(1)
ifeq ($(CROSS),)
CROSS=$(DEF_CROSS)
endif
endif
CC = $(CROSS)gcc
AS = nasm
LD = $(CC)
RC = windres
DLLTOOL = dlltool
RC = $(CROSS)windres
DLLTOOL = $(CROSS)dlltool
STRIP = $(CROSS)strip
ifeq ($(WINMODE),1)
HOST_CC = $(CC)
else
#for cross-builds
HOST_CC = gcc
UNLINK = $(RM) $(1)
endif
###############################################################################
# defines
@@ -308,6 +334,12 @@ $(TEXUS_EXEDIR)/$(TEXUS_EXE): $(FX_GLIDE_SW)/texus2/cmd/cmd.c $(GLIDE_LIBDIR)/$(
# $(warning Texus2 not enabled... Skipping $(TEXUS_EXE))
#endif
strip:
$(STRIP) $(GLIDE_LIBDIR)/$(GLIDE_DLL)
#ifeq ($(TEXUS2),1)
# $(STRIP) $(TEXUS_EXEDIR)/$(TEXUS_EXE)
#endif
###############################################################################
# rules(2)
###############################################################################

View File

@@ -8,6 +8,12 @@
#
# Available options:
#
# CROSS cross-compiler toolchain prefix
# Needed when cross-compiling e.g. on Linux,
# as opposed to compiling on native Windows.
# default = i686-pc-mingw32-
# (Note that a trailing '-' is necessary.)
#
# Environment variables:
# CPU optimize for the given processor.
# default = pentium
@@ -24,7 +30,24 @@ FX_GLIDE_HW = h5
TOP = ../../..
CPU ?= pentium
CC = mingw32-gcc
# default cross-toolchain prefix
DEF_CROSS=i686-pc-mingw32-
#DEF_CROSS=i686-w64-mingw32-
# detect if running under unix by finding 'rm' in $PATH :
ifeq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
WINMODE= 1
UNLINK = del $(subst /,\,$(1))
else
WINMODE= 0
UNLINK = $(RM) $(1)
ifeq ($(CROSS),)
CROSS=$(DEF_CROSS)
endif
endif
CC = $(CROSS)gcc
CFLAGS = -Wall -O2 -ffast-math -mtune=$(CPU)
CFLAGS += -I$(TOP)/$(FX_GLIDE_HW)/glide3/src -I$(TOP)/$(FX_GLIDE_HW)/incsrc
CFLAGS += -I$(TOP)/swlibs/fxmisc

View File

@@ -9,6 +9,12 @@
#
# Available options:
#
# CROSS cross-compiler toolchain prefix
# Needed when cross-compiling e.g. on Linux,
# as opposed to compiling on native Windows.
# default = i686-pc-mingw32-
# (Note that a trailing '-' is necessary.)
#
# Environment variables:
# FX_GLIDE_HW build for the given ASIC (either sst1, or sst96).
# default = sst1
@@ -51,16 +57,36 @@ TEXUS_EXEDIR = $(FX_GLIDE_SW)/bin
# tools
###############################################################################
CC = gcc
# default cross-toolchain prefix
DEF_CROSS=i686-pc-mingw32-
#DEF_CROSS=i686-w64-mingw32-
# detect if running under unix by finding 'rm' in $PATH :
ifeq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
WINMODE= 1
UNLINK = del $(subst /,\,$(1))
HOST_CC = $(CC)
else
WINMODE= 0
UNLINK = $(RM) $(1)
ifeq ($(CROSS),)
CROSS=$(DEF_CROSS)
endif
endif
CC = $(CROSS)gcc
AS = nasm
LD = $(CC)
RC = windres
DLLTOOL = dlltool
RC = $(CROSS)windres
DLLTOOL = $(CROSS)dlltool
STRIP = $(CROSS)strip
ifeq ($(WINMODE),1)
HOST_CC = $(CC)
else
#for cross-builds
HOST_CC = gcc
UNLINK = $(RM) $(1)
endif
###############################################################################
# defines
@@ -146,8 +172,12 @@ else
CFLAGS += -DGLIDE_USE_C_TRISETUP
endif
ifeq ($(WINMODE),1)
HOST_CFLAGS=$(CFLAGS)
else
# for cross-builds
HOST_CFLAGS=$(filter-out -mcpu=% -mtune=% -DFX_DLL_ENABLE -march=%,$(CFLAGS))
endif
###############################################################################
# objects
@@ -277,6 +307,12 @@ $(TEXUS_EXEDIR)/$(TEXUS_EXE): $(FX_GLIDE_SW)/texus2/cmd/cmd.c $(GLIDE_LIBDIR)/$(
# $(warning Texus2 not enabled... Skipping $(TEXUS_EXE))
#endif
strip:
$(STRIP) $(GLIDE_LIBDIR)/$(GLIDE_DLL)
#ifeq ($(TEXUS2),1)
# $(STRIP) $(TEXUS_EXEDIR)/$(TEXUS_EXE)
#endif
###############################################################################
# rules(2)
###############################################################################