]> granicus.if.org Git - nethack/commitdiff
expand sys/unix Makefiles scope
authornhmall <nhmall@nethack.org>
Mon, 28 Sep 2020 20:25:31 +0000 (16:25 -0400)
committernhmall <nhmall@nethack.org>
Mon, 28 Sep 2020 20:25:31 +0000 (16:25 -0400)
Expand the use of the sys/unix Makefiles to be used for both normal
local builds and installs, as well as cross-compiles for other
platforms/targets.

Up until now, the primary unix Makefiles have treated util/host-side
component compiles, links and target object files just the same as
the game component compiles, links, and target object files.

Unfortunately, that meant that cross-compile effort typically had
to re-invent Makefiles specific to the cross-compile, creating a
maintenance burden and deviation from the typical local unix build
and providing a daunting obstacle to those that want to establish
build for a target environment/platform.

This change distinguishes between util/host-side component builds,
links, and component builds and targets object files destined for
the game (and other target platforms) in the Makefiles.

In theory, this will ease the effort for people that want to try to
resurrect NetHack perhaps on an old platform where it is no longer
viable to build NetHack-3.7 on the platform itself using old, outdated
compile tools, possibly with an old, outdated C dialect.

Some details:

-  Game-related targets in the Makefiles (as opposed to util/host-side
   targets that will be executed on the host), which could be destined
   for another platform in a cross-compile scenario are prefixed with
   $(TARGETPFX) so that they are distinguished.

   The default scenario where no cross-compiler is involved, is to
   define TARGETPFX to nothing, and therefore meant to have no effect.

-  Game-related compile and link commands in the Makefiles and their
   associated command line flags are distinguished from util/host-side
   compile and link commands in the Makefiles by using $(TARGET_CC),
   $(TARGET_CFLAGS), $(TARGET_LINK), $(TARGET_LFLAGS), $(TARGET_CXX),
   $(TARGET_CXXFLAGS), $(TARGET_LIBS).

   Those are used in the Makefile in place of $(CC), $(CFLAGS), $(LINK),
   $(LFLAGS), $(CXX), $(CXXFLAGS), $(LIBS).

   The default scenario where no cross-compiler is involved, defines
   the TARGET_ version of those Makefile variables to match their
   typical non-TARGET_ ounterparts.

-  The dependency lists in the Makefiles includes the $(TARGETPFX)
   prefix for stuff that would potentially be produced from a
   cross-compile build.

-  It adds pregame targets and $(PREGAME) variable, so that hints files
   can add some additional stuff if required for a cross-compile
   scenario.

   The default scenario where no cross-compiler is involved doesn't
   do anything for $(PREGAME).

-  It adds $(BUILDMORE) target and variable, so that hints files
   can add some additional things to be built for a cross-compile
   scenario.

-  It adds a "package" target and $(PACKAGE) variable, so that hints files
   can add steps for the target platform in a cross-compile
   scenario.

   The "install" target assumes local build and placement and
   isn't really applicable to a cross-compile scenario where the results
   really just need to be bundled up for transport to the target platform.

-  Also, this adds a pair of include files that can be updated with some
   cross-compile recipes as they evolve. They are named "cross-pre.2020"
   (for stuff to be included in the PRE section) and "cross-post.2020"
   for stuff to be included in the POST section via sys/unix/setup.sh.

   Those are included in sys/unix/hints/linux.2020 and
   sys/unix/hints/macOS.2020 hints files.

13 files changed:
include/config1.h
include/global.h
include/system.h
src/options.c
sys/unix/Makefile.src
sys/unix/Makefile.top
sys/unix/Makefile.utl
sys/unix/depend.awk
sys/unix/hints/include/cross-post.2020 [new file with mode: 0644]
sys/unix/hints/include/cross-pre.2020 [new file with mode: 0644]
sys/unix/hints/linux.2020
sys/unix/hints/macOS.2020
sys/unix/mkmkfile.sh

index 986a710c1bd3a9853c681a2943bb5617639f87e8..e93b98d22cd87ce415b3a942c516090d48e247e2 100644 (file)
 
 #ifdef MSDOS
 #undef UNIX
+#ifndef CROSSCOMPILE
 #define SHORT_FILENAMES
 #endif
+#endif
 
 /*
  * Mac Stuff.
index 20939108d4b96416ee029dfe86cd62e06f520f46..af46502d0c4ae97cbe917f762b1aac1b821ee030 100644 (file)
@@ -213,11 +213,13 @@ extern struct cross_target_s cross_target;
 #endif
 #endif
 
+#if !defined(CROSSCOMPILE)
 #if defined(MICRO)
 #if !defined(AMIGA) && !defined(TOS) && !defined(OS2_HPFS)
 #define SHORT_FILENAMES /* filenames are 8.3 */
 #endif
 #endif
+#endif
 
 #ifdef VMS
 /* vms_exit() (sys/vms/vmsmisc.c) expects the non-VMS EXIT_xxx values below.
index 07c6395748b87a1988e3535f21a83bc53ddb3f72..ead454d698ba55a8e5426c87aa95205ed848113a 100644 (file)
@@ -339,7 +339,7 @@ E int FDECL(memcmp, (const void *, const void *, size_t));
 E void *FDECL(memcpy, (void *, const void *, size_t));
 E void *FDECL(memset, (void *, int, size_t));
 #else
-#if defined(AZTEC_50) || defined(NHSTDC))
+#if defined(AZTEC_50) || defined(NHSTDC)
 E int FDECL(memcmp, (const void *, const void *, size_t));
 E void *FDECL(memcpy, (void *, const void *, size_t));
 E void *FDECL(memset, (void *, int, size_t));
index 199fa3ca0b4a32dae56fc22cdef7b3b6945d8c3e..f505b55233ad79a62181e7fea2869ffb6ae4b142 100644 (file)
@@ -1450,14 +1450,15 @@ char *op;
             if (g.symset[PRIMARY].name) {
                 badflag = TRUE;
             } else {
-                g.symset[PRIMARY].name = dupstr(fullname);
+                g.symset[PRIMARY].name = dupstr(allopt[optidx].name);
                 if (!read_sym_file(PRIMARY)) {
                     badflag = TRUE;
                     clear_symsetentry(PRIMARY, TRUE);
                 }
             }
             if (badflag) {
-                config_error_add("Failure to load symbol set %s.", fullname);
+                config_error_add("Failure to load symbol set %s.",
+                                allopt[optidx].name);
                 return FALSE;
             } else {
                 switch_symbols(TRUE);
@@ -2440,6 +2441,7 @@ char *op;
             if (!g.opt_initial) {
                 g.opt_need_redraw = TRUE;
             }
+        }
 #endif /* CHANGE_COLOR */
             return optn_ok;
     }
@@ -2455,6 +2457,7 @@ char *op;
     return optn_ok;
 }
 
+
 int
 optfn_paranoid_confirmation(optidx, req, negated, opts, op)
 int optidx;
index 790084bd3843306a1196e35fc11e409326d0b2c7..cc69e6f5ff70f01dc6f6a1a0a06e9330bac3bdd6 100644 (file)
@@ -43,22 +43,29 @@ SHELL=/bin/sh
 # Usually, the C compiler driver is used for linking:
 #LINK=$(CC)
 
+# If we're cross-compiling, a hints file will override this
+# to a uniq target directory, but otherwise it just goes in
+# ../src
+TARGETPFX=
+
 # Pick the SYSSRC and SYSOBJ lines corresponding to your desired operating
 # system.
 #
 # for UNIX systems
 SYSSRC = ../sys/share/ioctl.c ../sys/share/unixtty.c ../sys/unix/unixmain.c \
        ../sys/unix/unixunix.c ../sys/unix/unixres.c
-SYSOBJ = ioctl.o unixmain.o unixtty.o unixunix.o unixres.o
+SYSOBJ = $(TARGETPFX)ioctl.o $(TARGETPFX)unixmain.o $(TARGETPFX)unixtty.o \
+       $(TARGETPFX)unixunix.o $(TARGETPFX)unixres.o
 #
 # for Systos
 # SYSSRC = ../sys/atari/tos.c ../sys/share/pcmain.c ../sys/share/pcsys.c \
 #      ../sys/share/pctty.c ../sys/share/pcunix.c
-# SYSOBJ = tos.o pcmain.o pcsys.o pctty.o pcunix.o
+# SYSOBJ = $(TARGETPFX)tos.o $(TARGETPFX)pcmain.o $(TARGETPFX)pcsys.o \
+#      $(TARGETPFX)pctty.o $(TARGETPFX)pcunix.o
 #
 # for BeOS
 #SYSSRC = ../sys/be/bemain.c ../sys/share/unixtty.c ../sys/share/ioctl.c
-#SYSOBJ = bemain.o unixtty.o ioctl.o
+#SYSOBJ = $(TARGETPFX)bemain.o $(TARGETPFX)unixtty.o $(TARGETPFX)ioctl.o
 
 
 # if you are using gcc as your compiler:
@@ -153,7 +160,7 @@ SYSOBJ = ioctl.o unixmain.o unixtty.o unixunix.o unixres.o
 #CFLAGS = -O -DXCURSES -I../include -I/usr/local/include/pdcurses
 # Compile against system curses library, such as ncurses
 #CFLAGS = -O -I../include
-
+#
 # files in ../win/X11 (relative to src) are passed $(CFLAGS) $(X11CFLAGS)
 # and by default will find <X11/foo.h> in /usr/include/X11/foo.h;
 # can be overridden via hints; post-10.7 OSX with XQuartz uses
@@ -180,9 +187,17 @@ CXXFLAGS = $(CFLAGS) -I. -I$(QTDIR)/include $(QTCXXFLAGS)
 CXX ?= g++
 MOC ?= moc
 #LINK=g++
-#      For cross-compiling, eg. with gcc on Linux (see also CC further up):
-#CXX=arm-linux-g++
-#LINK=arm-linux-gcc
+
+# The default is for the TARGET_* variables to match the defaults.
+# If we're cross-compiling these will get overridden elsewhere, likely via
+# a hints file. TARGETPFX was set above earlier.
+TARGET_CC = $(CC)
+TARGET_CFLAGS = $(CFLAGS)
+TARGET_LINK = $(LINK)
+TARGET_LFLAGS = $(LFLAGS)
+TARGET_CXX = $(CXX)
+TARGET_CXXFLAGS = $(CXXFLAGS)
+TARGET_LIBS = $(LIBS)
 
 # we specify C preprocessor flags via CFLAGS; files built with default rules
 # might include $(CPPFLAGS) which could get a value from user's environment;
@@ -190,9 +205,9 @@ MOC ?= moc
 CPPFLAGS =
 
 # file for regular expression matching
-REGEXOBJ = posixregex.o
-#REGEXOBJ = pmatchregex.o
-#REGEXOBJ = cppregex.o
+REGEXOBJ = $(TARGETPFX)posixregex.o
+#REGEXOBJ = $(TARGETPFX)pmatchregex.o
+#REGEXOBJ = $(TARGETPFX)cppregex.o
 
 # Set the WINSRC, WINOBJ, and WINLIB lines to correspond to your desired
 # combination of windowing systems.  Also set windowing systems in config.h.
@@ -202,15 +217,18 @@ REGEXOBJ = posixregex.o
 # files for a straight tty port using no native windowing system
 WINTTYSRC = ../win/tty/getline.c ../win/tty/termcap.c ../win/tty/topl.c \
        ../win/tty/wintty.c
-WINTTYOBJ = getline.o termcap.o topl.o wintty.o
+WINTTYOBJ = $(TARGETPFX)getline.o $(TARGETPFX)termcap.o $(TARGETPFX)topl.o \
+       $(TARGETPFX)wintty.o
 #
 # Files for curses interface
 WINCURSESSRC = ../win/curses/cursmain.c ../win/curses/curswins.c \
        ../win/curses/cursmisc.c ../win/curses/cursdial.c \
        ../win/curses/cursstat.c ../win/curses/cursinit.c \
        ../win/curses/cursmesg.c ../win/curses/cursinvt.c
-WINCURSESOBJ = cursmain.o curswins.o cursmisc.o cursdial.o cursstat.o \
-       cursinit.o cursmesg.o cursinvt.o
+WINCURSESOBJ = $(TARGETPFX)cursmain.o $(TARGETPFX)curswins.o \
+       $(TARGETPFX)cursmisc.o $(TARGETPFX)cursdial.o \
+       $(TARGETPFX)cursstat.o $(TARGETPFX)cursinit.o \
+       $(TARGETPFX)cursmesg.o $(TARGETPFX)cursinvt.o
 #
 # files for an X11 port
 # (tile.c is a generated source file)
@@ -218,14 +236,17 @@ WINX11SRC = ../win/X11/Window.c ../win/X11/dialogs.c ../win/X11/winX.c \
        ../win/X11/winmap.c  ../win/X11/winmenu.c ../win/X11/winmesg.c \
        ../win/X11/winmisc.c ../win/X11/winstat.c ../win/X11/wintext.c \
        ../win/X11/winval.c tile.c
-WINX11OBJ = Window.o dialogs.o winX.o winmap.o winmenu.o winmesg.o \
-       winmisc.o winstat.o wintext.o winval.o tile.o
+WINX11OBJ = $(TARGETPFX)Window.o $(TARGETPFX)dialogs.o $(TARGETPFX)winX.o \
+       $(TARGETPFX)winmap.o $(TARGETPFX)winmenu.o $(TARGETPFX)winmesg.o \
+       $(TARGETPFX)winmisc.o $(TARGETPFX)winstat.o $(TARGETPFX)wintext.o \
+       $(TARGETPFX)winval.o $(TARGETPFX)tile.o
 #
 # Files for a Qt 3 port (renamed since nethack 3.6.x)
 #
 #WINQT3SRC = ../win/Qt3/qt3_win.cpp ../win/Qt3/qt3_clust.cpp \
 #      ../win/Qt3/qt3tableview.cpp
