raze-gles/polymer/eduke32/Makefile.msvc

259 lines
7 KiB
Text
Raw Normal View History

# EDuke32 Makefile for Microsoft NMake
CPLUSPLUS=1
DUKE3D_SRC=source
DUKE3D_OBJ=$(DUKE3D_SRC)\obj_win
ENGINE_ROOT=build
ENGINE_INC=$(ENGINE_ROOT)\include
ENGINE_OBJ=$(DUKE3D_SRC)\eobj_win
DUKE3D_INC=$(DUKE3D_SRC)
DUKE3D_RSRC=rsrc
o=obj
!ifndef WINBITS
WINBITS=32
!endif
WINLIB=\$(WINBITS)
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
!if ($(WINBITS)==32)
WINMACHINE=/MACHINE:X86
!elseif ($(WINBITS)==64)
WINMACHINE=/MACHINE:X64
!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
AUDIOLIB_ROOT=$(DUKE3D_SRC)\jaudiolib
JAUDIOLIB=libjfaudiolib.lib
ENETDIR=$(DUKE3D_SRC)\enet
ENETLIB=libenet.lib
ENGINELIB=engine.lib
EDITORLIB=build.lib
# the WDK allows us to link against msvcrt.dll instead of msvcrxxx.dll
# this path should match build\Makefile.msvc
# WDKROOT="H:\WinDDK\7600.16385.1"
PLATFORM=platform\Windows
AUDIOINC=source\jaudiolib\third-party\common
AUDIOPLATFORM=source\jaudiolib\third-party\Windows
!ifndef RENDERTYPE
RENDERTYPE=WIN
!endif
!ifndef MIXERTYPE
MIXERTYPE=WIN
!endif
!ifdef DEBUG
# debugging options
flags_cl=/Od /Zi
flags_link=/DEBUG
!else
# release options
flags_cl=/O2 /GL /MP # /I$(WDKROOT)\inc\crt /I$(WDKROOT)\inc\api
!if ($(WINBITS)!=64)
flags_cl=$(flags_cl) /arch:SSE
!endif
flags_link=/RELEASE /LTCG # /LIBPATH:$(WDKROOT)\lib\wxp\i386 /LIBPATH:$(WDKROOT)\lib\Crt\i386
!endif
ENGINEOPTS=/DUSE_OPENGL /DPOLYMER /DUSE_LIBPNG /I..\$(PLATFORM)\include
!ifdef CPLUSPLUS
ENGINEOPTS=$(ENGINEOPTS) /TP
!endif
!if ($(WINBITS)==64)
NOASM=1
!endif
CC=cl
AS=ml
LINK=link /nologo /opt:ref
MT=mt
CFLAGS= /MT /J /nologo $(flags_cl) \
/I$(DUKE3D_INC) /I$(ENGINE_INC)\msvc /I$(ENGINE_INC)\ /I$(DUKE3D_SRC)\jmact /I$(AUDIOLIB_ROOT)\include /I$(ENETDIR)\include \
/W2 $(ENGINEOPTS) \
/I$(PLATFORM)\include /I$(AUDIOINC)\include /DRENDERTYPE$(RENDERTYPE)=1 /DMIXERTYPE$(MIXERTYPE)=1 /DSDL_FRAMEWORK /DSDL_TARGET=2 /DUSE_LIBVPX
LIBS=user32.lib gdi32.lib shell32.lib winmm.lib ws2_32.lib comctl32.lib shlwapi.lib oleaut32.lib ole32.lib imm32.lib version.lib \
libFLAC.a libogg.a libvorbis.a libvorbisfile.a libvpx.a libpng_mini.a libz_mini.a libcompat-from-mingw-w64.a \
dsound.lib advapi32.lib libcompat-to-msvc.a
!if ("$(RENDERTYPE)"=="SDL")
LIBS=libSDL2main.a libSDL2.a libSDL2_mixer.a $(LIBS)
!endif
LIBS=/NODEFAULTLIB:glu32.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib /NODEFAULTLIB:libcmt.lib \
/NODEFAULTLIB:libcmtd.lib $(LIBS)
# NOASM When defined, uses C instead of assembly code
!ifdef NOASM
CFLAGS=$(CFLAGS) /DNOASM
!endif
ASFLAGS=/nologo /coff /c
EXESUFFIX=.exe
!ifdef DEBUG
CFLAGS=$(CFLAGS) /DDEBUGGINGAIDS /D "_CRT_SECURE_NO_DEPRECATE"
LIBS=$(LIBS) msvcrtd.lib
!else
# comment msvcrt_winxp.obj if not using the WDK
LIBS=$(LIBS) msvcrt.lib # msvcrt_winxp.obj
!endif
JMACTOBJ=$(DUKE3D_OBJ)\file_lib.$o \
$(DUKE3D_OBJ)\control.$o \
$(DUKE3D_OBJ)\keyboard.$o \
$(DUKE3D_OBJ)\mouse.$o \
$(DUKE3D_OBJ)\joystick.$o \
$(DUKE3D_OBJ)\mathutil.$o \
$(DUKE3D_OBJ)\scriplib.$o
GAMEOBJS=$(DUKE3D_OBJ)\game.$o \
$(DUKE3D_OBJ)\game_inline.$o \
$(DUKE3D_OBJ)\actors.$o \
$(DUKE3D_OBJ)\actors_inline.$o \
$(DUKE3D_OBJ)\anim.$o \
$(DUKE3D_OBJ)\animvpx.$o \
$(DUKE3D_OBJ)\common.$o \
$(DUKE3D_OBJ)\demo.$o \
$(DUKE3D_OBJ)\gamedef.$o \
$(DUKE3D_OBJ)\gameexec.$o \
$(DUKE3D_OBJ)\gamevars.$o \
$(DUKE3D_OBJ)\global.$o \
$(DUKE3D_OBJ)\input.$o \
$(DUKE3D_OBJ)\menus.$o \
$(DUKE3D_OBJ)\namesdyn.$o \
$(DUKE3D_OBJ)\net.$o \
$(DUKE3D_OBJ)\player.$o \
$(DUKE3D_OBJ)\premap.$o \
$(DUKE3D_OBJ)\savegame.$o \
$(DUKE3D_OBJ)\sector.$o \
$(DUKE3D_OBJ)\sector_inline.$o \
$(DUKE3D_OBJ)\rev.$o \
$(DUKE3D_OBJ)\rts.$o \
$(DUKE3D_OBJ)\config.$o \
$(DUKE3D_OBJ)\animlib.$o\
$(DUKE3D_OBJ)\osdfuncs.$o \
$(DUKE3D_OBJ)\osdcmds.$o \
$(DUKE3D_OBJ)\grpscan.$o \
$(DUKE3D_OBJ)\winbits.$o \
$(DUKE3D_OBJ)\gameres.res \
$(DUKE3D_OBJ)\startwin.game.$o \
$(JMACTOBJ) \
$(DUKE3D_OBJ)\sounds.$o \
$(DUKE3D_OBJ)\soundsdyn.$o \
!ifdef DEBUG
$(DUKE3D_OBJ)\mdump.$o
!endif
EDITOROBJS=$(DUKE3D_OBJ)\astub.$o \
$(DUKE3D_OBJ)\common.$o \
$(DUKE3D_OBJ)\mathutil.$o \
$(DUKE3D_OBJ)\m32def.$o \
$(DUKE3D_OBJ)\m32vars.$o \
$(DUKE3D_OBJ)\m32exec.$o \
$(DUKE3D_OBJ)\sounds_mapster32.$o \
$(DUKE3D_OBJ)\rev.$o \
$(DUKE3D_OBJ)\buildres.res \
!ifdef DEBUG
$(DUKE3D_OBJ)\mdump.$o
!endif
!if ("$(RENDERTYPE)"=="SDL")
GAMEOBJS=$(GAMEOBJS) $(DUKE3D_OBJ)\game_icon.$o
EDITOROBJS=$(EDITOROBJS) $(DUKE3D_OBJ)\build_icon.$o
!endif
!if ("$(MIXERTYPE)"=="WIN")
GAMEOBJS=$(GAMEOBJS) $(DUKE3D_OBJ)\midi.$o $(DUKE3D_OBJ)\music.$o $(DUKE3D_OBJ)\mpu401.$o
!endif
!if ("$(MIXERTYPE)"=="SDL")
GAMEOBJS=$(GAMEOBJS) $(DUKE3D_OBJ)\sdlmusic.$o
!endif
GAMEOBJS=$(GAMEOBJS) $(MUSICOBJ)
EDITOROBJS=$(EDITOROBJS) $(MUSICOBJ)
# RULES
.SUFFIXES: .masm
{$(DUKE3D_SRC)\}.masm{$(DUKE3D_OBJ)\}.$o:
$(AS) /c $(ASFLAGS) /Fo$@ $<
{$(DUKE3D_SRC)\jmact}.c{$(DUKE3D_OBJ)\}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $<
{$(DUKE3D_SRC)\util}.c{$(DUKE3D_OBJ)\}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $<
{$(DUKE3D_SRC)\}.c{$(DUKE3D_OBJ)\}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $<
{$(DUKE3D_RSRC)\}.c{$(DUKE3D_OBJ)\}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $<
{$(DUKE3D_SRC)\}.cpp{$(DUKE3D_OBJ)\}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $<
{$(DUKE3D_SRC)\misc}.rc{$(DUKE3D_OBJ)\}.res:
$(RC) /i$(ENGINE_INC)\ /i$(DUKE3D_SRC)\ /DPOLYMER /fo$@ /r $<
# TARGETS
all: eduke32$(EXESUFFIX) mapster32$(EXESUFFIX)
eduke32$(EXESUFFIX): $(GAMEOBJS) $(ENGINE_OBJ)\$(ENGINELIB) $(AUDIOLIB_ROOT)\$(JAUDIOLIB) $(ENETDIR)\$(ENETLIB)
$(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS $(WINMACHINE) /LIBPATH:$(PLATFORM)\lib$(WINLIB) /LIBPATH:$(AUDIOPLATFORM)\lib$(WINLIB) $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $(DUKE3D_RSRC)$(WINLIB)\manifest.game.xml -hashupdate -outputresource:$@ -out:$@.manifest
mapster32$(EXESUFFIX): $(EDITOROBJS) $(ENGINE_OBJ)\$(ENGINELIB) $(ENGINE_OBJ)\$(EDITORLIB) $(AUDIOLIB_ROOT)\$(JAUDIOLIB)
$(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS $(WINMACHINE) /LIBPATH:$(PLATFORM)\lib$(WINLIB) /LIBPATH:$(AUDIOPLATFORM)\lib$(WINLIB) $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $(DUKE3D_RSRC)$(WINLIB)\manifest.build.xml -hashupdate -outputresource:$@ -out:$@.manifest
!include Makefile.deps
enginelib editorlib: AlwaysBuild
-mkdir $(ENGINE_OBJ)
echo DUKE3D_OBJ=$(MAKEDIR)\$(ENGINE_OBJ)\ > $(ENGINE_OBJ)\overrides.mak
echo CFLAGS=$(ENGINEOPTS) >> $(ENGINE_OBJ)\overrides.mak
echo WINBITS=$(WINBITS) >> $(ENGINE_OBJ)\overrides.mak
echo RENDERTYPE=$(RENDERTYPE) >> $(ENGINE_OBJ)\overrides.mak
echo MIXERTYPE=$(MIXERTYPE) >> $(ENGINE_OBJ)\overrides.mak
cd $(ENGINE_ROOT)
nmake /f Makefile.msvc "OVERRIDES=$(MAKEDIR)\$(ENGINE_OBJ)\overrides.mak" $@
cd $(MAKEDIR)
jaudiolib:
cd $(AUDIOLIB_ROOT)
nmake /f Makefile.msvc "MIXERTYPE=$(MIXERTYPE)" "WINBITS=$(WINBITS)"
cd $(MAKEDIR)
enet:
cd $(ENETDIR)
nmake /f Makefile.msvc "WINBITS=$(WINBITS)"
cd $(MAKEDIR)
AlwaysBuild: ;
$(ENGINE_OBJ)\$(EDITORLIB): editorlib ;
$(ENGINE_OBJ)\$(ENGINELIB): enginelib ;
$(AUDIOLIB_ROOT)\$(JAUDIOLIB): jaudiolib ;
$(ENETDIR)\$(ENETLIB): enet ;
# PHONIES
clean:
-del /Q $(DUKE3D_OBJ)\* eduke32$(EXESUFFIX) mapster32$(EXESUFFIX) \
*.pdb *.map *.manifest
-copy /y nul $(DUKE3D_OBJ)\keep.me
cd $(AUDIOLIB_ROOT)
nmake /f Makefile.msvc clean
cd $(MAKEDIR)\$(ENETDIR)
nmake /f Makefile.msvc clean
cd $(MAKEDIR)
veryclean: clean
-del /Q $(ENGINE_OBJ)\*
-copy /y nul $(ENGINE_OBJ)\keep.me