raze-gles/polymer/eduke32/build/Makefile.msvc

222 lines
6.3 KiB
Makefile
Raw Normal View History

# Build Makefile for Microsoft NMake
!ifdef OVERRIDES
!include $(OVERRIDES)
!endif
!ifndef RENDERTYPE
RENDERTYPE=WIN
!endif
SRC=src
!ifndef OBJ
OBJ=obj.msc
!endif
INC=include\ #
!ifndef CFLAGS
CFLAGS=/DUSE_OPENGL /DPOLYMER /DUSE_LIBPNG
!endif
o=obj
res=res
asm=masm
!ifndef WINBITS
WINBITS=32
!endif
!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
ENGINELIB=engine.lib
EDITORLIB=build.lib
# this path should match eduke32\Makefile.msvc
# WDKROOT="H:\WinDDK\7600.16385.1"
# /D these to enable certain features of the port's compile process
# NOASM When defined, uses C instead of assembly code
!ifdef NOASM
TARGETOPTS=/DNOASM
!endif
!ifdef DEBUG
# debugging options
flags_cl=/Od /Zi
flags_link=/DEBUG
flags_lib=
!else
# release options
flags_cl=/O2 /GL /MP # /I$(WDKROOT)\inc\crt
!if ($(WINBITS)!=64)
flags_cl=$(flags_cl) /arch:SSE
!endif
flags_link=/RELEASE /LTCG # /LIBPATH:$(WDKROOT)\lib\Crt\i386 /LIBPATH:$(WDKROOT)\lib\wxp\i386
flags_lib=/LTCG
!endif
CC=cl
AS=ml
RC=rc
LINK=link /opt:ref /nologo
CFLAGS=$(CFLAGS) /nologo /MT /J $(flags_cl) $(TARGETOPTS) /I$(INC)
ASFLAGS=/nologo /coff /c
EXESUFFIX=.exe
!ifdef DEBUG
CFLAGS=$(CFLAGS) /DDEBUGGINGAIDS /D "_CRT_SECURE_NO_DEPRECATE"
!endif
ENGINEOBJS= \
!ifdef NOASM
$(OBJ)\a-c.$o \
!else
$(OBJ)\a.$o \
!endif
$(OBJ)\baselayer.$o \
$(OBJ)\cache1d.$o \
$(OBJ)\compat.$o \
$(OBJ)\crc32.$o \
$(OBJ)\defs.$o \
$(OBJ)\engine.$o \
$(OBJ)\polymost.$o \
$(OBJ)\texcache.$o \
$(OBJ)\dxtfilter.$o \
$(OBJ)\hightile.$o \
$(OBJ)\mdsprite.$o \
$(OBJ)\textfont.$o \
$(OBJ)\smalltextfont.$o \
$(OBJ)\glbuild.$o \
$(OBJ)\kplib.$o \
$(OBJ)\lz4.$o \
$(OBJ)\lzwnew.$o \
$(OBJ)\osd.$o \
$(OBJ)\pragmas.$o \
$(OBJ)\scriptfile.$o \
$(OBJ)\polymer.$o \
$(OBJ)\mutex.$o \
$(OBJ)\winbits.$o \
$(OBJ)\xxhash.$o
EDITOROBJS=$(OBJ)\build.$o \
$(OBJ)\startwin.editor.$o \
$(OBJ)\config.$o
!if ("$(RENDERTYPE)"=="WIN")
ENGINEOBJS=$(ENGINEOBJS) $(OBJ)\winlayer.$o $(OBJ)\rawinput.$o
!endif
!if ("$(RENDERTYPE)"=="SDL")
ENGINEOBJS=$(ENGINEOBJS) $(OBJ)\sdlayer.$o
!endif
LIBS=$(LIBS) user32.lib gdi32.lib shell32.lib wsock32.lib comctl32.lib dxguid.lib
CFLAGS=$(CFLAGS) /DRENDERTYPE$(RENDERTYPE)=1 /DSDL_FRAMEWORK /DSDL_TARGET=2 /W2
# RULES
.SUFFIXES: .masm
{$(SRC)}.masm{$(OBJ)}.$o:
$(AS) /c $(ASFLAGS) /Fo$@ $<
{$(SRC)\tmp}.c{$(OBJ)}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $<
{$(SRC)\util}.c{$(OBJ)}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $<
{$(SRC)\misc}.rc{$(OBJ)}.$(res):
$(RC) /i$(INC)\ /fo$@ /r $<
{$(SRC)}.c{$(OBJ)}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $<
{$(SRC)}.cc{$(OBJ)}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $<
{$(SRC)}.cpp{$(OBJ)}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $<
{$(SRC)}.cxx{$(OBJ)}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $<
# TARGETS
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)
all: $(OBJ)\$(ENGINELIB) $(OBJ)\$(EDITORLIB);
utils: $(UTILS) ;
enginelib: $(OBJ)\$(ENGINELIB) ;
$(OBJ)\$(ENGINELIB): $(ENGINEOBJS)
lib $(flags_lib) /out:$@ /nologo $**
editorlib: $(OBJ)\$(EDITORLIB) ;
$(OBJ)\$(EDITORLIB): $(EDITOROBJS)
lib $(flags_lib) /out:$@ /nologo $**
# the tools
kextract$(EXESUFFIX): $(OBJ)\kextract.$o $(OBJ)\compat.$o $(OBJ)\compat_tools.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $@.manifest -outputresource:$@
kgroup$(EXESUFFIX): $(OBJ)\kgroup.$o $(OBJ)\compat.$o $(OBJ)\compat_tools.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $@.manifest -outputresource:$@
transpal$(EXESUFFIX): $(OBJ)\transpal.$o $(OBJ)\pragmas.$o $(OBJ)\compat.$o $(OBJ)\compat_tools.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $@.manifest -outputresource:$@
wad2map$(EXESUFFIX): $(OBJ)\wad2map.$o $(OBJ)\pragmas.$o $(OBJ)\compat.$o $(OBJ)\compat_tools.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $@.manifest -outputresource:$@
wad2art$(EXESUFFIX): $(OBJ)\wad2art.$o $(OBJ)\pragmas.$o $(OBJ)\compat.$o $(OBJ)\compat_tools.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $@.manifest -outputresource:$@
kmd2tool$(EXESUFFIX): $(OBJ)\kmd2tool.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $@.manifest -outputresource:$@
md2tool$(EXESUFFIX): $(OBJ)\md2tool.$o $(OBJ)\compat.$o $(OBJ)\compat_tools.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $@.manifest -outputresource:$@
generateicon$(EXESUFFIX): $(OBJ)\generateicon.$o $(OBJ)\compat.$o $(OBJ)\pragmas.$o $(OBJ)\kplib.$o $(OBJ)\cache1d.$o $(OBJ)\compat_tools.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $@.manifest -outputresource:$@
cacheinfo$(EXESUFFIX): $(OBJ)\cacheinfo.$o $(OBJ)\compat.$o $(OBJ)\compat_tools.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $@.manifest -outputresource:$@
arttool$(EXESUFFIX): $(OBJ)\arttool.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $@.manifest -outputresource:$@
givedepth$(EXESUFFIX): $(OBJ)\givedepth.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $@.manifest -outputresource:$@
mkpalette$(EXESUFFIX): $(OBJ)\mkpalette.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $@.manifest -outputresource:$@
unpackssi$(EXESUFFIX): $(OBJ)\unpackssi.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $@.manifest -outputresource:$@
bsuite$(EXESUFFIX): $(OBJ)\bsuite.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $@.manifest -outputresource:$@
# DEPENDENCIES
!include Makefile.deps
# PHONIES
clean:
-del /Q $(ENGINEOBJS) $(EDITOROBJS) $(OBJ)\kextract.$o $(OBJ)\kgroup.$o $(OBJ)\transpal.$o $(OBJ)\wad2art.$o $(OBJ)\wad2map.$o $(OBJ)\kmd2tool.$o $(OBJ)\md2tool.$o $(OBJ)\generateicon.$o $(OBJ)\cacheinfo.$o $(OBJ)\arttool.$o $(OBJ)\givedepth.$o $(OBJ)\mkpalette.$o $(OBJ)\unpackssi.$o $(OBJ)\bsuite.$o $(OBJ)\compat.$o $(OBJ)\compat_tools.$o $(OBJ)\pragmas.$o $(OBJ)\kplib.$o $(OBJ)\cache1d.$o
veryclean: clean
-del /Q $(OBJ)\$(ENGINELIB) $(OBJ)\$(EDITORLIB) $(UTILS) *.map *.manifest *.pdb