-#WINQT3OBJ = qt3_win.o qt3_clust.o qt3tableview.o tile.o
+#WINQT3OBJ = $(TARGETPFX)qt3_win.o $(TARGETPFX)qt3_clust.o \
+       $(TARGETPFX)qt3tableview.o $(TARGETPFX)tile.o
 # empty values for 'make depend'
 WINQT3SRC =
 WINQT3OBJ =
@@ -242,10 +263,15 @@ WINQTSRC = ../win/Qt/qt_bind.cpp ../win/Qt/qt_click.cpp \
        ../win/Qt/qt_stat.cpp ../win/Qt/qt_str.cpp ../win/Qt/qt_streq.cpp \
        ../win/Qt/qt_svsel.cpp ../win/Qt/qt_win.cpp ../win/Qt/qt_xcmd.cpp \
        ../win/Qt/qt_yndlg.cpp
-WINQTOBJ = qt_bind.o qt_click.o qt_clust.o qt_delay.o qt_glyph.o qt_icon.o \
-       qt_inv.o qt_key.o qt_line.o qt_main.o qt_map.o qt_menu.o qt_msg.o \
-       qt_plsel.o qt_rip.o qt_set.o qt_stat.o qt_str.o qt_streq.o qt_svsel.o \
-       qt_win.o qt_xcmd.o qt_yndlg.o tile.o
+WINQTOBJ = $(TARGETPFX)qt_bind.o $(TARGETPFX)qt_click.o \
+       $(TARGETPFX)qt_clust.o $(TARGETPFX)qt_delay.o \
+       $(TARGETPFX)qt_glyph.o $(TARGETPFX)qt_icon.o \
+       $(TARGETPFX)qt_inv.o $(TARGETPFX)qt_key.o $(TARGETPFX)qt_line.o \
+       $(TARGETPFX)qt_main.o $(TARGETPFX)qt_map.o $(TARGETPFX)qt_menu.o \
+       $(TARGETPFX)qt_msg.o $(TARGETPFX)qt_plsel.o $(TARGETPFX)qt_rip.o \
+       $(TARGETPFX)qt_set.o $(TARGETPFX)qt_stat.o $(TARGETPFX)qt_str.o \
+       $(TARGETPFX)qt_streq.o $(TARGETPFX)qt_svsel.o $(TARGETPFX)qt_win.o \
+       $(TARGETPFX)qt_xcmd.o $(TARGETPFX)qt_yndlg.o $(TARGETPFX)tile.o
 #
 # Files for a Gnome port
 #
@@ -255,9 +281,11 @@ WINQTOBJ = qt_bind.o qt_click.o qt_clust.o qt_delay.o qt_glyph.o qt_icon.o \
 #      ../win/gnome/gnplayer.c ../win/gnome/gnsignal.c \
 #      ../win/gnome/gnstatus.c ../win/gnome/gntext.c ../win/gnome/gnyesno.c \
 #      ../win/gnome/gnworn.c
-#WINGNOMEOBJ = gnaskstr.o gnbind.o gnglyph.o gnmain.o gnmap.o gnmenu.o \
-#      gnmesg.o gnopts.o gnplayer.o gnsignal.o gnstatus.o gntext.o \
-#      gnyesno.o gnworn.o tile.o
+#WINGNOMEOBJ = $(TARGETPFX)gnaskstr.o $(TARGETPFX)gnbind.o $(TARGETPFX)gnglyph.o \
+#      $(TARGETPFX)gnmain.o $(TARGETPFX)gnmap.o $(TARGETPFX)gnmenu.o \
+#      $(TARGETPFX)gnmesg.o $(TARGETPFX)gnopts.o $(TARGETPFX)gnplayer.o \
+#      $(TARGETPFX)gnsignal.o $(TARGETPFX)gnstatus.o $(TARGETPFX)gntext.o \
+#      $(TARGETPFX)gnyesno.o $(TARGETPFX)gnworn.o $(TARGETPFX)tile.o
 # empty values for 'make depend'
 WINGNOMESRC =
 WINGNOMEOBJ =
@@ -266,7 +294,8 @@ WINGNOMEOBJ =
 # Files for a Gem port
 #WINGEMSRC = ../win/gem/wingem.c ../win/gem/wingem1.c ../win/gem/load_img.c \
 #      ../win/gem/gr_rect.c tile.c
-#WINGEMOBJ = wingem.o wingem1.o load_img.o gr_rect.o tile.o
+#WINGEMOBJ = $(TARGETPFX)wingem.o $(TARGETPFX)wingem1.o \
+#      $(TARGETPFX)load_img.o $(TARGETPFX)gr_rect.o $(TARGETPFX)tile.o
 # empty values for 'make depend'
 WINGEMSRC =
 WINGEMOBJ =
@@ -277,7 +306,9 @@ WINBESRC =
 WINBEOBJ =
 #WINBESRC = ../win/BeOS/winbe.cpp ../win/BeOS/NHWindow.cpp \
 #      ../win/BeOS/NHMenuWindow.cpp ../win/BeOS/NHMapWindow.cpp tile.c
-#WINBEOBJ = winbe.o NHWindow.o NHMenuWindow.o NHMapWindow.o tile.o
+#WINBEOBJ = $(TARGETPFX)winbe.o $(TARGETPFX)NHWindow.o \
+#      $(TARGETPFX)NHMenuWindow.o $(TARGETPFX)NHMapWindow.o \
+#      $(TARGETPFX)tile.o
 #
 #
 #WINSRC = $(WINTTYSRC)
@@ -345,6 +376,9 @@ WINCURSESLIB = -lncurses
 # For Curses
 #WINLIB = $(WINCURSESLIB)
 #
+# some platforms need to build the support libraries
+# BUILDMORE = $(TARGETPFX)pdcurses.a
+
 # any other strange libraries your system needs (for Sysunix only -- the more
 # specialized targets should already be right)
 #
@@ -378,10 +412,11 @@ WINCURSESLIB = -lncurses
 # make NetHack
 GAME     = nethack
 # GAME     = nethack.prg
+GAMEBIN = $(GAME)
 
 # if you defined RANDOM in unixconf.h since your system did not come
 # with a reasonable random number generator
-# RANDOBJ = random.o
+# RANDOBJ = $(TARGETPFX)random.o
 RANDOBJ =
 
 
@@ -412,6 +447,10 @@ QUIETCC=0
 # Other things that have to be reconfigured are in config.h,
 # {unixconf.h, pcconf.h}, and possibly system.h
 
+# Add rule for possible cross-compiler
+$(TARGETPFX)%.o : %.c
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ $<
+
 # Verbosity definitions, begin
 #   Set QUIETCC=1 above to output less feedback while building.
 #   CC and CXX obey verbosity, LD and LINK don't.
@@ -492,7 +531,8 @@ WINCXXSRC = $(WINQTSRC) $(WINQT3SRC) $(WINBESRC)
 # Files for window system chaining. Requires SYSCF; include via HINTSRC/HINTOBJ
 CHAINSRC = ../win/chain/wc_chainin.c ../win/chain/wc_chainout.c \
           ../win/chain/wc_trace.c
-CHAINOBJ = wc_chainin.o wc_chainout.o wc_trace.o
+CHAINOBJ = $(TARGETPFX)wc_chainin.o $(TARGETPFX)wc_chainout.o \
+       $(TARGETPFX)wc_trace.o
 
 # .c files for this version (for date.h)
 VERSOURCES = $(HACKCSRC) $(SYSSRC) $(WINSRC) $(CHAINSRC) $(GENCSRC)
@@ -519,64 +559,95 @@ HACKINCL = align.h artifact.h artilist.h attrib.h botl.h \
 HSOURCES = $(HACKINCL) date.h onames.h pm.h vis_tab.h dgn_file.h
 
 # the following .o's _must_ be made before any others (for makedefs)
-FIRSTOBJ = monst.o objects.o
-
-HOBJ = $(FIRSTOBJ) allmain.o alloc.o apply.o artifact.o attrib.o ball.o \
-       bones.o botl.o cmd.o dbridge.o decl.o detect.o dig.o display.o dlb.o \
-       do.o do_name.o do_wear.o dog.o dogmove.o dokick.o dothrow.o \
-       drawing.o dungeon.o eat.o end.o engrave.o exper.o explode.o \
-       extralev.o files.o fountain.o hack.o hacklib.o \
-       insight.o invent.o isaac64.o \
-       light.o lock.o mail.o makemon.o mapglyph.o mcastu.o mdlib.o mhitm.o \
-       mhitu.o minion.o mklev.o mkmap.o mkmaze.o mkobj.o mkroom.o mon.o \
-       mondata.o monmove.o mplayer.o mthrowu.o muse.o music.o \
-       nhlua.o nhlsel.o nhlobj.o o_init.o objnam.o options.o \
-       pager.o pickup.o pline.o polyself.o potion.o pray.o priest.o \
-       quest.o questpgr.o read.o rect.o region.o restore.o rip.o rnd.o \
-       role.o rumors.o save.o sfstruct.o \
-       shk.o shknam.o sit.o sounds.o sp_lev.o spell.o symbols.o sys.o \
-       steal.o steed.o teleport.o timeout.o topten.o track.o trap.o u_init.o \
-       uhitm.o vault.o vision.o vis_tab.o weapon.o were.o wield.o windows.o \
-       wizard.o worm.o worn.o write.o zap.o \
-       $(REGEXOBJ) $(RANDOBJ) $(SYSOBJ) $(WINOBJ) $(HINTOBJ) version.o
+HOSTOBJ = monst.o objects.o alloc.o drawing.o
+
+HOBJ = $(TARGETPFX)allmain.o $(TARGETPFX)alloc.o \
+       $(TARGETPFX)apply.o $(TARGETPFX)artifact.o $(TARGETPFX)attrib.o \
+       $(TARGETPFX)ball.o $(TARGETPFX)bones.o $(TARGETPFX)botl.o \
+       $(TARGETPFX)cmd.o $(TARGETPFX)dbridge.o $(TARGETPFX)decl.o \
+       $(TARGETPFX)detect.o $(TARGETPFX)dig.o $(TARGETPFX)display.o \
+       $(TARGETPFX)dlb.o $(TARGETPFX)do.o $(TARGETPFX)do_name.o \
+       $(TARGETPFX)do_wear.o $(TARGETPFX)dog.o $(TARGETPFX)dogmove.o \
+       $(TARGETPFX)dokick.o $(TARGETPFX)dothrow.o $(TARGETPFX)drawing.o \
+       $(TARGETPFX)dungeon.o $(TARGETPFX)eat.o $(TARGETPFX)end.o \
+       $(TARGETPFX)engrave.o $(TARGETPFX)exper.o $(TARGETPFX)explode.o \
+       $(TARGETPFX)extralev.o $(TARGETPFX)files.o $(TARGETPFX)fountain.o \
+       $(TARGETPFX)hack.o $(TARGETPFX)hacklib.o $(TARGETPFX)insight.o \
+       $(TARGETPFX)invent.o $(TARGETPFX)isaac64.o $(TARGETPFX)light.o \
+       $(TARGETPFX)lock.o $(TARGETPFX)mail.o $(TARGETPFX)makemon.o \
+       $(TARGETPFX)mapglyph.o $(TARGETPFX)mcastu.o $(TARGETPFX)mdlib.o \
+       $(TARGETPFX)mhitm.o $(TARGETPFX)mhitu.o $(TARGETPFX)minion.o \
+       $(TARGETPFX)mklev.o $(TARGETPFX)mkmap.o $(TARGETPFX)mkmaze.o \
+       $(TARGETPFX)mkobj.o $(TARGETPFX)mkroom.o $(TARGETPFX)mon.o \
+       $(TARGETPFX)mondata.o $(TARGETPFX)monmove.o $(TARGETPFX)monst.o \
+       $(TARGETPFX)mplayer.o $(TARGETPFX)mthrowu.o $(TARGETPFX)muse.o \
+       $(TARGETPFX)music.o $(TARGETPFX)nhlua.o $(TARGETPFX)nhlsel.o \
+       $(TARGETPFX)nhlobj.o $(TARGETPFX)objects.o $(TARGETPFX)o_init.o \
+       $(TARGETPFX)objnam.o $(TARGETPFX)options.o $(TARGETPFX)pager.o \
+       $(TARGETPFX)pickup.o $(TARGETPFX)pline.o $(TARGETPFX)polyself.o \
+       $(TARGETPFX)potion.o $(TARGETPFX)pray.o $(TARGETPFX)priest.o \
+       $(TARGETPFX)quest.o $(TARGETPFX)questpgr.o $(TARGETPFX)read.o \
+       $(TARGETPFX)rect.o $(TARGETPFX)region.o $(TARGETPFX)restore.o \
+       $(TARGETPFX)rip.o $(TARGETPFX)rnd.o $(TARGETPFX)role.o \
+       $(TARGETPFX)rumors.o $(TARGETPFX)save.o $(TARGETPFX)sfstruct.o \
+       $(TARGETPFX)shk.o $(TARGETPFX)shknam.o $(TARGETPFX)sit.o \
+       $(TARGETPFX)sounds.o $(TARGETPFX)sp_lev.o $(TARGETPFX)spell.o \
+       $(TARGETPFX)symbols.o $(TARGETPFX)sys.o $(TARGETPFX)steal.o \
+       $(TARGETPFX)steed.o $(TARGETPFX)teleport.o $(TARGETPFX)timeout.o \
+       $(TARGETPFX)topten.o $(TARGETPFX)track.o $(TARGETPFX)trap.o \
+       $(TARGETPFX)u_init.o $(TARGETPFX)uhitm.o $(TARGETPFX)vault.o \
+       $(TARGETPFX)vision.o $(TARGETPFX)vis_tab.o $(TARGETPFX)weapon.o \
+       $(TARGETPFX)were.o $(TARGETPFX)wield.o $(TARGETPFX)windows.o \
+       $(TARGETPFX)wizard.o $(TARGETPFX)worm.o $(TARGETPFX)worn.o \
+       $(TARGETPFX)write.o $(TARGETPFX)zap.o \
+       $(REGEXOBJ) $(RANDOBJ) $(SYSOBJ) $(WINOBJ) $(HINTOBJ) \
+       $(TARGETPFX)version.o
 # the .o files from the HACKCSRC, SYSSRC, and WINSRC lists
 
 # first target is also the default target for 'make' without any arguments
 all:   $(GAME)
        @echo ""
 
