bring ms and gcc Makefiles into better alignment

Makefile.msc has been tested.
Makefile.gcc has not been tested yet.
This commit is contained in:
nhmall
2018-11-28 19:47:58 -05:00
parent a8fe565912
commit ec1f3d3f57
2 changed files with 446 additions and 261 deletions

View File

@@ -71,10 +71,11 @@ DEBUGINFO = Y
#
# You'll have to set PDCURSES_H to the correct location of the
# PDCurses header (.h) files and PDCURSES_C to the location
# of your PDCurses C files.
# of your PDCurses C files which must already be resident on
# your machine.
#
#ADD_CURSES=Y
#PDCURSES_TOP=..\..\pdcurses
ADD_CURSES=Y
PDCURSES_TOP=..\..\pdcurses
#
#==============================================================================
# This marks the end of the BUILD DECISIONS section.
@@ -89,13 +90,9 @@ DEBUGINFO = Y
# Nothing below here should have to be changed.#
# #
################################################
#
#==============================================================================
# Set the gamedir according to your preference.
# If not present prior to compilation it gets created.
#
# Source directories. Makedefs hardcodes these, don't change them.
#
@@ -122,11 +119,6 @@ cc=cl
link=link
rc=Rc
#
#==========================================
# Exe File Info.
#==========================================
#
#
# Optional high-quality BSD random number generation routines
@@ -280,7 +272,7 @@ RECOVOBJS = $(O)recover.o
TILEFILES = $(WSHR)\monsters.txt $(WSHR)\objects.txt $(WSHR)\other.txt
#
# These are not invoked during a normal game build in 3.4
# These are not invoked during a normal game build in 3.4+
#
TEXT_IO = $(O)tiletext.o $(O)tiletxt.o $(O)drawing.o \
$(O)decl.o $(O)monst.o $(O)objects.o
@@ -306,19 +298,19 @@ VOBJ06 = $(O)dothrow.o $(O)drawing.o $(O)dungeon.o $(O)eat.o
VOBJ07 = $(O)end.o $(O)engrave.o $(O)exper.o $(O)explode.o
VOBJ08 = $(O)extralev.o $(O)files.o $(O)fountain.o $(O)hack.o
VOBJ09 = $(O)hacklib.o $(O)invent.o $(O)light.o $(O)lock.o
VOBJ10 = $(O)mail.o $(O)pcmain.o $(O)makemon.o $(O)mapglyph.o $(O)mcastu.o
VOBJ11 = $(O)mhitm.o $(O)mhitu.o $(O)minion.o $(O)mklev.o
VOBJ12 = $(O)mkmap.o $(O)mkmaze.o $(O)mkobj.o $(O)mkroom.o
VOBJ13 = $(O)mon.o $(O)mondata.o $(O)monmove.o $(O)monst.o
VOBJ14 = $(O)mplayer.o $(O)mthrowu.o $(O)muse.o
VOBJ15 = $(O)music.o $(O)o_init.o $(O)objects.o $(O)objnam.o
VOBJ16 = $(O)options.o $(O)pager.o $(O)pickup.o $(O)pline.o
VOBJ17 = $(O)polyself.o $(O)potion.o $(O)pray.o $(O)priest.o
VOBJ18 = $(O)quest.o $(O)questpgr.o $(RANDOM) $(O)read.o
VOBJ19 = $(O)rect.o $(O)region.o $(O)restore.o $(O)rip.o
VOBJ20 = $(O)rnd.o $(O)role.o $(O)rumors.o $(O)save.o
VOBJ21 = $(O)shk.o $(O)shknam.o $(O)sit.o $(O)sounds.o
VOBJ22 = $(O)sp_lev.o $(O)spell.o $(O)steal.o $(O)steed.o
VOBJ10 = $(O)mail.o $(O)pcmain.o $(O)makemon.o $(O)mapglyph.o
VOBJ11 = $(O)mcastu.o $(O)mhitm.o $(O)mhitu.o $(O)minion.o
VOBJ12 = $(O)mklev.o $(O)mkmap.o $(O)mkmaze.o $(O)mkobj.o
VOBJ13 = $(O)mkroom.o $(O)mon.o $(O)mondata.o $(O)monmove.o
VOBJ14 = $(O)monst.o $(O)mplayer.o $(O)mthrowu.o $(O)muse.o
VOBJ15 = $(O)music.o $(O)o_init.o $(O)objects.o $(O)objnam.o
VOBJ16 = $(O)options.o $(O)pager.o $(O)pickup.o $(O)pline.o
VOBJ17 = $(O)polyself.o $(O)potion.o $(O)pray.o $(O)priest.o
VOBJ18 = $(O)quest.o $(O)questpgr.o $(RANDOM) $(O)read.o
VOBJ19 = $(O)rect.o $(O)region.o $(O)restore.o $(O)rip.o
VOBJ20 = $(O)rnd.o $(O)role.o $(O)rumors.o $(O)save.o
VOBJ21 = $(O)shk.o $(O)shknam.o $(O)sit.o $(O)sounds.o
VOBJ22 = $(O)sp_lev.o $(O)spell.o $(O)steal.o $(O)steed.o
VOBJ23 = $(O)sys.o $(O)teleport.o $(O)timeout.o $(O)topten.o
VOBJ24 = $(O)track.o $(O)trap.o $(O)u_init.o $(O)uhitm.o
VOBJ25 = $(O)vault.o $(O)vis_tab.o $(O)vision.o $(O)weapon.o
@@ -362,7 +354,8 @@ GUIHDR = $(MSWIN)\mhaskyn.h $(MSWIN)\mhdlg.h $(MSWIN)\mhfont.h \
COMCTRL = comctl32.lib
KEYDLLS = $(GAMEDIR)\nhdefkey.dll $(GAMEDIR)\nh340key.dll $(GAMEDIR)\nhraykey.dll
KEYDLLS = $(GAMEDIR)\nhdefkey.dll $(GAMEDIR)\nh340key.dll \
$(GAMEDIR)\nhraykey.dll
TILEUTIL16 = $(UTIL)\tile2bmp.exe
TILEBMP16 = $(SRC)\tiles.bmp
@@ -399,7 +392,7 @@ PDCLIBOBJS = $(O)addch.o $(O)addchstr.o $(O)addstr.o $(O)attr.o $(O)beep.o
PDCOBJS = $(O)pdcclip.o $(O)pdcdisp.o $(O)pdcgetsc.o $(O)pdckbd.o $(O)pdcscrn.o \
$(O)pdcsetsc.o $(O)pdcutil.o
PDCLIB = $(O)\pdcurses.lib
PDCLIB = $(O)pdcurses.lib
PDCINCL = /I$(PDCURSES_TOP) /I$(PDCSRC) /I$(PDCWINCON)
@@ -452,12 +445,23 @@ DATABASE = $(DAT)\data.base
!IF "$(ADD_CURSES)" == "Y"
#CURSESDEF=-D"PDC_DLL_BUILD" -D"CURSES_GRAPHICS" -D"CURSES_BRIEF_INCLUDE"
CURSESDEF=-D"CURSES_GRAPHICS" -D"CURSES_BRIEF_INCLUDE"
CURSESINCL=..\win\curses
!ELSE
CURSDEF=
CURSESLIB=
CURSESINCL=
!ENDIF
!IFNDEF ADD_CURSES
INCLDIR= /I..\include /I..\sys\winnt
!ELSE
INCLDIR= /I..\include /I..\sys\winnt /I$(CURSESINCL)
!ENDIF
#===========================================
#---- start of Visual Studio Specific macros
#===========================================
ccommon= -c -nologo -D"_CONSOLE" -D"_CRT_NONSTDC_NO_DEPRECATE" -D"_CRT_SECURE_NO_DEPRECATE" \
-D"_LIB" -D"_SCL_SECURE_NO_DEPRECATE" -D"_VC80_UPGRADE=0x0600" -D"DLB" -D"_MBCS" \
-DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -D"NDEBUG" -D"YY_NO_UNISTD_H" $(CURSESDEF) \
@@ -527,12 +531,6 @@ conlibs = $(baselibs)
guilibs = $(winlibs)
#
!IFNDEF ADD_CURSES
INCLDIR= /I..\include /I..\sys\winnt
!ELSE
INCLDIR= /I..\include /I..\sys\winnt /I$(CURSESINCL)
!ENDIF
#==========================================
# Util builds
#==========================================
@@ -552,6 +550,10 @@ DLB = nhdat
DLB =
! ENDIF
#==========================================
#---- end of Visual Studio Specific macros
#==========================================
#==========================================
#================ RULES ==================
#==========================================
@@ -630,9 +632,6 @@ DLB =
{$(WCURSES)}.c{$(OBJ)}.o:
@$(cc) $(PDCINCL) $(cflagsBuild) -Fo$@ $<
#{$(WCURSES)}.txt{$(DAT)}.txt:
# @copy $< $@
#==========================================
# Rules for files in PDCurses
#==========================================
@@ -684,11 +683,12 @@ $(O)install.tag: $(DAT)\data $(DAT)\rumors $(DAT)\dungeon \
if exist $(DAT)\symbols copy $(DAT)\symbols $(GAMEDIR)
if exist $(DOC)\guidebook.txt copy $(DOC)\guidebook.txt $(GAMEDIR)\Guidebook.txt
if exist $(DOC)\nethack.txt copy $(DOC)\nethack.txt $(GAMEDIR)\NetHack.txt
@if exist $(GAMEDIR)\NetHack.PDB echo NOTE: You may want to remove $(GAMEDIR:\=/)/NetHack.PDB to conserve space
@if exist $(GAMEDIR)\NetHackW.PDB echo NOTE: You may want to remove $(GAMEDIR:\=/)/NetHackW.PDB to conserve space
$(U)makedefs -c
-if not exist $(GAMEDIR)\defaults.nh copy fixed_defaults.nh $(GAMEDIR)\defaults.nh
-if not exist $(GAMEDIR)\defaults.nh copy $(MSWSYS)\defaults.nh $(GAMEDIR)\defaults.nh
-if not exist $(GAMEDIR)\record. goto>$(GAMEDIR)\record.
@if exist $(GAMEDIR)\NetHack.PDB echo NOTE: You may want to remove $(GAMEDIR:\=/)/NetHack.PDB to conserve space
@if exist $(GAMEDIR)\NetHackW.PDB echo NOTE: You may want to remove $(GAMEDIR:\=/)/NetHackW.PDB to conserve space
echo install done > $@
# copy $(MSWSYS)\winnt.hlp $(GAMEDIR)
@@ -753,10 +753,10 @@ $(O)console.res: $(MSWSYS)\console.rc $(MSWSYS)\NetHack.ico
@$(rc) -r -fo$@ -i$(MSWSYS) -dNDEBUG $(MSWSYS)\console.rc
#==========================================
#==========================================================================
# The game targets.
#==========================================
#==========================================================================
#[VS-start] Visual C
# The section for linking the NetHack image looks a little strange at
# first, especially if you are used to UNIX makes, or NDMAKE. It is
# Microsoft nmake specific, and it gets around the problem of the
@@ -778,6 +778,8 @@ $(O)console.res: $(MSWSYS)\console.rc $(MSWSYS)\NetHack.ico
# with ^ as we have done below. Every occurence
# of a <tab> in $(ALLOBJ) is replaced by
# <+><return><tab>.
#[VS-end]
#==========================================================================
GAMEOBJ=$(ALLOBJ:^ =^
)
@@ -896,20 +898,14 @@ $(GAMEDIR)\nhraykey.dll : $(O)$(@B).o $(O)gamedir.tag $(O)$(@B).def
/PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).map" /DEF:$(O)$(@B).def \
/IMPLIB:$(O)$(@B).lib -out:$@ $(O)$(@B).o
#
# Secondary Targets.
#
#==========================================
#=========== SECONDARY TARGETS ============
#==========================================
#==========================================
# Makedefs Stuff
#==========================================
$(U)nhsizes.exe: $(O)nhsizes.o
@echo Linking $(@:\=/)
$(link) $(lflagsBuild) -out:$@ $(O)nhsizes.o $(O)panic.o $(O)alloc.o
$(O)nhsizes.o: $(CONFIG_H) nhsizes.c
@$(cc) $(cflagsBuild) -Fo$@ nhsizes.c
$(U)makedefs.exe: $(MAKEOBJS)
@echo Linking $(@:\=/)
@$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ $(MAKEOBJS)
@@ -1061,6 +1057,24 @@ $(U)dgncomp.exe: $(DGNCOMPOBJS)
)
<<
#=================================================
# For a couple of devteam utilities
#=================================================
$(U)nhsizes.exe: $(O)nhsizes.o
@echo Linking $(@:\=/)
$(link) $(lflagsBuild) -out:$@ $(O)nhsizes.o $(O)panic.o $(O)alloc.o
$(U)nhsizes2.exe: $(O)nhsizes2.o
@echo Linking $(@:\=/)
$(link) $(lflagsBuild) -out:$@ $(O)nhsizes2.o $(O)panic.o $(O)alloc.o
$(O)nhsizes.o: $(CONFIG_H) nhsizes.c
@$(cc) $(cflagsBuild) -Fo$@ nhsizes.c
$(O)nhsizes2.o: $(CONFIG_H) nhsizes2.c
@$(cc) $(cflagsBuild) -Fo$@ nhsizes2.c
#=================================================
# Create directory for holding object files
#=================================================
@@ -1070,34 +1084,6 @@ $(O)obj.tag:
@if not exist $(OBJ)\*.* mkdir $(OBJ)
@echo directory created >$@
#==========================================
# Notify of any CL environment variables
# in effect since they change the compiler
# options.
#==========================================
$(O)envchk.tag: $(O)obj.tag
! IF "$(TARGET_CPU)"=="x64"
@echo Windows x64 64-bit target build
! ELSE
@echo Windows x86 32-bit target build
! ENDIF
!IFDEF TTYOBJ
@echo tty window support included
! IF "$(ADD_CURSES)"=="Y"
@echo curses window support also included
! ENDIF
!ENDIF
! IF "$(CL)"!=""
# @echo Warning, the CL Environment variable is defined:
# @echo CL=$(CL)
! ENDIF
echo envchk >$@
#==========================================
#=========== SECONDARY TARGETS ============
#==========================================
#==========================================
# DLB utility and nhdat file creation
#==========================================
@@ -1259,12 +1245,36 @@ $(O)til2bm32.o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(MSWSYS)\win32api.h
@$(cc) $(cflagsBuild) -I$(WSHR) /DPACKED_FILE /DTILE_X=32 /DTILE_Y=32 /Fo$@ $(WSHR)\tile2bmp.c
#==========================================
# PDCurses
# PDCurses Library
#==========================================
$(O)\pdcurses.lib : $(PDCLIBOBJS) $(PDCOBJS)
$(O)pdcurses.lib : $(PDCLIBOBJS) $(PDCOBJS)
lib -nologo /out:$@ $(PDCLIBOBJS) $(PDCOBJS)
#==========================================
# Notify of any CL environment variables
# in effect since they change the compiler
# options.
#==========================================
$(O)envchk.tag: $(O)obj.tag
! IF "$(TARGET_CPU)"=="x64"
@echo Windows x64 64-bit target build
! ELSE
@echo Windows x86 32-bit target build
! ENDIF
!IFDEF TTYOBJ
@echo tty window support included
! IF "$(ADD_CURSES)"=="Y"
@echo curses window support also included
! ENDIF
!ENDIF
! IF "$(CL)"!=""
# @echo Warning, the CL Environment variable is defined:
# @echo CL=$(CL)
! ENDIF
echo envchk >$@
#==========================================
# Housekeeping
#==========================================
@@ -1470,6 +1480,8 @@ $(O)winhack.o: $(HACK_H) $(MSWIN)\winhack.c
$(O)ttystub.o: $(HACK_H) $(MSWSYS)\stubs.c
@$(cc) $(cflagsBuild) -DTTYSTUB -Fo$@ $(MSWSYS)\stubs.c
$(O)tile.o: $(SRC)\tile.c $(HACK_H)
#
# util dependencies
#
@@ -1483,18 +1495,21 @@ $(O)panic.o: $(U)panic.c $(CONFIG_H)
(O)cppregex.o: $(O)cppregex.cpp $(HACK_H)
@$(CC) $(cflagsBuild) -Fo$@ ..\sys\share\cppregex.cpp
#
# curses window port dependencies
#
$(O)\cursdial.o: $(WCURSES)\cursdial.c $(WCURSES)\cursdial.h $(INCL)\wincurs.h
$(O)\cursinit.c: $(WCURSES)\cursinit.c $(WCURSES)\cursinit.h $(INCL)\wincurs.h
$(O)\cursinvt.c: $(WCURSES)\cursinvt.c $(WCURSES)\cursinvt.h $(INCL)\wincurs.h
$(O)\cursmain.c: $(WCURSES)\cursmain.c $(WCURSES)\cursmain.h $(INCL)\wincurs.h
$(O)\cursmesg.c: $(WCURSES)\cursmesg.c $(WCURSES)\cursmesg.h $(INCL)\wincurs.h
$(O)\cursmisc.c: $(WCURSES)\cursmisc.c $(WCURSES)\cursmisc.h $(INCL)\wincurs.h
$(O)\cursstat.c: $(WCURSES)\cursstat.c $(WCURSES)\cursstat.h $(INCL)\wincurs.h
$(O)\curswins.c: $(WCURSES)\curswins.c $(WCURSES)\curswins.h $(INCL)\wincurs.h
# Other dependencies needed by some ports
#
# curses window port dependencies
$(O)cursdial.o: $(WCURSES)\cursdial.c $(WCURSES)\cursdial.h $(INCL)\wincurs.h
$(O)cursinit.c: $(WCURSES)\cursinit.c $(WCURSES)\cursinit.h $(INCL)\wincurs.h
$(O)cursinvt.c: $(WCURSES)\cursinvt.c $(WCURSES)\cursinvt.h $(INCL)\wincurs.h
$(O)cursmain.c: $(WCURSES)\cursmain.c $(WCURSES)\cursmain.h $(INCL)\wincurs.h
$(O)cursmesg.c: $(WCURSES)\cursmesg.c $(WCURSES)\cursmesg.h $(INCL)\wincurs.h
$(O)cursmisc.c: $(WCURSES)\cursmisc.c $(WCURSES)\cursmisc.h $(INCL)\wincurs.h
$(O)cursstat.c: $(WCURSES)\cursstat.c $(WCURSES)\cursstat.h $(INCL)\wincurs.h
$(O)curswins.c: $(WCURSES)\curswins.c $(WCURSES)\curswins.h $(INCL)\wincurs.h
#
# The rest are stolen from sys/unix/Makefile.src,
# with the following changes:
@@ -1567,7 +1582,6 @@ $(O)wintext.o: ..\win\X11\wintext.c $(HACK_H) $(INCL)\winX.h $(INCL)\xwindow.h
@$(CC) $(cflagsBuild) -Fo$@ ..\win\X11\wintext.c
$(O)winval.o: ..\win\X11\winval.c $(HACK_H) $(INCL)\winX.h
@$(CC) $(cflagsBuild) -Fo$@ ..\win\X11\winval.c
$(O)tile.o: $(SRC)\tile.c $(HACK_H)
$(O)gnaskstr.o: ..\win\gnome\gnaskstr.c ..\win\gnome\gnaskstr.h \
..\win\gnome\gnmain.h
@$(CC) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnaskstr.c