2006-10-15 18:59:45 +00:00
|
|
|
# Build Makefile for Microsoft NMake
|
|
|
|
!ifdef OVERRIDES
|
|
|
|
!include $(OVERRIDES)
|
|
|
|
!endif
|
|
|
|
|
2014-02-11 07:39:09 +00:00
|
|
|
!ifndef RENDERTYPE
|
|
|
|
RENDERTYPE=WIN
|
|
|
|
!endif
|
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
ENGINE_SRC=src
|
|
|
|
!ifndef ENGINE_OBJ
|
|
|
|
ENGINE_OBJ=obj.msc
|
2006-10-15 18:59:45 +00:00
|
|
|
!endif
|
2014-07-22 07:25:54 +00:00
|
|
|
ENGINE_INC=include\ #
|
2006-10-15 18:59:45 +00:00
|
|
|
!ifndef CFLAGS
|
2014-02-10 10:59:42 +00:00
|
|
|
CFLAGS=/DUSE_OPENGL /DPOLYMER /DUSE_LIBPNG
|
2006-10-15 18:59:45 +00:00
|
|
|
!endif
|
|
|
|
|
|
|
|
o=obj
|
|
|
|
res=res
|
|
|
|
asm=masm
|
|
|
|
|
2014-02-11 07:39:09 +00:00
|
|
|
!ifndef WINBITS
|
|
|
|
WINBITS=32
|
|
|
|
!endif
|
|
|
|
|
2014-02-10 10:59:42 +00:00
|
|
|
!if ($(WINBITS)==64)
|
|
|
|
NOASM=1
|
|
|
|
!endif
|
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
|
|
|
|
2006-10-15 18:59:45 +00:00
|
|
|
ENGINELIB=engine.lib
|
|
|
|
EDITORLIB=build.lib
|
|
|
|
|
2010-05-25 10:56:00 +00:00
|
|
|
# this path should match eduke32\Makefile.msvc
|
2012-12-14 17:13:17 +00:00
|
|
|
# WDKROOT="H:\WinDDK\7600.16385.1"
|
2006-10-15 18:59:45 +00:00
|
|
|
|
|
|
|
# /D these to enable certain features of the port's compile process
|
2009-04-12 21:52:49 +00:00
|
|
|
# NOASM When defined, uses C instead of assembly code
|
2007-03-01 18:19:11 +00:00
|
|
|
!ifdef NOASM
|
2009-04-12 21:52:49 +00:00
|
|
|
TARGETOPTS=/DNOASM
|
2007-03-01 18:19:11 +00:00
|
|
|
!endif
|
2006-10-15 18:59:45 +00:00
|
|
|
|
|
|
|
!ifdef DEBUG
|
|
|
|
# debugging options
|
2009-06-05 20:09:13 +00:00
|
|
|
flags_cl=/Od /Zi
|
2006-10-15 18:59:45 +00:00
|
|
|
flags_link=/DEBUG
|
2009-07-09 02:29:48 +00:00
|
|
|
flags_lib=
|
2006-10-15 18:59:45 +00:00
|
|
|
!else
|
|
|
|
# release options
|
2014-02-11 07:39:09 +00:00
|
|
|
flags_cl=/O2 /GL /MP # /I$(WDKROOT)\inc\crt
|
|
|
|
!if ($(WINBITS)!=64)
|
|
|
|
flags_cl=$(flags_cl) /arch:SSE
|
|
|
|
!endif
|
2012-11-15 14:27:49 +00:00
|
|
|
flags_link=/RELEASE /LTCG # /LIBPATH:$(WDKROOT)\lib\Crt\i386 /LIBPATH:$(WDKROOT)\lib\wxp\i386
|
2009-07-09 02:29:48 +00:00
|
|
|
flags_lib=/LTCG
|
2006-10-15 18:59:45 +00:00
|
|
|
!endif
|
|
|
|
|
2014-02-11 07:39:09 +00:00
|
|
|
|
2006-10-15 18:59:45 +00:00
|
|
|
CC=cl
|
|
|
|
AS=ml
|
|
|
|
RC=rc
|
2012-03-14 06:26:29 +00:00
|
|
|
LINK=link /opt:ref /nologo
|
2014-07-22 07:25:54 +00:00
|
|
|
CFLAGS=$(CFLAGS) /nologo /MT /J $(flags_cl) $(TARGETOPTS) /I$(ENGINE_INC)
|
2012-11-15 14:27:49 +00:00
|
|
|
ASFLAGS=/nologo /coff /c
|
2006-10-15 18:59:45 +00:00
|
|
|
EXESUFFIX=.exe
|
2008-12-28 23:27:24 +00:00
|
|
|
!ifdef DEBUG
|
2010-05-25 10:56:00 +00:00
|
|
|
CFLAGS=$(CFLAGS) /DDEBUGGINGAIDS /D "_CRT_SECURE_NO_DEPRECATE"
|
2008-12-28 23:27:24 +00:00
|
|
|
!endif
|
2006-10-15 18:59:45 +00:00
|
|
|
|
2009-04-12 21:52:49 +00:00
|
|
|
ENGINEOBJS= \
|
|
|
|
!ifdef NOASM
|
2014-07-22 07:25:54 +00:00
|
|
|
$(ENGINE_OBJ)\a-c.$o \
|
2009-04-12 21:52:49 +00:00
|
|
|
!else
|
2014-07-22 07:25:54 +00:00
|
|
|
$(ENGINE_OBJ)\a.$o \
|
2007-03-01 18:19:11 +00:00
|
|
|
!endif
|
2014-07-22 07:25:54 +00:00
|
|
|
$(ENGINE_OBJ)\baselayer.$o \
|
|
|
|
$(ENGINE_OBJ)\cache1d.$o \
|
|
|
|
$(ENGINE_OBJ)\compat.$o \
|
|
|
|
$(ENGINE_OBJ)\crc32.$o \
|
|
|
|
$(ENGINE_OBJ)\defs.$o \
|
|
|
|
$(ENGINE_OBJ)\engine.$o \
|
|
|
|
$(ENGINE_OBJ)\polymost.$o \
|
|
|
|
$(ENGINE_OBJ)\texcache.$o \
|
|
|
|
$(ENGINE_OBJ)\dxtfilter.$o \
|
|
|
|
$(ENGINE_OBJ)\hightile.$o \
|
|
|
|
$(ENGINE_OBJ)\mdsprite.$o \
|
|
|
|
$(ENGINE_OBJ)\textfont.$o \
|
|
|
|
$(ENGINE_OBJ)\smalltextfont.$o \
|
|
|
|
$(ENGINE_OBJ)\glbuild.$o \
|
|
|
|
$(ENGINE_OBJ)\kplib.$o \
|
|
|
|
$(ENGINE_OBJ)\lz4.$o \
|
|
|
|
$(ENGINE_OBJ)\lzwnew.$o \
|
|
|
|
$(ENGINE_OBJ)\osd.$o \
|
|
|
|
$(ENGINE_OBJ)\pragmas.$o \
|
|
|
|
$(ENGINE_OBJ)\scriptfile.$o \
|
|
|
|
$(ENGINE_OBJ)\polymer.$o \
|
|
|
|
$(ENGINE_OBJ)\mutex.$o \
|
|
|
|
$(ENGINE_OBJ)\winbits.$o \
|
|
|
|
$(ENGINE_OBJ)\xxhash.$o
|
|
|
|
|
|
|
|
EDITOROBJS=$(ENGINE_OBJ)\build.$o \
|
|
|
|
$(ENGINE_OBJ)\startwin.editor.$o \
|
|
|
|
$(ENGINE_OBJ)\config.$o
|
2006-10-15 18:59:45 +00:00
|
|
|
|
2014-02-11 07:39:09 +00:00
|
|
|
!if ("$(RENDERTYPE)"=="WIN")
|
2014-07-22 07:25:54 +00:00
|
|
|
ENGINEOBJS=$(ENGINEOBJS) $(ENGINE_OBJ)\winlayer.$o $(ENGINE_OBJ)\rawinput.$o
|
2014-02-11 07:39:09 +00:00
|
|
|
!endif
|
|
|
|
!if ("$(RENDERTYPE)"=="SDL")
|
2014-07-22 07:25:54 +00:00
|
|
|
ENGINEOBJS=$(ENGINEOBJS) $(ENGINE_OBJ)\sdlayer.$o
|
2014-02-11 07:39:09 +00:00
|
|
|
!endif
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
LIBS=$(LIBS) user32.lib gdi32.lib shell32.lib wsock32.lib comctl32.lib dxguid.lib
|
2014-02-11 07:39:09 +00:00
|
|
|
CFLAGS=$(CFLAGS) /DRENDERTYPE$(RENDERTYPE)=1 /DSDL_FRAMEWORK /DSDL_TARGET=2 /W2
|
2006-10-15 18:59:45 +00:00
|
|
|
|
|
|
|
# RULES
|
|
|
|
.SUFFIXES: .masm
|
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
{$(ENGINE_SRC)}.masm{$(ENGINE_OBJ)}.$o:
|
2006-10-15 18:59:45 +00:00
|
|
|
$(AS) /c $(ASFLAGS) /Fo$@ $<
|
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
{$(ENGINE_SRC)\util}.c{$(ENGINE_OBJ)}.$o:
|
2006-10-15 18:59:45 +00:00
|
|
|
$(CC) /c $(CFLAGS) /Fo$@ $<
|
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
{$(ENGINE_SRC)\misc}.rc{$(ENGINE_OBJ)}.$(res):
|
|
|
|
$(RC) /i$(ENGINE_INC)\ /fo$@ /r $<
|
2006-10-15 18:59:45 +00:00
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
{$(ENGINE_SRC)}.c{$(ENGINE_OBJ)}.$o:
|
2006-10-15 18:59:45 +00:00
|
|
|
$(CC) /c $(CFLAGS) /Fo$@ $<
|
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
{$(ENGINE_SRC)}.cc{$(ENGINE_OBJ)}.$o:
|
2012-03-14 06:26:29 +00:00
|
|
|
$(CC) /c $(CFLAGS) /Fo$@ $<
|
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
{$(ENGINE_SRC)}.cpp{$(ENGINE_OBJ)}.$o:
|
2006-10-15 18:59:45 +00:00
|
|
|
$(CC) /c $(CFLAGS) /Fo$@ $<
|
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
{$(ENGINE_SRC)}.cxx{$(ENGINE_OBJ)}.$o:
|
2012-03-14 06:26:29 +00:00
|
|
|
$(CC) /c $(CFLAGS) /Fo$@ $<
|
|
|
|
|
2006-10-15 18:59:45 +00:00
|
|
|
# TARGETS
|
2012-03-23 20:23:46 +00:00
|
|
|
UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2art$(EXESUFFIX) wad2map$(EXESUFFIX) kmd2tool$(EXESUFFIX) md2tool$(EXESUFFIX) generateicon$(EXESUFFIX) cacheinfo$(EXESUFFIX) arttool$(EXESUFFIX) givedepth$(EXESUFFIX) mkpalette$(EXESUFFIX) unpackssi$(EXESUFFIX) bsuite$(EXESUFFIX)
|
2012-03-14 06:26:29 +00:00
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
all: $(ENGINE_OBJ)\$(ENGINELIB) $(ENGINE_OBJ)\$(EDITORLIB);
|
2006-10-15 18:59:45 +00:00
|
|
|
utils: $(UTILS) ;
|
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
enginelib: $(ENGINE_OBJ)\$(ENGINELIB) ;
|
|
|
|
$(ENGINE_OBJ)\$(ENGINELIB): $(ENGINEOBJS)
|
2009-07-09 02:29:48 +00:00
|
|
|
lib $(flags_lib) /out:$@ /nologo $**
|
2006-10-15 18:59:45 +00:00
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
editorlib: $(ENGINE_OBJ)\$(EDITORLIB) ;
|
|
|
|
$(ENGINE_OBJ)\$(EDITORLIB): $(EDITOROBJS)
|
2009-07-09 02:29:48 +00:00
|
|
|
lib $(flags_lib) /out:$@ /nologo $**
|
2006-10-15 18:59:45 +00:00
|
|
|
|
|
|
|
# the tools
|
2014-07-22 07:25:54 +00:00
|
|
|
kextract$(EXESUFFIX): $(ENGINE_OBJ)\kextract.$o $(ENGINE_OBJ)\compat.$o $(ENGINE_OBJ)\compat_tools.$o
|
2012-03-14 06:26:29 +00:00
|
|
|
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
|
2007-09-11 00:52:38 +00:00
|
|
|
$(MT) -manifest $@.manifest -outputresource:$@
|
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
kgroup$(EXESUFFIX): $(ENGINE_OBJ)\kgroup.$o $(ENGINE_OBJ)\compat.$o $(ENGINE_OBJ)\compat_tools.$o
|
2012-03-14 06:26:29 +00:00
|
|
|
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
|
|
|
|
$(MT) -manifest $@.manifest -outputresource:$@
|
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
transpal$(EXESUFFIX): $(ENGINE_OBJ)\transpal.$o $(ENGINE_OBJ)\pragmas.$o $(ENGINE_OBJ)\compat.$o $(ENGINE_OBJ)\compat_tools.$o
|
2012-03-14 06:26:29 +00:00
|
|
|
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
|
|
|
|
$(MT) -manifest $@.manifest -outputresource:$@
|
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
wad2map$(EXESUFFIX): $(ENGINE_OBJ)\wad2map.$o $(ENGINE_OBJ)\pragmas.$o $(ENGINE_OBJ)\compat.$o $(ENGINE_OBJ)\compat_tools.$o
|
2012-03-14 06:26:29 +00:00
|
|
|
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
|
|
|
|
$(MT) -manifest $@.manifest -outputresource:$@
|
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
wad2art$(EXESUFFIX): $(ENGINE_OBJ)\wad2art.$o $(ENGINE_OBJ)\pragmas.$o $(ENGINE_OBJ)\compat.$o $(ENGINE_OBJ)\compat_tools.$o
|
2012-03-14 06:26:29 +00:00
|
|
|
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
|
|
|
|
$(MT) -manifest $@.manifest -outputresource:$@
|
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
kmd2tool$(EXESUFFIX): $(ENGINE_OBJ)\kmd2tool.$o
|
2012-03-23 20:23:46 +00:00
|
|
|
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
|
|
|
|
$(MT) -manifest $@.manifest -outputresource:$@
|
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
md2tool$(EXESUFFIX): $(ENGINE_OBJ)\md2tool.$o $(ENGINE_OBJ)\compat.$o $(ENGINE_OBJ)\compat_tools.$o
|
2012-03-14 06:26:29 +00:00
|
|
|
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
|
|
|
|
$(MT) -manifest $@.manifest -outputresource:$@
|
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
generateicon$(EXESUFFIX): $(ENGINE_OBJ)\generateicon.$o $(ENGINE_OBJ)\compat.$o $(ENGINE_OBJ)\pragmas.$o $(ENGINE_OBJ)\kplib.$o $(ENGINE_OBJ)\cache1d.$o $(ENGINE_OBJ)\compat_tools.$o
|
2012-03-14 06:26:29 +00:00
|
|
|
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
|
|
|
|
$(MT) -manifest $@.manifest -outputresource:$@
|
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
cacheinfo$(EXESUFFIX): $(ENGINE_OBJ)\cacheinfo.$o $(ENGINE_OBJ)\compat.$o $(ENGINE_OBJ)\compat_tools.$o
|
2012-03-14 06:26:29 +00:00
|
|
|
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
|
2007-09-11 00:52:38 +00:00
|
|
|
$(MT) -manifest $@.manifest -outputresource:$@
|
2006-10-15 18:59:45 +00:00
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
arttool$(EXESUFFIX): $(ENGINE_OBJ)\arttool.$o
|
2012-03-14 06:26:29 +00:00
|
|
|
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
|
2007-09-11 00:52:38 +00:00
|
|
|
$(MT) -manifest $@.manifest -outputresource:$@
|
2006-10-15 18:59:45 +00:00
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
givedepth$(EXESUFFIX): $(ENGINE_OBJ)\givedepth.$o
|
2012-03-14 06:26:29 +00:00
|
|
|
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
|
2007-09-11 00:52:38 +00:00
|
|
|
$(MT) -manifest $@.manifest -outputresource:$@
|
2006-10-15 18:59:45 +00:00
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
mkpalette$(EXESUFFIX): $(ENGINE_OBJ)\mkpalette.$o
|
2012-03-14 06:26:29 +00:00
|
|
|
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
|
2007-09-11 00:52:38 +00:00
|
|
|
$(MT) -manifest $@.manifest -outputresource:$@
|
2006-10-15 18:59:45 +00:00
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
unpackssi$(EXESUFFIX): $(ENGINE_OBJ)\unpackssi.$o
|
2012-03-18 08:48:32 +00:00
|
|
|
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
|
|
|
|
$(MT) -manifest $@.manifest -outputresource:$@
|
|
|
|
|
2014-07-22 07:25:54 +00:00
|
|
|
bsuite$(EXESUFFIX): $(ENGINE_OBJ)\bsuite.$o
|
2012-03-18 08:48:32 +00:00
|
|
|
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
|
|
|
|
$(MT) -manifest $@.manifest -outputresource:$@
|
|
|
|
|
2006-10-15 18:59:45 +00:00
|
|
|
# DEPENDENCIES
|
|
|
|
!include Makefile.deps
|
|
|
|
|
2012-03-14 06:26:29 +00:00
|
|
|
# PHONIES
|
2006-10-15 18:59:45 +00:00
|
|
|
clean:
|
2014-07-22 07:25:54 +00:00
|
|
|
-del /Q $(ENGINEOBJS) $(EDITOROBJS) $(ENGINE_OBJ)\kextract.$o $(ENGINE_OBJ)\kgroup.$o $(ENGINE_OBJ)\transpal.$o $(ENGINE_OBJ)\wad2art.$o $(ENGINE_OBJ)\wad2map.$o $(ENGINE_OBJ)\kmd2tool.$o $(ENGINE_OBJ)\md2tool.$o $(ENGINE_OBJ)\generateicon.$o $(ENGINE_OBJ)\cacheinfo.$o $(ENGINE_OBJ)\arttool.$o $(ENGINE_OBJ)\givedepth.$o $(ENGINE_OBJ)\mkpalette.$o $(ENGINE_OBJ)\unpackssi.$o $(ENGINE_OBJ)\bsuite.$o $(ENGINE_OBJ)\compat.$o $(ENGINE_OBJ)\compat_tools.$o $(ENGINE_OBJ)\pragmas.$o $(ENGINE_OBJ)\kplib.$o $(ENGINE_OBJ)\cache1d.$o
|
2006-10-15 18:59:45 +00:00
|
|
|
veryclean: clean
|
2014-07-22 07:25:54 +00:00
|
|
|
-del /Q $(ENGINE_OBJ)\$(ENGINELIB) $(ENGINE_OBJ)\$(EDITORLIB) $(UTILS) *.map *.manifest *.pdb
|
2006-10-15 18:59:45 +00:00
|
|
|
|