-$(GAME):       $(SYSTEM)
+pregame:
+       true; $(PREGAME)
+
+$(GAME):       pregame $(SYSTEM)
        @echo "$(GAME) is up to date."
 
-Sysunix:       $(HOBJ) Makefile
+Sysunix:       $(HOSTOBJ) $(HOBJ) $(BUILDMORE) Makefile
        @echo "Linking $(GAME)."
-       $(AT)$(LINK) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) $(LIBS) $(LUALIB)
+       $(AT)$(TARGET_LINK) $(TARGET_LFLAGS) -o $(GAMEBIN) \
+               $(HOBJ) $(WINLIB) $(TARGET_LIBS) $(LUALIB)
        @touch Sysunix
 
-Sys3B2:        $(HOBJ) Makefile
+Sys3B2:        $(HOSTOBJ) $(HOBJ) $(BUILDMORE) Makefile
        @echo "Linking $(GAME)."
-       $(AT)$(LINK) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) $(LUALIB) -lmalloc
+       $(AT)$(TARGET_LINK) $(TARGET_LFLAGS) -o $(GAMEBIN) \
+               $(HOBJ) $(WINLIB) $(LUALIB) -lmalloc
        @touch Sys3B2
 
-Sysatt:        $(HOBJ) Makefile
+Sysatt:        $(HOSTOBJ) $(HOBJ) $(BUILDMORE) Makefile
        @echo "Loading $(GAME)."
-       $(AT)$(LD) $(LFLAGS) /lib/crt0s.o /lib/shlib.ifile -o $(GAME) $(HOBJ) \
-               $(LUALIB)
+       $(AT)$(LD) $(TARGET_LFLAGS) /lib/crt0s.o /lib/shlib.ifile -o $(GAMEBIN) \
+               $(HOSTOBJ) $(HOBJ) $(LUALIB)
        @touch Sysatt
 
-Systos:        $(HOBJ) Makefile
+Systos:        $(HOSTOBJ) $(HOBJ) $(BUILDMORE) Makefile
        @echo "Linking $(GAME)."
-       $(AT)$(LINK) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) $(LUALIB)
+       $(AT)$(TARGET_LINK) $(TARGET_LFLAGS) -o $(GAMEBIN) \
+               $(HOBJ) $(WINLIB) $(LUALIB)
        @touch Systos
 
-SysV-AT:       DUMB.Setup $(HOBJ) Makefile
+SysV-AT:       DUMB.Setup $(HOSTOBJ) $(HOBJ) $(BUILDMORE) Makefile
        @echo "Linking $(GAME)."
-       $(AT)$(LINK) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) $(LUALIB)
+       $(AT)$(TARGET_LINK) $(TARGET_LFLAGS) -o $(GAMEBIN) \
+               $(HOBJ) $(WINLIB) $(LUALIB)
        @touch SysV-AT
 
-SysBe: $(HOBJ) Makefile
+SysBe: $(HOSTOBJ) $(HOBJ) $(BUILDMORE) Makefile
        @echo "Linking $(GAME)."
-       $(AT)$(LINK) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) $(LIBS) $(LUALIB)
+       $(AT)$(TARGET_LINK) $(TARGET_LFLAGS) -o $(GAME) \
+               $(HOBJ) $(WINLIB) $(TARGET_LIBS) $(LUALIB)
        @xres -o $(GAME) ../win/BeOS/nethack.rsrc
        @mimeset -f $(GAME)
        @touch SysBe
@@ -611,11 +682,11 @@ DUMB.Setup:       ../include/extern.h
 # special rules, to force update of makedefs, real dependencies should be
 # below in the 'make depend' output.
 monst.o:
-       $(CC) $(CFLAGS) -c monst.c
+       $(CC) $(CFLAGS) -c -o $@ monst.c
        @rm -f $(MAKEDEFS)
 
 objects.o:
-       $(CC) $(CFLAGS) -c objects.c
+       $(CC) $(CFLAGS) -c -o $@ objects.c
        @rm -f $(MAKEDEFS)
 
 # Qt 3 windowport meta-object-compiler output
@@ -680,7 +751,7 @@ tile.c: ../win/share/tilemap.c $(HACK_H)
 ../win/gnome/gn_rip.h: ../win/X11/rip.xpm
        cp ../win/X11/rip.xpm ../win/gnome/gn_rip.h
 
-sfstruct.o: sfstruct.c $(HACK_H)
+$(TARGETPFX)sfstruct.o: sfstruct.c $(HACK_H)
 
 #      date.h should be remade any time any of the source or include code
 #      is modified.  Unfortunately, this would make the contents of this
@@ -713,14 +784,18 @@ tags: $(CSOURCES)
 
 clean:
        -rm -f *.o $(HACK_H) $(CONFIG_H)
+       true; $(CLEANMORE)
 
 spotless: clean
-       -rm -f a.out core $(GAME) Sys*
+       -rm -f a.out core $(GAMEBIN) Sys*
        -rm -f ../lib/lua/liblua.a ../include/nhlua.h
        -rm -f ../include/date.h ../include/onames.h ../include/pm.h
        -rm -f ../include/vis_tab.h vis_tab.c tile.c *.moc
        -rm -f ../win/gnome/gn_rip.h
 
+package:
+       true; $(PACKAGE)
+       @echo packaging complete.
 
 depend: ../sys/unix/depend.awk \
                $(SYSCSRC) $(WINCSRC) $(SYSCXXSRC) $(WINCXXSRC) \
@@ -766,92 +841,98 @@ $(HACK_H): ../include/hack.h $(CONFIG_H) ../include/lint.h ../include/align.h \
                ../include/sys.h ../include/wintty.h ../include/trampoli.h
        touch $(HACK_H)
 #
-pcmain.o: ../sys/share/pcmain.c $(HACK_H) ../include/dlb.h
-       $(CC) $(CFLAGS) -c -o $@ ../sys/share/pcmain.c
-pcsys.o: ../sys/share/pcsys.c $(HACK_H)
-       $(CC) $(CFLAGS) -c -o $@ ../sys/share/pcsys.c
-pctty.o: ../sys/share/pctty.c $(HACK_H)
-       $(CC) $(CFLAGS) -c -o $@ ../sys/share/pctty.c
-pcunix.o: ../sys/share/pcunix.c $(HACK_H)
-       $(CC) $(CFLAGS) -c -o $@ ../sys/share/pcunix.c
-pmatchregex.o: ../sys/share/pmatchregex.c $(HACK_H)
-       $(CC) $(CFLAGS) -c -o $@ ../sys/share/pmatchregex.c
-posixregex.o: ../sys/share/posixregex.c $(HACK_H)
-       $(CC) $(CFLAGS) -c -o $@ ../sys/share/posixregex.c
-random.o: ../sys/share/random.c $(HACK_H)
-       $(CC) $(CFLAGS) -c -o $@ ../sys/share/random.c
-ioctl.o: ../sys/share/ioctl.c $(HACK_H) ../include/tcap.h
-       $(CC) $(CFLAGS) -c -o $@ ../sys/share/ioctl.c
-unixtty.o: ../sys/share/unixtty.c $(HACK_H)
-       $(CC) $(CFLAGS) -c -o $@ ../sys/share/unixtty.c
-unixmain.o: ../sys/unix/unixmain.c $(HACK_H) ../include/dlb.h
-       $(CC) $(CFLAGS) -c -o $@ ../sys/unix/unixmain.c
-unixunix.o: ../sys/unix/unixunix.c $(HACK_H)
-       $(CC) $(CFLAGS) -c -o $@ ../sys/unix/unixunix.c
-unixres.o: ../sys/unix/unixres.c $(CONFIG_H)
-       $(CC) $(CFLAGS) -c -o $@ ../sys/unix/unixres.c
-getline.o: ../win/tty/getline.c $(HACK_H) ../include/func_tab.h
-       $(CC) $(CFLAGS) -c -o $@ ../win/tty/getline.c
-termcap.o: ../win/tty/termcap.c $(HACK_H) ../include/tcap.h
-       $(CC) $(CFLAGS) -c -o $@ ../win/tty/termcap.c
-topl.o: ../win/tty/topl.c $(HACK_H) ../include/tcap.h
-       $(CC) $(CFLAGS) -c -o $@ ../win/tty/topl.c
-wintty.o: ../win/tty/wintty.c $(HACK_H) ../include/dlb.h ../include/tcap.h
-       $(CC) $(CFLAGS) -c -o $@ ../win/tty/wintty.c
-cursmain.o: ../win/curses/cursmain.c $(HACK_H) ../include/wincurs.h
-       $(CC) $(CFLAGS) -c -o $@ ../win/curses/cursmain.c
-curswins.o: ../win/curses/curswins.c $(HACK_H) ../include/wincurs.h \
-               ../win/curses/curswins.h
-       $(CC) $(CFLAGS) -c -o $@ ../win/curses/curswins.c
-cursmisc.o: ../win/curses/cursmisc.c $(HACK_H) ../include/wincurs.h \
-               ../win/curses/cursmisc.h ../include/func_tab.h ../include/dlb.h
-       $(CC) $(CFLAGS) -c -o $@ ../win/curses/cursmisc.c
-cursdial.o: ../win/curses/cursdial.c $(HACK_H) ../include/wincurs.h \
-               ../win/curses/cursdial.h ../include/func_tab.h
-       $(CC) $(CFLAGS) -c -o $@ ../win/curses/cursdial.c
-cursstat.o: ../win/curses/cursstat.c $(HACK_H) ../include/wincurs.h \
-               ../win/curses/cursstat.h
-       $(CC) $(CFLAGS) -c -o $@ ../win/curses/cursstat.c
-cursinit.o: ../win/curses/cursinit.c $(HACK_H) ../include/wincurs.h \
-               ../win/curses/cursinit.h
-       $(CC) $(CFLAGS) -c -o $@ ../win/curses/cursinit.c
-cursmesg.o: ../win/curses/cursmesg.c $(HACK_H) ../include/wincurs.h \
-               ../win/curses/cursmesg.h
-       $(CC) $(CFLAGS) -c -o $@ ../win/curses/cursmesg.c
-cursinvt.o: ../win/curses/cursinvt.c $(HACK_H) ../include/wincurs.h \
-               ../win/curses/cursinvt.h
-       $(CC) $(CFLAGS) -c -o $@ ../win/curses/cursinvt.c
-Window.o: ../win/X11/Window.c ../include/xwindowp.h ../include/xwindow.h \
-               $(CONFIG_H) ../include/lint.h ../include/winX.h \
-               ../include/color.h ../include/wintype.h
-       $(CC) $(CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/Window.c
-dialogs.o: ../win/X11/dialogs.c $(CONFIG_H) ../include/lint.h \
+$(TARGETPFX)pcmain.o: ../sys/share/pcmain.c $(HACK_H) ../include/dlb.h
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/share/pcmain.c
+$(TARGETPFX)pcsys.o: ../sys/share/pcsys.c $(HACK_H)
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/share/pcsys.c
+$(TARGETPFX)pctty.o: ../sys/share/pctty.c $(HACK_H)
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/share/pctty.c
+$(TARGETPFX)pcunix.o: ../sys/share/pcunix.c $(HACK_H)
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/share/pcunix.c
+$(TARGETPFX)pmatchregex.o: ../sys/share/pmatchregex.c $(HACK_H)
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/share/pmatchregex.c
+$(TARGETPFX)posixregex.o: ../sys/share/posixregex.c $(HACK_H)
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/share/posixregex.c
+$(TARGETPFX)random.o: ../sys/share/random.c $(HACK_H)
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/share/random.c
+$(TARGETPFX)ioctl.o: ../sys/share/ioctl.c $(HACK_H) ../include/tcap.h
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/share/ioctl.c
+$(TARGETPFX)unixtty.o: ../sys/share/unixtty.c $(HACK_H)
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/share/unixtty.c
+$(TARGETPFX)unixmain.o: ../sys/unix/unixmain.c $(HACK_H) ../include/dlb.h
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/unix/unixmain.c
+$(TARGETPFX)unixunix.o: ../sys/unix/unixunix.c $(HACK_H)
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/unix/unixunix.c
+$(TARGETPFX)unixres.o: ../sys/unix/unixres.c $(CONFIG_H)
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/unix/unixres.c
+$(TARGETPFX)getline.o: ../win/tty/getline.c $(HACK_H) ../include/func_tab.h
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/tty/getline.c
+$(TARGETPFX)termcap.o: ../win/tty/termcap.c $(HACK_H) ../include/tcap.h
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/tty/termcap.c
+$(TARGETPFX)topl.o: ../win/tty/topl.c $(HACK_H) ../include/tcap.h
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/tty/topl.c
+$(TARGETPFX)wintty.o: ../win/tty/wintty.c $(HACK_H) ../include/dlb.h \
+               ../include/tcap.h
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/tty/wintty.c
+$(TARGETPFX)cursmain.o: ../win/curses/cursmain.c $(HACK_H) ../include/wincurs.h
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/curses/cursmain.c
+$(TARGETPFX)curswins.o: ../win/curses/curswins.c $(HACK_H) \
+               ../include/wincurs.h ../win/curses/curswins.h
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/curses/curswins.c
+$(TARGETPFX)cursmisc.o: ../win/curses/cursmisc.c $(HACK_H) \
+               ../include/wincurs.h ../win/curses/cursmisc.h \
+               ../include/func_tab.h ../include/dlb.h
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/curses/cursmisc.c
+$(TARGETPFX)cursdial.o: ../win/curses/cursdial.c $(HACK_H) \
+               ../include/wincurs.h ../win/curses/cursdial.h \
+               ../include/func_tab.h
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/curses/cursdial.c
+$(TARGETPFX)cursstat.o: ../win/curses/cursstat.c $(HACK_H) \
+               ../include/wincurs.h ../win/curses/cursstat.h
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/curses/cursstat.c
+$(TARGETPFX)cursinit.o: ../win/curses/cursinit.c $(HACK_H) \
+               ../include/wincurs.h ../win/curses/cursinit.h
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/curses/cursinit.c
+$(TARGETPFX)cursmesg.o: ../win/curses/cursmesg.c $(HACK_H) \
+               ../include/wincurs.h ../win/curses/cursmesg.h
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/curses/cursmesg.c
+$(TARGETPFX)cursinvt.o: ../win/curses/cursinvt.c $(HACK_H) \
+               ../include/wincurs.h ../win/curses/cursinvt.h
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/curses/cursinvt.c
+$(TARGETPFX)Window.o: ../win/X11/Window.c ../include/xwindowp.h \
+               ../include/xwindow.h $(CONFIG_H) ../include/lint.h \
+               ../include/winX.h ../include/color.h ../include/wintype.h
+       $(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/Window.c
+$(TARGETPFX)dialogs.o: ../win/X11/dialogs.c $(CONFIG_H) ../include/lint.h \
                ../include/winX.h ../include/color.h ../include/wintype.h
-       $(CC) $(CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/dialogs.c
-winX.o: ../win/X11/winX.c $(HACK_H) ../include/winX.h ../include/dlb.h \
-               ../include/xwindow.h ../win/X11/nh72icon ../win/X11/nh56icon \
-               ../win/X11/nh32icon
-       $(CC) $(CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winX.c
-winmap.o: ../win/X11/winmap.c ../include/xwindow.h $(HACK_H) ../include/dlb.h \
-               ../include/winX.h ../include/tile2x11.h
-       $(CC) $(CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winmap.c
-winmenu.o: ../win/X11/winmenu.c $(HACK_H) ../include/winX.h
-       $(CC) $(CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winmenu.c
-winmesg.o: ../win/X11/winmesg.c ../include/xwindow.h $(HACK_H) ../include/winX.h
-       $(CC) $(CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winmesg.c
-winmisc.o: ../win/X11/winmisc.c $(HACK_H) ../include/func_tab.h \
+       $(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/dialogs.c
+$(TARGETPFX)winX.o: ../win/X11/winX.c $(HACK_H) ../include/winX.h \
+               ../include/dlb.h ../include/xwindow.h ../win/X11/nh72icon \
+               ../win/X11/nh56icon ../win/X11/nh32icon
+       $(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winX.c
+$(TARGETPFX)winmap.o: ../win/X11/winmap.c ../include/xwindow.h $(HACK_H) \
+               ../include/dlb.h ../include/winX.h ../include/tile2x11.h
+       $(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winmap.c
+$(TARGETPFX)winmenu.o: ../win/X11/winmenu.c $(HACK_H) ../include/winX.h
+       $(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winmenu.c
+$(TARGETPFX)winmesg.o: ../win/X11/winmesg.c ../include/xwindow.h $(HACK_H) \
+               ../include/winX.h
+       $(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winmesg.c
+$(TARGETPFX)winmisc.o: ../win/X11/winmisc.c $(HACK_H) ../include/func_tab.h \
                ../include/winX.h
-       $(CC) $(CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winmisc.c
-winstat.o: ../win/X11/winstat.c $(HACK_H) ../include/winX.h ../include/xwindow.h
-       $(CC) $(CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winstat.c
-wintext.o: ../win/X11/wintext.c $(HACK_H) ../include/winX.h ../include/xwindow.h
-       $(CC) $(CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/wintext.c
-winval.o: ../win/X11/winval.c $(HACK_H) ../include/winX.h
-       $(CC) $(CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winval.c
-tile.o: tile.c $(HACK_H)
-cppregex.o: ../sys/share/cppregex.cpp
-       $(CXX) $(CXXFLAGS) -c -o $@ ../sys/share/cppregex.cpp
-qt_bind.o: ../win/Qt/qt_bind.cpp $(HACK_H) ../win/Qt/qt_pre.h \
+       $(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winmisc.c
+$(TARGETPFX)winstat.o: ../win/X11/winstat.c $(HACK_H) ../include/winX.h \
+               ../include/xwindow.h
+       $(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winstat.c
+$(TARGETPFX)wintext.o: ../win/X11/wintext.c $(HACK_H) ../include/winX.h \
+               ../include/xwindow.h
+       $(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/wintext.c
+$(TARGETPFX)winval.o: ../win/X11/winval.c $(HACK_H) ../include/winX.h
+       $(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winval.c
+$(TARGETPFX)tile.o: tile.c $(HACK_H)
+$(TARGETPFX)cppregex.o: ../sys/share/cppregex.cpp
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../sys/share/cppregex.cpp
+$(TARGETPFX)qt_bind.o: ../win/Qt/qt_bind.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_post.h ../win/Qt/qt_bind.h ../win/Qt/qt_main.h \
                ../win/Qt/qt_kde0.h ../win/Qt/qt_click.h ../win/Qt/qt_delay.h \
                ../win/Qt/qt_xcmd.h ../win/Qt/qt_key.h ../win/Qt/qt_map.h \
@@ -860,242 +941,249 @@ qt_bind.o: ../win/Qt/qt_bind.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_svsel.h ../win/Qt/qt_set.h ../win/Qt/qt_stat.h \
                ../win/Qt/qt_icon.h ../win/Qt/qt_streq.h ../win/Qt/qt_line.h \
                ../win/Qt/qt_yndlg.h ../win/Qt/qt_str.h ../include/dlb.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_bind.cpp
-qt_click.o: ../win/Qt/qt_click.cpp $(HACK_H) ../win/Qt/qt_pre.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_bind.cpp
+$(TARGETPFX)qt_click.o: ../win/Qt/qt_click.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_post.h ../win/Qt/qt_click.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_click.cpp
-qt_clust.o: ../win/Qt/qt_clust.cpp ../win/Qt/qt_clust.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_clust.cpp
-qt_delay.o: ../win/Qt/qt_delay.cpp $(HACK_H) ../win/Qt/qt_pre.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_click.cpp
+$(TARGETPFX)qt_clust.o: ../win/Qt/qt_clust.cpp ../win/Qt/qt_clust.h
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_clust.cpp
+$(TARGETPFX)qt_delay.o: ../win/Qt/qt_delay.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_post.h ../win/Qt/qt_delay.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_delay.cpp
-qt_glyph.o: ../win/Qt/qt_glyph.cpp $(HACK_H) ../include/tile2x11.h \
-               ../win/Qt/qt_pre.h ../win/Qt/qt_post.h ../win/Qt/qt_glyph.h \
-               ../win/Qt/qt_bind.h ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h \
-               ../win/Qt/qt_set.h ../win/Qt/qt_inv.h ../win/Qt/qt_map.h \
-               ../win/Qt/qt_win.h ../win/Qt/qt_clust.h ../win/Qt/qt_str.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_glyph.cpp
-qt_icon.o: ../win/Qt/qt_icon.cpp $(HACK_H) ../win/Qt/qt_pre.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_delay.cpp
+$(TARGETPFX)qt_glyph.o: ../win/Qt/qt_glyph.cpp $(HACK_H) \
+               ../include/tile2x11.h ../win/Qt/qt_pre.h ../win/Qt/qt_post.h \
+               ../win/Qt/qt_glyph.h ../win/Qt/qt_bind.h ../win/Qt/qt_main.h \
+               ../win/Qt/qt_kde0.h ../win/Qt/qt_set.h ../win/Qt/qt_inv.h \
+               ../win/Qt/qt_map.h ../win/Qt/qt_win.h ../win/Qt/qt_clust.h \
+               ../win/Qt/qt_str.h
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_glyph.cpp
+$(TARGETPFX)qt_icon.o: ../win/Qt/qt_icon.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_post.h ../win/Qt/qt_icon.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_icon.cpp
-qt_inv.o: ../win/Qt/qt_inv.cpp $(HACK_H) ../win/Qt/qt_pre.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_icon.cpp
+$(TARGETPFX)qt_inv.o: ../win/Qt/qt_inv.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_post.h ../win/Qt/qt_inv.h ../win/Qt/qt_glyph.h \
                ../win/Qt/qt_set.h ../win/Qt/qt_bind.h ../win/Qt/qt_main.h \
                ../win/Qt/qt_kde0.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_inv.cpp
-qt_key.o: ../win/Qt/qt_key.cpp $(HACK_H) ../win/Qt/qt_pre.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_inv.cpp
+$(TARGETPFX)qt_key.o: ../win/Qt/qt_key.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_post.h ../win/Qt/qt_key.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_key.cpp
-qt_line.o: ../win/Qt/qt_line.cpp $(HACK_H) ../win/Qt/qt_pre.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_key.cpp
+$(TARGETPFX)qt_line.o: ../win/Qt/qt_line.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_post.h ../win/Qt/qt_line.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_line.cpp
-qt_main.o: ../win/Qt/qt_main.cpp $(HACK_H) ../win/Qt/qt_pre.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_line.cpp
+$(TARGETPFX)qt_main.o: ../win/Qt/qt_main.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_post.h ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h \
                qt_main.moc ../win/Qt/qt_bind.h ../win/Qt/qt_glyph.h \
                ../win/Qt/qt_inv.h ../win/Qt/qt_key.h ../win/Qt/qt_map.h \
                ../win/Qt/qt_win.h ../win/Qt/qt_clust.h ../win/Qt/qt_msg.h \
                ../win/Qt/qt_set.h ../win/Qt/qt_stat.h ../win/Qt/qt_icon.h \
                ../win/Qt/qt_str.h qt_kde0.moc
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_main.cpp
-qt_map.o: ../win/Qt/qt_map.cpp $(HACK_H) ../win/Qt/qt_pre.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_main.cpp
+$(TARGETPFX)qt_map.o: ../win/Qt/qt_map.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_post.h ../win/Qt/qt_map.h ../win/Qt/qt_win.h \
                ../win/Qt/qt_clust.h qt_map.moc ../win/Qt/qt_click.h \
                ../win/Qt/qt_glyph.h ../win/Qt/qt_set.h ../win/Qt/qt_bind.h \
                ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_str.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_map.cpp
-qt_menu.o: ../win/Qt/qt_menu.cpp $(HACK_H) ../win/Qt/qt_pre.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_map.cpp
+$(TARGETPFX)qt_menu.o: ../win/Qt/qt_menu.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_post.h ../win/Qt/qt_menu.h ../win/Qt/qt_win.h \
                ../win/Qt/qt_rip.h qt_menu.moc ../win/Qt/qt_glyph.h \
                ../win/Qt/qt_set.h ../win/Qt/qt_bind.h ../win/Qt/qt_main.h \
                ../win/Qt/qt_kde0.h ../win/Qt/qt_streq.h ../win/Qt/qt_line.h \
                ../win/Qt/qt_str.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_menu.cpp
-qt_msg.o: ../win/Qt/qt_msg.cpp $(HACK_H) ../win/Qt/qt_pre.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_menu.cpp
+$(TARGETPFX)qt_msg.o: ../win/Qt/qt_msg.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_post.h ../win/Qt/qt_msg.h ../win/Qt/qt_win.h \
                qt_msg.moc ../win/Qt/qt_map.h ../win/Qt/qt_clust.h \
                ../win/Qt/qt_set.h ../win/Qt/qt_bind.h ../win/Qt/qt_main.h \
                ../win/Qt/qt_kde0.h ../win/Qt/qt_str.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_msg.cpp
-qt_plsel.o: ../win/Qt/qt_plsel.cpp $(HACK_H) ../win/Qt/qt_pre.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_msg.cpp
+$(TARGETPFX)qt_plsel.o: ../win/Qt/qt_plsel.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_post.h ../win/Qt/qt_plsel.h qt_plsel.moc \
                ../win/Qt/qt_bind.h ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h \
                ../win/Qt/qt_glyph.h ../win/Qt/qt_set.h ../win/Qt/qt_str.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_plsel.cpp
-qt_rip.o: ../win/Qt/qt_rip.cpp $(HACK_H) ../win/Qt/qt_pre.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_plsel.cpp
+$(TARGETPFX)qt_rip.o: ../win/Qt/qt_rip.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_post.h ../win/Qt/qt_rip.h ../win/Qt/qt_bind.h \
                ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_str.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_rip.cpp
-qt_set.o: ../win/Qt/qt_set.cpp $(HACK_H) ../win/Qt/qt_pre.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_rip.cpp
+$(TARGETPFX)qt_set.o: ../win/Qt/qt_set.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_post.h ../win/Qt/qt_set.h ../win/Qt/qt_bind.h \
                ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h qt_set.moc \
                ../win/Qt/qt_glyph.h ../win/Qt/qt_str.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_set.cpp
-qt_stat.o: ../win/Qt/qt_stat.cpp $(HACK_H) ../win/Qt/qt_pre.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_set.cpp
+$(TARGETPFX)qt_stat.o: ../win/Qt/qt_stat.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_post.h ../win/Qt/qt_stat.h ../win/Qt/qt_win.h \
                ../win/Qt/qt_icon.h qt_stat.moc ../win/Qt/qt_set.h \
                ../win/Qt/qt_bind.h ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h \
                ../win/Qt/qt_str.h ../win/Qt/qt_xpms.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_stat.cpp
-qt_str.o: ../win/Qt/qt_str.cpp ../win/Qt/qt_str.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_str.cpp
-qt_streq.o: ../win/Qt/qt_streq.cpp $(HACK_H) ../win/Qt/qt_pre.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_stat.cpp
+$(TARGETPFX)qt_str.o: ../win/Qt/qt_str.cpp ../win/Qt/qt_str.h
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_str.cpp
+$(TARGETPFX)qt_streq.o: ../win/Qt/qt_streq.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_post.h ../win/Qt/qt_streq.h ../win/Qt/qt_line.h \
                ../win/Qt/qt_str.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_streq.cpp
-qt_svsel.o: ../win/Qt/qt_svsel.cpp $(HACK_H) ../win/Qt/qt_pre.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_streq.cpp
+$(TARGETPFX)qt_svsel.o: ../win/Qt/qt_svsel.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_post.h ../win/Qt/qt_svsel.h ../win/Qt/qt_bind.h \
                ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_str.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_svsel.cpp
-qt_win.o: ../win/Qt/qt_win.cpp $(HACK_H) ../win/Qt/qt_pre.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_svsel.cpp
+$(TARGETPFX)qt_win.o: ../win/Qt/qt_win.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_post.h ../win/Qt/qt_win.h ../win/Qt/qt_bind.h \
                ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_click.h \
                ../win/Qt/qt_glyph.h ../win/Qt/qt_inv.h ../win/Qt/qt_key.h \
                ../win/Qt/qt_icon.h ../win/Qt/qt_map.h ../win/Qt/qt_clust.h \
                ../win/Qt/qt_menu.h ../win/Qt/qt_rip.h ../win/Qt/qt_msg.h \
                ../win/Qt/qt_set.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_win.cpp
-qt_xcmd.o: ../win/Qt/qt_xcmd.cpp $(HACK_H) ../include/func_tab.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_win.cpp
+$(TARGETPFX)qt_xcmd.o: ../win/Qt/qt_xcmd.cpp $(HACK_H) ../include/func_tab.h \
                ../win/Qt/qt_pre.h ../win/Qt/qt_post.h ../win/Qt/qt_xcmd.h \
                qt_xcmd.moc ../win/Qt/qt_bind.h ../win/Qt/qt_main.h \
                ../win/Qt/qt_kde0.h ../win/Qt/qt_set.h ../win/Qt/qt_str.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_xcmd.cpp
-qt_yndlg.o: ../win/Qt/qt_yndlg.cpp $(HACK_H) ../win/Qt/qt_pre.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_xcmd.cpp
+$(TARGETPFX)qt_yndlg.o: ../win/Qt/qt_yndlg.cpp $(HACK_H) ../win/Qt/qt_pre.h \
                ../win/Qt/qt_post.h ../win/Qt/qt_yndlg.h qt_yndlg.moc \
                ../win/Qt/qt_str.h
-       $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_yndlg.cpp
-wc_chainin.o: ../win/chain/wc_chainin.c $(HACK_H)
-       $(CC) $(CFLAGS) -c -o $@ ../win/chain/wc_chainin.c
-wc_chainout.o: ../win/chain/wc_chainout.c $(HACK_H)
-       $(CC) $(CFLAGS) -c -o $@ ../win/chain/wc_chainout.c
-wc_trace.o: ../win/chain/wc_trace.c $(HACK_H) ../include/func_tab.h
-       $(CC) $(CFLAGS) -c -o $@ ../win/chain/wc_trace.c
-vis_tab.o: vis_tab.c $(CONFIG_H) ../include/vis_tab.h
-allmain.o: allmain.c $(HACK_H)
-alloc.o: alloc.c $(CONFIG_H)
-apply.o: apply.c $(HACK_H)
-artifact.o: artifact.c $(HACK_H) ../include/artifact.h ../include/artilist.h
-attrib.o: attrib.c $(HACK_H)
-ball.o: ball.c $(HACK_H)
-bones.o: bones.c $(HACK_H)
-botl.o: botl.c $(HACK_H)
-cmd.o: cmd.c $(HACK_H) ../include/func_tab.h
-dbridge.o: dbridge.c $(HACK_H)
-decl.o: decl.c $(HACK_H)
-detect.o: detect.c $(HACK_H) ../include/artifact.h
-dig.o: dig.c $(HACK_H)
-display.o: display.c $(HACK_H)
-dlb.o: dlb.c $(CONFIG_H) ../include/dlb.h
-do.o: do.c $(HACK_H)
-do_name.o: do_name.c $(HACK_H)
-do_wear.o: do_wear.c $(HACK_H)
-dog.o: dog.c $(HACK_H)
-dogmove.o: dogmove.c $(HACK_H) ../include/mfndpos.h
-dokick.o: dokick.c $(HACK_H)
-dothrow.o: dothrow.c $(HACK_H)
-drawing.o: drawing.c $(CONFIG_H) ../include/color.h ../include/rm.h \
-               ../include/objclass.h ../include/monsym.h
-dungeon.o: dungeon.c $(HACK_H) ../include/dgn_file.h ../include/dlb.h
-eat.o: eat.c $(HACK_H)
-end.o: end.c $(HACK_H) ../include/dlb.h
-engrave.o: engrave.c $(HACK_H)
-exper.o: exper.c $(HACK_H)
-explode.o: explode.c $(HACK_H)
-extralev.o: extralev.c $(HACK_H)
-files.o: files.c $(HACK_H) ../include/dlb.h #zlib.h
-fountain.o: fountain.c $(HACK_H)
-hack.o: hack.c $(HACK_H)
-hacklib.o: hacklib.c $(HACK_H)
-insight.o: insight.c $(HACK_H)
-invent.o: invent.c $(HACK_H)
-isaac64.o: isaac64.c $(CONFIG_H) ../include/isaac64.h
-light.o: light.c $(HACK_H)
-lock.o: lock.c $(HACK_H)
-mail.o: mail.c $(HACK_H) ../include/mail.h
-makemon.o: makemon.c $(HACK_H)
-mapglyph.o: mapglyph.c $(HACK_H)
-mcastu.o: mcastu.c $(HACK_H)
-mdlib.o: mdlib.c $(CONFIG_H) ../include/permonst.h ../include/align.h \
-               ../include/monattk.h ../include/monflag.h \
+       $(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_yndlg.cpp
+$(TARGETPFX)wc_chainin.o: ../win/chain/wc_chainin.c $(HACK_H)
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/chain/wc_chainin.c
+$(TARGETPFX)wc_chainout.o: ../win/chain/wc_chainout.c $(HACK_H)
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/chain/wc_chainout.c
+$(TARGETPFX)wc_trace.o: ../win/chain/wc_trace.c $(HACK_H) ../include/func_tab.h
+       $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/chain/wc_trace.c
+$(TARGETPFX)vis_tab.o: vis_tab.c $(CONFIG_H) ../include/vis_tab.h
+$(TARGETPFX)allmain.o: allmain.c $(HACK_H)
+$(TARGETPFX)alloc.o: alloc.c $(CONFIG_H)
+$(TARGETPFX)apply.o: apply.c $(HACK_H)
+$(TARGETPFX)artifact.o: artifact.c $(HACK_H) ../include/artifact.h \
+               ../include/artilist.h
+$(TARGETPFX)attrib.o: attrib.c $(HACK_H)
+$(TARGETPFX)ball.o: ball.c $(HACK_H)
+$(TARGETPFX)bones.o: bones.c $(HACK_H)
+$(TARGETPFX)botl.o: botl.c $(HACK_H)
+$(TARGETPFX)cmd.o: cmd.c $(HACK_H) ../include/func_tab.h
+$(TARGETPFX)dbridge.o: dbridge.c $(HACK_H)
+$(TARGETPFX)decl.o: decl.c $(HACK_H)
+$(TARGETPFX)detect.o: detect.c $(HACK_H) ../include/artifact.h
+$(TARGETPFX)dig.o: dig.c $(HACK_H)
+$(TARGETPFX)display.o: display.c $(HACK_H)
+$(TARGETPFX)dlb.o: dlb.c $(CONFIG_H) ../include/dlb.h
+$(TARGETPFX)do.o: do.c $(HACK_H)
+$(TARGETPFX)do_name.o: do_name.c $(HACK_H)
+$(TARGETPFX)do_wear.o: do_wear.c $(HACK_H)
+$(TARGETPFX)dog.o: dog.c $(HACK_H)
+$(TARGETPFX)dogmove.o: dogmove.c $(HACK_H) ../include/mfndpos.h
+$(TARGETPFX)dokick.o: dokick.c $(HACK_H)
+$(TARGETPFX)dothrow.o: dothrow.c $(HACK_H)
+$(TARGETPFX)drawing.o: drawing.c $(CONFIG_H) ../include/color.h \
+               ../include/rm.h ../include/objclass.h ../include/monsym.h
+$(TARGETPFX)dungeon.o: dungeon.c $(HACK_H) ../include/dgn_file.h \
+               ../include/dlb.h
+$(TARGETPFX)eat.o: eat.c $(HACK_H)
+$(TARGETPFX)end.o: end.c $(HACK_H) ../include/dlb.h
+$(TARGETPFX)engrave.o: engrave.c $(HACK_H)
+$(TARGETPFX)exper.o: exper.c $(HACK_H)
+$(TARGETPFX)explode.o: explode.c $(HACK_H)
+$(TARGETPFX)extralev.o: extralev.c $(HACK_H)
+$(TARGETPFX)files.o: files.c $(HACK_H) ../include/dlb.h #zlib.h
+$(TARGETPFX)fountain.o: fountain.c $(HACK_H)
+$(TARGETPFX)hack.o: hack.c $(HACK_H)
+$(TARGETPFX)hacklib.o: hacklib.c $(HACK_H)
+$(TARGETPFX)insight.o: insight.c $(HACK_H)
+$(TARGETPFX)invent.o: invent.c $(HACK_H)
+$(TARGETPFX)isaac64.o: isaac64.c $(CONFIG_H) ../include/isaac64.h
+$(TARGETPFX)light.o: light.c $(HACK_H)
+$(TARGETPFX)lock.o: lock.c $(HACK_H)
+$(TARGETPFX)mail.o: mail.c $(HACK_H) ../include/mail.h
+$(TARGETPFX)makemon.o: makemon.c $(HACK_H)
+$(TARGETPFX)mapglyph.o: mapglyph.c $(HACK_H)
+$(TARGETPFX)mcastu.o: mcastu.c $(HACK_H)
+$(TARGETPFX)mdlib.o: mdlib.c $(CONFIG_H) ../include/permonst.h \
+               ../include/align.h ../include/monattk.h ../include/monflag.h \
                ../include/objclass.h ../include/monsym.h \
                ../include/artilist.h ../include/dungeon.h ../include/obj.h \
                ../include/monst.h ../include/mextra.h ../include/you.h \
                ../include/attrib.h ../include/prop.h ../include/skills.h \
                ../include/context.h ../include/flag.h ../include/dlb.h
-mhitm.o: mhitm.c $(HACK_H) ../include/artifact.h
-mhitu.o: mhitu.c $(HACK_H) ../include/artifact.h
-minion.o: minion.c $(HACK_H)
-mklev.o: mklev.c $(HACK_H)
-mkmap.o: mkmap.c $(HACK_H) ../include/sp_lev.h
-mkmaze.o: mkmaze.c $(HACK_H) ../include/sp_lev.h
-mkobj.o: mkobj.c $(HACK_H)
-mkroom.o: mkroom.c $(HACK_H)
-mon.o: mon.c $(HACK_H) ../include/mfndpos.h
-mondata.o: mondata.c $(HACK_H)
-monmove.o: monmove.c $(HACK_H) ../include/mfndpos.h ../include/artifact.h
-monst.o: monst.c $(CONFIG_H) ../include/permonst.h ../include/align.h \
-               ../include/monattk.h ../include/monflag.h ../include/monsym.h \
+$(TARGETPFX)mhitm.o: mhitm.c $(HACK_H) ../include/artifact.h
+$(TARGETPFX)mhitu.o: mhitu.c $(HACK_H) ../include/artifact.h
+$(TARGETPFX)minion.o: minion.c $(HACK_H)
+$(TARGETPFX)mklev.o: mklev.c $(HACK_H)
+$(TARGETPFX)mkmap.o: mkmap.c $(HACK_H) ../include/sp_lev.h
+$(TARGETPFX)mkmaze.o: mkmaze.c $(HACK_H) ../include/sp_lev.h
+$(TARGETPFX)mkobj.o: mkobj.c $(HACK_H)
+$(TARGETPFX)mkroom.o: mkroom.c $(HACK_H)
+$(TARGETPFX)mon.o: mon.c $(HACK_H) ../include/mfndpos.h
+$(TARGETPFX)mondata.o: mondata.c $(HACK_H)
+$(TARGETPFX)monmove.o: monmove.c $(HACK_H) ../include/mfndpos.h \
+               ../include/artifact.h
+$(TARGETPFX)monst.o: monst.c $(CONFIG_H) ../include/permonst.h \
+               ../include/align.h ../include/monattk.h ../include/monflag.h \
+               ../include/monsym.h ../include/color.h
+$(TARGETPFX)mplayer.o: mplayer.c $(HACK_H)
+$(TARGETPFX)mthrowu.o: mthrowu.c $(HACK_H)
+$(TARGETPFX)muse.o: muse.c $(HACK_H)
+$(TARGETPFX)music.o: music.c $(HACK_H)
+$(TARGETPFX)nhlua.o: nhlua.c $(HACK_H) ../include/dlb.h
+$(TARGETPFX)nhlsel.o: nhlsel.c $(HACK_H) ../include/sp_lev.h
+$(TARGETPFX)nhlobj.o: nhlobj.c $(HACK_H) ../include/sp_lev.h
+$(TARGETPFX)o_init.o: o_init.c $(HACK_H)
+$(TARGETPFX)objects.o: objects.c $(CONFIG_H) ../include/obj.h \
+               ../include/objclass.h ../include/prop.h ../include/skills.h \
                ../include/color.h
-mplayer.o: mplayer.c $(HACK_H)
-mthrowu.o: mthrowu.c $(HACK_H)
-muse.o: muse.c $(HACK_H)
-music.o: music.c $(HACK_H)
-nhlua.o: nhlua.c $(HACK_H) ../include/dlb.h
-nhlsel.o: nhlsel.c $(HACK_H) ../include/sp_lev.h
-nhlobj.o: nhlobj.c $(HACK_H) ../include/sp_lev.h
-o_init.o: o_init.c $(HACK_H)
-objects.o: objects.c $(CONFIG_H) ../include/obj.h ../include/objclass.h \
-               ../include/prop.h ../include/skills.h ../include/color.h
-objnam.o: objnam.c $(HACK_H)
-options.o: options.c $(CONFIG_H) ../include/objclass.h ../include/flag.h \
-               $(HACK_H) ../include/tcap.h ../include/optlist.h
-pager.o: pager.c $(HACK_H) ../include/dlb.h
-pickup.o: pickup.c $(HACK_H)
-pline.o: pline.c $(HACK_H)
-polyself.o: polyself.c $(HACK_H)
-potion.o: potion.c $(HACK_H)
-pray.o: pray.c $(HACK_H)
-priest.o: priest.c $(HACK_H) ../include/mfndpos.h
-quest.o: quest.c $(HACK_H)
-questpgr.o: questpgr.c $(HACK_H) ../include/dlb.h
-read.o: read.c $(HACK_H)
-rect.o: rect.c $(HACK_H)
-region.o: region.c $(HACK_H)
-restore.o: restore.c $(HACK_H) ../include/tcap.h
-rip.o: rip.c $(HACK_H)
-rnd.o: rnd.c $(HACK_H) ../include/isaac64.h
-role.o: role.c $(HACK_H)
-rumors.o: rumors.c $(HACK_H) ../include/dlb.h
-save.o: save.c $(HACK_H)
-sfstruct.o: sfstruct.c $(HACK_H)
-shk.o: shk.c $(HACK_H)
-shknam.o: shknam.c $(HACK_H)
-sit.o: sit.c $(HACK_H) ../include/artifact.h
-sounds.o: sounds.c $(HACK_H)
-sp_lev.o: sp_lev.c $(HACK_H) ../include/sp_lev.h
-spell.o: spell.c $(HACK_H)
-steal.o: steal.c $(HACK_H)
-steed.o: steed.c $(HACK_H)
-symbols.o: symbols.c $(HACK_H) ../include/tcap.h
-sys.o: sys.c $(HACK_H)
-teleport.o: teleport.c $(HACK_H)
-timeout.o: timeout.c $(HACK_H)
-topten.o: topten.c $(HACK_H) ../include/dlb.h
-track.o: track.c $(HACK_H)
-trap.o: trap.c $(HACK_H)
-u_init.o: u_init.c $(HACK_H)
-uhitm.o: uhitm.c $(HACK_H)
-vault.o: vault.c $(HACK_H)
-version.o: version.c $(HACK_H) ../include/dlb.h ../include/date.h
-vision.o: vision.c $(HACK_H) ../include/vis_tab.h
-weapon.o: weapon.c $(HACK_H)
-were.o: were.c $(HACK_H)
-wield.o: wield.c $(HACK_H)
-windows.o: windows.c $(HACK_H) ../include/wingem.h ../include/winGnome.h
-wizard.o: wizard.c $(HACK_H)
-worm.o: worm.c $(HACK_H)
-worn.o: worn.c $(HACK_H)
-write.o: write.c $(HACK_H)
-zap.o: zap.c $(HACK_H)
+$(TARGETPFX)objnam.o: objnam.c $(HACK_H)
+$(TARGETPFX)options.o: options.c $(CONFIG_H) ../include/objclass.h \
+               ../include/flag.h $(HACK_H) ../include/tcap.h \
+               ../include/optlist.h
+$(TARGETPFX)pager.o: pager.c $(HACK_H) ../include/dlb.h
+$(TARGETPFX)pickup.o: pickup.c $(HACK_H)
+$(TARGETPFX)pline.o: pline.c $(HACK_H)
+$(TARGETPFX)polyself.o: polyself.c $(HACK_H)
+$(TARGETPFX)potion.o: potion.c $(HACK_H)
+$(TARGETPFX)pray.o: pray.c $(HACK_H)
+$(TARGETPFX)priest.o: priest.c $(HACK_H) ../include/mfndpos.h
+$(TARGETPFX)quest.o: quest.c $(HACK_H)
+$(TARGETPFX)questpgr.o: questpgr.c $(HACK_H) ../include/dlb.h
+$(TARGETPFX)read.o: read.c $(HACK_H)
+$(TARGETPFX)rect.o: rect.c $(HACK_H)
+$(TARGETPFX)region.o: region.c $(HACK_H)
+$(TARGETPFX)restore.o: restore.c $(HACK_H) ../include/tcap.h
+$(TARGETPFX)rip.o: rip.c $(HACK_H)
+$(TARGETPFX)rnd.o: rnd.c $(HACK_H) ../include/isaac64.h
+$(TARGETPFX)role.o: role.c $(HACK_H)
+$(TARGETPFX)rumors.o: rumors.c $(HACK_H) ../include/dlb.h
+$(TARGETPFX)save.o: save.c $(HACK_H)
+$(TARGETPFX)sfstruct.o: sfstruct.c $(HACK_H)
+$(TARGETPFX)shk.o: shk.c $(HACK_H)
+$(TARGETPFX)shknam.o: shknam.c $(HACK_H)
+$(TARGETPFX)sit.o: sit.c $(HACK_H) ../include/artifact.h
+$(TARGETPFX)sounds.o: sounds.c $(HACK_H)
+$(TARGETPFX)sp_lev.o: sp_lev.c $(HACK_H) ../include/sp_lev.h
+$(TARGETPFX)spell.o: spell.c $(HACK_H)
+$(TARGETPFX)steal.o: steal.c $(HACK_H)
+$(TARGETPFX)steed.o: steed.c $(HACK_H)
+$(TARGETPFX)symbols.o: symbols.c $(HACK_H) ../include/tcap.h
+$(TARGETPFX)sys.o: sys.c $(HACK_H)
+$(TARGETPFX)teleport.o: teleport.c $(HACK_H)
+$(TARGETPFX)timeout.o: timeout.c $(HACK_H)
+$(TARGETPFX)topten.o: topten.c $(HACK_H) ../include/dlb.h
+$(TARGETPFX)track.o: track.c $(HACK_H)
+$(TARGETPFX)trap.o: trap.c $(HACK_H)
+$(TARGETPFX)u_init.o: u_init.c $(HACK_H)
+$(TARGETPFX)uhitm.o: uhitm.c $(HACK_H)
+$(TARGETPFX)vault.o: vault.c $(HACK_H)
+$(TARGETPFX)version.o: version.c $(HACK_H) ../include/dlb.h ../include/date.h
+$(TARGETPFX)vision.o: vision.c $(HACK_H) ../include/vis_tab.h
+$(TARGETPFX)weapon.o: weapon.c $(HACK_H)
+$(TARGETPFX)were.o: were.c $(HACK_H)
+$(TARGETPFX)wield.o: wield.c $(HACK_H)
+$(TARGETPFX)windows.o: windows.c $(HACK_H) ../include/wingem.h \
+               ../include/winGnome.h
+$(TARGETPFX)wizard.o: wizard.c $(HACK_H)
+$(TARGETPFX)worm.o: worm.c $(HACK_H)
+$(TARGETPFX)worn.o: worn.c $(HACK_H)
+$(TARGETPFX)write.o: write.c $(HACK_H)
+$(TARGETPFX)zap.o: zap.c $(HACK_H)
 # DEPENDENCIES MUST END AT END OF FILE
 # IF YOU PUT STUFF HERE IT WILL GO AWAY
 # see make depend above
index b604bb7efea997d0b382b04d01f6b8fbaa0de148..5d72e42215b6b769f2ce56d7beed4e5cdbb15fee 100644 (file)
@@ -205,6 +205,9 @@ dlb:
        ( cd util ; $(MAKE) dlb )
        ( cd dat ; LC_ALL=C ; ../util/dlb cf nhdat $(DATDLB) )
 
+package: $(GAME) recover $(VARDAT) spec_levs
+       ( cd src ;  $(MAKE) $(PACKAGE) )
+
 # recover can be used when INSURANCE is defined in include/config.h
 # and the checkpoint option is true
 recover: $(GAME)
index 2674596f49a04c8f6dd91b7ca50bdfc57f0547f1..751395c7a29ba7fe90d37cb906f74972c8c9b7a9 100644 (file)
@@ -106,9 +106,6 @@ CPPFLAGS =
 
 LIBS =
 
-# If you are cross-compiling, you must use this:
-#OBJDIR = .
-# otherwise, you can save a little bit of disk space with this:
 OBJDIR = ../src
 
 # if you change this to 1, feedback while building will omit -Dthis -Wthat
@@ -186,17 +183,31 @@ RECOVOBJS = recover.o
 # object files for the data librarian
 DLBOBJS = dlb_main.o $(OBJDIR)/dlb.o $(OALLOC)
 
+# Distinguish between the build tools for the native host
+# and the build tools for the target environment in commands.
+# This allows the same set of Makefiles to be used for native
+# builds and for cross-compiles by overriding these in hints
+# files or on the command line.
+
+TARGETPFX= 
+TARGET_CC = $(CC)
+TARGET_CFLAGS = $(CFLAGS)
+TARGET_LINK = $(LINK)
+TARGET_LFLAGS = $(LFLAGS)
+TARGET_CXX = $(CXX)
+TARGET_CXXFLAGS = $(CXXFLAGS)
 
 #      dependencies for makedefs
 #
 makedefs:      $(MAKEOBJS) mdgrep.h
-       $(CC) $(LFLAGS) -o makedefs $(MAKEOBJS)
+       $(LINK) $(LFLAGS) -o makedefs $(MAKEOBJS)
 
 makedefs.o: makedefs.c ../src/mdlib.c $(CONFIG_H) ../include/permonst.h \
                ../include/objclass.h ../include/monsym.h \
                ../include/artilist.h ../include/dungeon.h ../include/obj.h \
                ../include/monst.h ../include/you.h ../include/flag.h \
                ../include/dlb.h ../include/patchlevel.h
+       $(CC) $(CFLAGS) -c makedefs.c -o $@
 
 # Don't require perl to build; that is why mdgrep.h is spelled wrong below.
 mdgreph: mdgrep.pl
@@ -222,6 +233,7 @@ lintdefs:
 
 # support code used by several of the utility programs (but not makedefs)
 panic.o:     panic.c $(CONFIG_H)
+       $(CC) $(CFLAGS) -c panic.c -o $@
 
 
 # with all of extern.h's functions to complain about, we drown in
@@ -233,7 +245,7 @@ lintdgn:
 #      dependencies for recover
 #
 recover: $(RECOVOBJS)
-       $(CC) $(LFLAGS) -o recover $(RECOVOBJS) $(LIBS)
+       $(LINK) $(LFLAGS) -o recover $(RECOVOBJS) $(LIBS)
 
 recover.o: recover.c $(CONFIG_H) ../include/date.h
 
@@ -244,8 +256,7 @@ dlb:        $(DLBOBJS)
        $(CC) $(LFLAGS) -o dlb $(DLBOBJS) $(LIBS)
 
 dlb_main.o: dlb_main.c $(CONFIG_H) ../include/dlb.h ../include/date.h
-       $(CC) $(CFLAGS) -c dlb_main.c
-
+       $(CC) $(CFLAGS) -c dlb_main.c -o $@
 
 
 #      dependencies for tile utilities
@@ -257,24 +268,24 @@ PPMWRITERS = ppmwrite.o
 tileutils: tilemap gif2txt txt2ppm tile2x11
 
 gif2txt: $(GIFREADERS) $(TEXT_IO)
-       $(CC) $(LFLAGS) -o gif2txt $(GIFREADERS) $(TEXT_IO) $(LIBS)
+       $(LINK) $(LFLAGS) -o gif2txt $(GIFREADERS) $(TEXT_IO) $(LIBS)
 txt2ppm: $(PPMWRITERS) $(TEXT_IO)
-       $(CC) $(LFLAGS) -o txt2ppm $(PPMWRITERS) $(TEXT_IO) $(LIBS)
+       $(LINK) $(LFLAGS) -o txt2ppm $(PPMWRITERS) $(TEXT_IO) $(LIBS)
 
 tile2x11: tile2x11.o $(TEXT_IO)
-       $(CC) $(LFLAGS) -o tile2x11 tile2x11.o $(TEXT_IO) $(LIBS)
+       $(LINK) $(LFLAGS) -o tile2x11 tile2x11.o $(TEXT_IO) $(LIBS)
 
 tile2img.ttp: tile2img.o bitmfile.o $(TEXT_IO)
-       $(CC) $(LFLAGS) -o tile2img.ttp tile2img.o bitmfile.o $(TEXT_IO) $(LIBS)
+       $(LINK) $(LFLAGS) -o tile2img.ttp tile2img.o bitmfile.o $(TEXT_IO) $(LIBS)
 
 tile2bmp: tile2bmp.o $(TEXT_IO)
-       $(CC) $(LFLAGS) -o tile2bmp tile2bmp.o $(TEXT_IO)
+       $(LINK) $(LFLAGS) -o tile2bmp tile2bmp.o $(TEXT_IO)
 
 xpm2img.ttp: xpm2img.o bitmfile.o
-       $(CC) $(LFLAGS) -o xpm2img.ttp xpm2img.o bitmfile.o $(LIBS)
+       $(LINK) $(LFLAGS) -o xpm2img.ttp xpm2img.o bitmfile.o $(LIBS)
 
 tile2beos: tile2beos.o $(TEXT_IO)
-       $(CC) $(LFLAGS) -o tile2beos tile2beos.o $(TEXT_IO) -lbe
+       $(LINK) $(LFLAGS) -o tile2beos tile2beos.o $(TEXT_IO) -lbe
 
 #--compiling and linking in one step leaves extra debugging files (in their
 #  own subdirectories!) on OSX; compile and link separately to suppress
@@ -282,14 +293,14 @@ tile2beos: tile2beos.o $(TEXT_IO)
 #tilemap: ../win/share/tilemap.c $(HACK_H)
 #      $(CC) $(CFLAGS) $(LFLAGS) -o tilemap ../win/share/tilemap.c $(LIBS)
 tilemap: tilemap.o
-       $(CC) $(LFLAGS) -o tilemap tilemap.o $(LIBS)
+       $(LINK) $(LFLAGS) -o tilemap tilemap.o $(LIBS)
 ../src/tile.c: tilemap
        ./tilemap
 
 ../include/tile.h: ../win/share/tile.h
        cp ../win/share/tile.h ../include/tile.h
 tiletext.o: ../win/share/tiletext.c $(CONFIG_H) ../include/tile.h
-       $(CC) $(CFLAGS) -c ../win/share/tiletext.c
+       $(CC) $(CFLAGS) -c ../win/share/tiletext.c -o $@
 tiletxt.c: ./Makefile
        @echo '/* alternate compilation for tilemap.c to create tiletxt.o' > tiletxt.c
        @echo '   that does not rely on "cc -c -o tiletxt.o tilemap.c"'  >> tiletxt.c
@@ -298,32 +309,32 @@ tiletxt.c: ./Makefile
        echo '#include "../win/share/tilemap.c"' >> tiletxt.c
        @echo '/*tiletxt.c*/'                    >> tiletxt.c
 tiletxt.o: tiletxt.c ../win/share/tilemap.c $(HACK_H)
-       $(CC) $(CFLAGS) -c tiletxt.c
+       $(CC) $(CFLAGS) -c tiletxt.c -o $@
 tilemap.o: ../win/share/tilemap.c $(HACK_H)
-       $(CC) $(CFLAGS) -c ../win/share/tilemap.c
+       $(CC) $(CFLAGS) -c ../win/share/tilemap.c -o $@
 
 gifread.o: ../win/share/gifread.c $(CONFIG_H) ../include/tile.h
-       $(CC) $(CFLAGS) -c ../win/share/gifread.c
+       $(CC) $(CFLAGS) -c ../win/share/gifread.c -o $@
 ppmwrite.o: ../win/share/ppmwrite.c $(CONFIG_H) ../include/tile.h
-       $(CC) $(CFLAGS) -c ../win/share/ppmwrite.c
+       $(CC) $(CFLAGS) -c ../win/share/ppmwrite.c -o $@
 
 tile2bmp.o: ../win/share/tile2bmp.c $(HACK_H) ../include/tile.h
-       $(CC) $(CFLAGS) -c ../win/share/tile2bmp.c
+       $(CC) $(CFLAGS) -c ../win/share/tile2bmp.c -o $@
 
 tile2x11.o: ../win/X11/tile2x11.c $(HACK_H) ../include/tile.h \
                                                ../include/tile2x11.h
-       $(CC) $(CFLAGS) -c ../win/X11/tile2x11.c
+       $(CC) $(CFLAGS) -c ../win/X11/tile2x11.c -o $@
 
 tile2img.o: ../win/gem/tile2img.c $(HACK_H) ../include/tile.h \
                                                ../include/bitmfile.h
-       $(CC) $(CFLAGS) -c ../win/gem/tile2img.c
+       $(CC) $(CFLAGS) -c ../win/gem/tile2img.c -o $@
 xpm2img.o: ../win/gem/xpm2img.c $(HACK_H) ../include/bitmfile.h
-       $(CC) $(CFLAGS) -c ../win/gem/xpm2img.c
+       $(CC) $(CFLAGS) -c ../win/gem/xpm2img.c -o $@
 bitmfile.o: ../win/gem/bitmfile.c ../include/bitmfile.h
-       $(CC) $(CFLAGS) -c ../win/gem/bitmfile.c
+       $(CC) $(CFLAGS) -c ../win/gem/bitmfile.c -o $@
 
 tile2beos.o: ../win/BeOS/tile2beos.cpp $(HACK_H) ../include/tile.h
-       $(CXX) $(CFLAGS) -c ../win/BeOS/tile2beos.cpp
+       $(CXX) $(CFLAGS) -c ../win/BeOS/tile2beos.cpp -o $@
 
 tileedit: tileedit.cpp $(TEXT_IO)
        $(QTDIR)/bin/moc -o tileedit.moc tileedit.h
@@ -341,8 +352,7 @@ tileedit: tileedit.cpp $(TEXT_IO)
 # to improvise things not in the instructions, like 'make makedefs' here
 # in util...
 
-# make sure object files from src are available when needed
-#
+# make sure host object files from src are available when needed
 $(OBJDIR)/alloc.o: ../src/alloc.c $(CONFIG_H)
        $(CC) $(CFLAGS) -c ../src/alloc.c -o $@
 $(OBJDIR)/drawing.o: ../src/drawing.c $(CONFIG_H)
index ac4416230302e07ec4c06d00ddbfd3195db416d7..a488c5457f7e67ee694fc32d865f93fb60d27da9 100644 (file)
@@ -113,8 +113,13 @@ function output_specials(                  i, sp, alt_sp)
 #
 function format_dep(target, source,            col, n, i, list)
 {
+  if (substr(target,1,1) == "$") {
+       prefix = ""
+  } else {
+       prefix = "$(TARGETPFX)"
+  }
   split("", done)                      #``for (x in done) delete done[x]''
-  printf("%s:", target);  col = length(target) + 1
+  printf("%s%s:", prefix, target);  col = length(target) + 1 + length(prefix)
   #- printf("\t");  col += 8 - (col % 8);
   #- if (col == 8) { printf("\t"); col += 8 }
   source = depend("", source, 0)
@@ -132,13 +137,13 @@ function format_dep(target, source,               col, n, i, list)
   source = list[2]
   if (source ~ /\// && substr(source, 1, 11) != "../include/") {
     if (source ~ /\.cpp$/ )
-      print "\t$(CXX) $(CXXFLAGS) -c -o $@ " source
+      print "\t$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ " source
     else if (source ~ /\/X11\//)       # "../win/X11/foo.c"
-      print "\t$(CC) $(CFLAGS) $(X11CFLAGS) -c -o $@ " source
+      print "\t$(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ " source
     else if (source ~ /\/gnome\//)     # "../win/gnome/foo.c"
-      print "\t$(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ " source
+      print "\t$(TARGET_CC) $(TARGET_CFLAGS) $(GNOMEINC) -c -o $@ " source
     else
-      print "\t$(CC) $(CFLAGS) -c -o $@ " source
+      print "\t$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ " source
   }
 }
 
diff --git a/sys/unix/hints/include/cross-post.2020 b/sys/unix/hints/include/cross-post.2020
new file mode 100644 (file)
index 0000000..14b54fc
--- /dev/null
@@ -0,0 +1,110 @@
+#===============-=================================================
+# NetHack 3.7  include/cross-post $NHDT-Date: 1597332785 2020/08/13 15:33:05 $  $NHDT-Branch: NetHack-3.7 $
+#
+# Cross-compiling -POST section
+
+#
+# Lua lib
+$(LUACROSSLIB): $(LUALIBOBJS)
+       if [ -f $@ ]; then rm $@; fi;
+       $(TARGET_AR) rcS $@ $(LUAOBJFILES1)
+       $(TARGET_AR) rcS $@ $(LUAOBJFILES2)
+       $(TARGET_AR) rcS $@ $(LUAOBJFILES3)
+       $(TARGET_AR) rcs $@ $(LUAOBJFILES4)
+ifdef WANT_WIN_CURSES
+$(TARGETDIR)/pdclib.a : $(PDCLIBOBJS) $(PDCOBJS)
+       if [ -f $@ ]; then rm $@; fi;
+       $(TARGET_AR) rcs $@ $(PDCLIBOBJS) $(PDCOBJS)
+endif
+#
+# Lua src
+$(TARGETDIR)/lapi.o : $(LUATOP)/src/lapi.c
+$(TARGETDIR)/lauxlib.o : $(LUATOP)/src/lauxlib.c
+$(TARGETDIR)/lbaselib.o : $(LUATOP)/src/lbaselib.c
+$(TARGETDIR)/lbitlib.o : $(LUATOP)/src/lbitlib.c
+$(TARGETDIR)/lcode.o : $(LUATOP)/src/lcode.c
+$(TARGETDIR)/lcorolib.o : $(LUATOP)/src/lcorolib.c
+$(TARGETDIR)/lctype.o : $(LUATOP)/src/lctype.c
+$(TARGETDIR)/ldblib.o : $(LUATOP)/src/ldblib.c
+$(TARGETDIR)/ldebug.o : $(LUATOP)/src/ldebug.c
+$(TARGETDIR)/ldo.o : $(LUATOP)/src/ldo.c
+$(TARGETDIR)/ldump.o : $(LUATOP)/src/ldump.c
+$(TARGETDIR)/lfunc.o : $(LUATOP)/src/lfunc.c
+$(TARGETDIR)/lgc.o : $(LUATOP)/src/lgc.c
+$(TARGETDIR)/linit.o : $(LUATOP)/src/linit.c
+$(TARGETDIR)/liolib.o : $(LUATOP)/src/liolib.c
+$(TARGETDIR)/llex.o : $(LUATOP)/src/llex.c
+$(TARGETDIR)/lmathlib.o : $(LUATOP)/src/lmathlib.c
+$(TARGETDIR)/lmem.o : $(LUATOP)/src/lmem.c
+$(TARGETDIR)/loadlib.o : $(LUATOP)/src/loadlib.c
+$(TARGETDIR)/lobject.o : $(LUATOP)/src/lobject.c
+$(TARGETDIR)/lopcodes.o : $(LUATOP)/src/lopcodes.c
+$(TARGETDIR)/loslib.o : $(LUATOP)/src/loslib.c
+$(TARGETDIR)/lparser.o : $(LUATOP)/src/lparser.c
+$(TARGETDIR)/lstate.o : $(LUATOP)/src/lstate.c
+$(TARGETDIR)/lstring.o : $(LUATOP)/src/lstring.c
+$(TARGETDIR)/lstrlib.o : $(LUATOP)/src/lstrlib.c
+$(TARGETDIR)/ltable.o : $(LUATOP)/src/ltable.c
+$(TARGETDIR)/ltablib.o : $(LUATOP)/src/ltablib.c
+$(TARGETDIR)/ltm.o : $(LUATOP)/src/ltm.c
+$(TARGETDIR)/lundump.o : $(LUATOP)/src/lundump.c
+$(TARGETDIR)/lutf8lib.o : $(LUATOP)/src/lutf8lib.c
+$(TARGETDIR)/lvm.o : $(LUATOP)/src/lvm.c
+$(TARGETDIR)/lzio.o : $(LUATOP)/src/lzio.c
+#
+# PDCurses src
+#
+$(TARGETDIR)/addch.o : $(PDCTOP)/pdcurses/addch.c
+$(TARGETDIR)/addchstr.o : $(PDCTOP)/pdcurses/addchstr.c
+$(TARGETDIR)/addstr.o : $(PDCTOP)/pdcurses/addstr.c
+$(TARGETDIR)/attr.o : $(PDCTOP)/pdcurses/attr.c
+$(TARGETDIR)/beep.o : $(PDCTOP)/pdcurses/beep.c
+$(TARGETDIR)/bkgd.o : $(PDCTOP)/pdcurses/bkgd.c
+$(TARGETDIR)/border.o : $(PDCTOP)/pdcurses/border.c
+$(TARGETDIR)/clear.o : $(PDCTOP)/pdcurses/clear.c
+$(TARGETDIR)/color.o : $(PDCTOP)/pdcurses/color.c
+$(TARGETDIR)/delch.o : $(PDCTOP)/pdcurses/delch.c
+$(TARGETDIR)/deleteln.o : $(PDCTOP)/pdcurses/deleteln.c
+$(TARGETDIR)/getch.o : $(PDCTOP)/pdcurses/getch.c
+$(TARGETDIR)/getstr.o : $(PDCTOP)/pdcurses/getstr.c
+$(TARGETDIR)/getyx.o : $(PDCTOP)/pdcurses/getyx.c
+$(TARGETDIR)/inch.o : $(PDCTOP)/pdcurses/inch.c
+$(TARGETDIR)/inchstr.o : $(PDCTOP)/pdcurses/inchstr.c
+$(TARGETDIR)/initscr.o : $(PDCTOP)/pdcurses/initscr.c
+$(TARGETDIR)/inopts.o : $(PDCTOP)/pdcurses/inopts.c
+$(TARGETDIR)/insch.o : $(PDCTOP)/pdcurses/insch.c
+$(TARGETDIR)/insstr.o : $(PDCTOP)/pdcurses/insstr.c
+$(TARGETDIR)/instr.o : $(PDCTOP)/pdcurses/instr.c
+$(TARGETDIR)/kernel.o : $(PDCTOP)/pdcurses/kernel.c
+$(TARGETDIR)/keyname.o : $(PDCTOP)/pdcurses/keyname.c
+$(TARGETDIR)/mouse.o : $(PDCTOP)/pdcurses/mouse.c
+$(TARGETDIR)/move.o : $(PDCTOP)/pdcurses/move.c
+$(TARGETDIR)/outopts.o : $(PDCTOP)/pdcurses/outopts.c
+$(TARGETDIR)/overlay.o : $(PDCTOP)/pdcurses/overlay.c
+$(TARGETDIR)/pad.o : $(PDCTOP)/pdcurses/pad.c
+$(TARGETDIR)/panel.o : $(PDCTOP)/pdcurses/panel.c
+$(TARGETDIR)/printw.o : $(PDCTOP)/pdcurses/printw.c
+$(TARGETDIR)/refresh.o : $(PDCTOP)/pdcurses/refresh.c
+$(TARGETDIR)/scanw.o : $(PDCTOP)/pdcurses/scanw.c
+$(TARGETDIR)/scr_dump.o : $(PDCTOP)/pdcurses/scr_dump.c
+$(TARGETDIR)/scroll.o : $(PDCTOP)/pdcurses/scroll.c
+$(TARGETDIR)/slk.o : $(PDCTOP)/pdcurses/slk.c
+$(TARGETDIR)/termattr.o : $(PDCTOP)/pdcurses/termattr.c
+$(TARGETDIR)/touch.o : $(PDCTOP)/pdcurses/touch.c
+$(TARGETDIR)/util.o : $(PDCTOP)/pdcurses/util.c
+$(TARGETDIR)/window.o : $(PDCTOP)/pdcurses/window.c
+$(TARGETDIR)/debug.o : $(PDCTOP)/pdcurses/debug.c
+$(TARGETDIR)/pdcclip.o : $(PDCTOP)/dos/pdcclip.c
+$(TARGETDIR)/pdcdisp.o : $(PDCTOP)/dos/pdcdisp.c
+$(TARGETDIR)/pdcgetsc.o : $(PDCTOP)/dos/pdcgetsc.c
+$(TARGETDIR)/pdckbd.o : $(PDCTOP)/dos/pdckbd.c
+$(TARGETDIR)/pdcscrn.o : $(PDCTOP)/dos/pdcscrn.c
+$(TARGETDIR)/pdcsetsc.o : $(PDCTOP)/dos/pdcsetsc.c
+$(TARGETDIR)/pdcutil.o : $(PDCTOP)/dos/pdcutil.c
+
+
+#
+# End of cross-compiling -POST section
+#===============-=================================================
+
+
diff --git a/sys/unix/hints/include/cross-pre.2020 b/sys/unix/hints/include/cross-pre.2020
new file mode 100644 (file)
index 0000000..4fd3b09
--- /dev/null
@@ -0,0 +1,107 @@
+#===============-=================================================
+# NetHack 3.7  include/cross-pre $NHDT-Date: 1597332785 2020/08/13 15:33:05 $  $NHDT-Branch: NetHack-3.7 $
+#
+# Cross-compiling -PRE section
+#
+ifdef BUILD_LUA
+#===============-=================================================
+# LUA library
+# Source from http://www.lua.org/ftp/lua-5.4.0.tar.gz
+#=================================================================
+LUA_VERSION ?=5.4.0
+LUATOP ?= ../lib/lua-$(LUA_VERSION)
+LUASRCDIR ?= $(LUATOP)/src
+LUAOBJFILES1 =  $(TARGETDIR)/lapi.o $(TARGETDIR)/lauxlib.o \
+               $(TARGETDIR)/lbaselib.o $(TARGETDIR)/lcode.o \
+               $(TARGETDIR)/lcorolib.o $(TARGETDIR)/lctype.o \
+               $(TARGETDIR)/ldblib.o
+ifeq "$(LUA_VERSION)" "5.3.5"
+LUAOBJFILES1 += $(TARGETDIR)/lbitlib.o
+endif
+LUAOBJFILES2 =  $(TARGETDIR)/ldebug.o $(TARGETDIR)/ldo.o $(TARGETDIR)/ldump.o \
+               $(TARGETDIR)/lfunc.o $(TARGETDIR)/lgc.o $(TARGETDIR)/linit.o \
+               $(TARGETDIR)/liolib.o $(TARGETDIR)/llex.o
+LUAOBJFILES3 =  $(TARGETDIR)/lmathlib.o $(TARGETDIR)/lmem.o \
+               $(TARGETDIR)/loadlib.o $(TARGETDIR)/lobject.o \
+               $(TARGETDIR)/lopcodes.o $(TARGETDIR)/loslib.o \
+               $(TARGETDIR)/lparser.o $(TARGETDIR)/lstate.o
+LUAOBJFILES4 =  $(TARGETDIR)/lstring.o $(TARGETDIR)/lstrlib.o \
+               $(TARGETDIR)/ltable.o $(TARGETDIR)/ltablib.o \
+               $(TARGETDIR)/ltm.o $(TARGETDIR)/lundump.o \
+               $(TARGETDIR)/lutf8lib.o $(TARGETDIR)/lvm.o $(TARGETDIR)/lzio.o
+LUALIBOBJS = $(LUAOBJFILES1) $(LUAOBJFILES2) $(LUAOBJFILES3) $(LUAOBJFILES4)
+LUACROSSLIB = $(TARGETDIR)/$(O)lua$(subst .,,$(LUA_VERSION)).a
+LUAINCL  = -I$(LUASRCDIR)
+BUILDMORE += $(LUACROSSLIB)
+override TARGET_LIBS += $(LUACROSSLIB) -lm
+else
+LUAINCL=
+endif  # BUILD_LUA
+
+ifdef BUILD_PDCURSES
+#===============-=================================================
+# PD Curses library
+#===============-=================================================
+ifdef WANT_WIN_CURSES
+PDCTOP = ../lib/pdcurses
+PDCURSESDEF= -I../lib/pdcurses -I../lib/pdcurses/dos \
+               -D"CURSES_GRAPHICS" -D"CURSES_BRIEF_INCLUDE"
+PDCLIBOBJ1= $(TARGETDIR)/addch.o $(TARGETDIR)/addchstr.o \
+               $(TARGETDIR)/addstr.o $(TARGETDIR)/attr.o \
+               $(TARGETDIR)/beep.o $(TARGETDIR)/bkgd.o \
+               $(TARGETDIR)/border.o $(TARGETDIR)/clear.o \
+               $(TARGETDIR)/color.o $(TARGETDIR)/delch.o \
+               $(TARGETDIR)/deleteln.o $(TARGETDIR)/getch.o \
+               $(TARGETDIR)/getstr.o $(TARGETDIR)/getyx.o \
+               $(TARGETDIR)/inch.o
+PDCLIBOBJ2= $(TARGETDIR)/inchstr.o $(TARGETDIR)/initscr.o \
+               $(TARGETDIR)/inopts.o $(TARGETDIR)/insch.o \
+               $(TARGETDIR)/insstr.o $(TARGETDIR)/instr.o \
+               $(TARGETDIR)/kernel.o $(TARGETDIR)/keyname.o \
+               $(TARGETDIR)/mouse.o $(TARGETDIR)/move.o \
+               $(TARGETDIR)/outopts.o $(TARGETDIR)/overlay.o
+PDCLIBOBJ3= $(TARGETDIR)/pad.o $(TARGETDIR)/panel.o $(TARGETDIR)/printw.o \
+               $(TARGETDIR)/refresh.o $(TARGETDIR)/scanw.o \
+               $(TARGETDIR)/scr_dump.o $(TARGETDIR)/scroll.o \
+               $(TARGETDIR)/slk.o $(TARGETDIR)/termattr.o
+PDCLIBOBJ4= $(TARGETDIR)/touch.o $(TARGETDIR)/util.o $(TARGETDIR)/window.o \
+               $(TARGETDIR)/debug.o
+PDCLIBOBJS = $(PDCLIBOBJ1) $(PDCLIBOBJ2) $(PDCLIBOBJ3) $(PDCLIBOBJ4)
+PDCLIB = $(TARGETDIR)/pdclib.a
+PDCINCL = -I$(PDCTOP) -I$(PDCTOP)/pdcurses
+PDCOBJS = $(TARGETDIR)/pdcclip.o $(TARGETDIR)/pdcdisp.o \
+               $(TARGETDIR)/pdcgetsc.o $(TARGETDIR)/pdckbd.o \
+               $(TARGETDIR)/pdcscrn.o $(TARGETDIR)/pdcsetsc.o \
+               $(TARGETDIR)/pdcutil.o
+override TARGET_LIBS += $(PDCLIB)
+BUILDMORE += $(PDCLIB)
+# Rules for PDCurses files
+$(TARGETDIR)/%.o : $(PDCTOP)/pdcurses/%.c
+       $(TARGET_CC) $(PDCINCL) $(TARGET_CFLAGS) -o$@  $<
+else   #WANT_WIN_CURSES
+PDCURSESDEF=
+PDCLIBOBJS=
+PDCOBJS=
+PDCLIB=
+PDCINCL=
+endif  # WANT_WIN_CURSES
+endif  # BUILD_PDCURSES
+
+ifdef WANT_WIN_CURSES
+# rules for pdcurses dos-specific files
+$(TARGETDIR)/%.o : $(PDCTOP)/sdl1/%.c
+       $(TARGET_CC) $(PDCINCL) $(TARGET_CFLAGS) -o$@  $<
+endif  # WANT_WIN_CURSES
+# Rule for LUA files
+$(TARGETDIR)/%.o : $(LUATOP)/src/%.c
+       $(TARGET_CC) $(TARGET_CFLAGS) $(LUA_FLAGS) -o$@ $<
+ifdef WANT_WIN_CURSES
+# Rules for PDCurses files
+$(TARGETDIR)/%.o : $(PDCTOP)/pdcurses/%.c
+       $(TARGET_CC) $(PDCINCL) $(TARGET_CFLAGS) -o$@  $<
+endif  # WANT_WIN_CURSES
+
+# 
+# End of cross-compiling -PRE section
+#===============-=================================================
+
index 6928df837f616aeb4c81a7648576bd6d0114a20f..ff2d0917d6df5be1d3efc08c3a874a9768dc7bec 100755 (executable)
@@ -204,3 +204,10 @@ CHGRP=true
 VARDIRPERM = 0755
 VARFILEPERM = 0600
 GAMEPERM = 0755
+#
+#-INCLUDE cross-pre.2020
+#
+#-POST
+#
+#-INCLUDE cross-post.2020
+#
index 937e5515163ed3b794be88841b7463a5c7492b4a..aeac9d41bdd5136da2f020b5133716b3f4fedfbb 100755 (executable)
@@ -274,8 +274,11 @@ VARDIR=$(HACKDIR)
 #
 # Install.Qt mentions a patch for macos - it's not there (it seems to be in the Qt binary
 # package under the docs directory).
-
+#
+#-INCLUDE cross-pre.2020
+#
 #-POST
+
 ifdef MAKEFILE_TOP
 ###
 ### Packaging
@@ -456,3 +459,6 @@ else
 endif  # end of build_qt_pkg
 endif  # WANT_WIN_QT for packaging
 endif  # MAKEFILE_TOP
+#
+#-INCLUDE cross-post.2020
+#
index 17d56d706b3e4e40d908ae574f6c03cd0c46d935..90e1346576aa3f91f31201f709f7a2546903f4d7 100755 (executable)
@@ -40,5 +40,6 @@ echo "### Start $5 POST" >> $3
 echo "###" >> $3
 awk '/^#-POST/,/^#-PRE/{ \
        if(index($0, "#-POST") == 1) print "# (new segment at source line",NR,")"; \
-       if(index($0, "#-P") != 1) print}' $4 >> $3
+       if(index($0, "#-INCLUDE") == 1) system("cat hints/include/"$2); \
+       else if(index($0, "#-P") != 1) print}' $4 >> $3
 echo "### End $5 POST" >> $3