Files
nethack/sys/unix/Makefile.utl
nhmall a654d08c3b save/restore changes - part 3
This is the third of a series of savefile-related changes.

    This adds early-days experimental support for a completely optional
    'sfctool' utility (savefile conversion tool), to be able to export
    a savefile's contents into a more portable format. There are likely
    to be bugs at this stage. In this initial first-attempt, the export
    format is a very simple ascii output.

    NetHack can be built entirely, without also building this tool.
    NetHack has no dependencies on the tool.

    Attempts were made to minimize duplication of existing NetHack code.
    To achieve that, unfortunately, #ifdef SFCTOOL and #ifndef SFCTOOL
    had to be sprinkled around through some of the existing NetHack
    source code, so that it could be re-used for building the utility.

    The process for building the sfctool typically recompiles the source
    files with #define SFCTOOL and a distinct object file with SF- is
    produced.

sfctool notes:

    Universal ctags is used and required to produce the sfctool utility.

    Some targets were added to the Unix and Windows Makefiles to
    facilitate the build process.

         make sfctool

    That should build a copy in util.

    Note: At present, the Unix Makefiles do not copy sfctool over to the
          NetHack playground during 'make install' or 'make update'.
          Until that gets resolved by someone, The tool will
          have to be manually copied there by the builder/admin if
          desired.
          cp util/sfctool ~/nh/install/games/lib/nethackdir/sfctool

    Also, a separate Visual Studio sfctool.sln solution was written and
    placed in sys/windows/vs. That has has only very limited testing.

    Usage:

      i)  To convert an existing savefile to an exportascii format
          that co-resides with the savefile:

          sfctool -c savefile

          That *must* be executed on the same platform / architecture /
          data model that produced the save file in the first place.

     ii)  To unconvert an existing exportascii format export file to a
          historical format savefile that can then be used by NetHack:

          sfctool -u savefile

          That must be executed on the same target platform / architecture /
          data model that was used to build the NetHack that will
          utilize the save file that results.

     A Windows example:

          sfctool -c Fred.NetHack-saved-game

          That should result in creation of Fred.NetHack-saved-game.exportascii
          from existing savefile:
              %USERPROFILE%\AppData\Local\NetHack\3.7\Fred.NetHack-saved-game

     A Unix example:

          sfctool -c 1000wizard

          That should result in creation of 1000wizard.exportascii.gz
          from existing savefile in the playground save directory:
              1000wizard.gz

  Current Mechanics:
     1. Makefile recipe, or script uses universal ctags to produce
        util/sf.tags.

     2. util/sftags is built and executed to read util/sf.tags and
        generate: include/sfproto.h and src/sfdata.c.

     3. util/sfctool is built from the following:
        generated file compiled with -DSFCTOOL:
                    src/sfdata.c       -> sfdata.o
        existing files compiled with -DSFCTOOL:
                    util/sfctool.c     -> sfctool.o
                    util/sfexpasc.c    -> sfexpasc.o
                    src/alloc.c        -> sf-alloc.o
                    src/monst.c        -> sf-monst.o
                    src/objects.c      -> sf-objects.o
                    src/sfbase.c       -> sfbase.o
                    src/sfstruct.c     -> sfstruct.o
                    src/nhlua.c        -> sf-nhlua.o
                    util/panic.c       -> panic.o
                    src/date.c         -> sf-date.o
                    src/decl.c         -> sf-decl.o
                    src/artifact.c     -> sf-artifact.o
                    src/dungeon.c      -> sf-dungeon.o
                    src/end.c          -> sf-end.o
                    src/engrave.c      -> sf-engrave.o
                    src/cfgfiles.c     -> sf-cfgfiles.o
                    src/files.c        -> sf-files.o
                    src/light.c        -> sf-light.o
                    src/mdlib.c        -> sf-mdlib.o
                    src/mkmaze.c       -> sf-mkmaze.o
                    src/mkroom.c       -> sf-mkroom.o
                    src/o_init.c       -> sf-o_init.o
                    src/region.c       -> sf-region.o
                    src/restore.c      -> sf-restore.o
                    src/rumors.c       -> sf-rumors.o
                    src/sys.c          -> sf-sys.o
                    src/timeout.c      -> sf-timeout.o
                    src/track.c        -> sf-track.o
                    src/version.c      -> sf-version.o
                    src/worm.c         -> sf-worm.o
                    src/strutil.c      -> strutil.o
2025-05-25 20:38:17 -04:00

626 lines
24 KiB
Makefile

# Makefile for NetHack's utility programs.
# NetHack 3.7 Makefile.utl $NHDT-Date: 1693334279 2023/08/29 18:37:59 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.68 $
# Copyright (c) 2018 by Robert Patrick Rankin
# NetHack may be freely redistributed. See license for details.
#
# Note: as of nethack 3.7, 'lev_comp' and 'dgn_comp' are no longer present
# so use of yacc and lex to build them is no longer required.
#
# Root of source tree:
NHSROOT=..
# newer makes predefine $(MAKE) to 'make' and do smarter processing of
# recursive make calls if $(MAKE) is used
# these makes allow $(MAKE) to be overridden by the environment if someone
# wants to (or has to) use something other than the standard make, so we do
# not want to unconditionally set $(MAKE) here
#
# unfortunately, some older makes do not predefine $(MAKE); if you have one of
# these, uncomment the following line
# (you will know that you have one if you get complaints about unable to
# execute things like 'foo.o')
# MAKE = make
# NetHack 3.7 began introducing C99 code.
#
# If your compiler needs an appropriate switch to accept C99 code.
# CSTD = -std=c99
# if you are using gcc as your compiler,
# uncomment the CC definition below if it's not in your environment
# CC = gcc
#
# For Bull DPX/2 systems at B.O.S. 2.0 or higher use the following:
#
# CC = gcc -ansi -D_BULL_SOURCE -D_XOPEN_SOURCE -D_POSIX_SOURCE
#
# If you are using GCC 2.2.2 or higher on a DPX/2, just use:
#
# CC = gcc -ansi
#
# For HP/UX 10.20 with GCC:
# CC = gcc -D_POSIX_SOURCE
#
# if your make doesn't define a default SHELL properly, you may need
# the line below (Atari users will need a bourne work-alike)
# SHELL = /bin/sh
# for Atari
# SHELL=E:/GEMINI2/MUPFEL.TTP
# flags may have to be changed as required
# flags for 286 Xenix:
# CFLAGS = -Ml2t16 -O -LARGE -I../include
# LFLAGS = -Ml -F 4000 -SEG 512
# flags for 286 Microport SysV-AT
# CFLAGS = -DDUMB -Ml -I../include
# LFLAGS = -Ml
# flags for Atari GCC (3.2.1)
# CFLAGS = -O -I../include
# LFLAGS = -s
# flags for Atari GCC (3.3)
# CFLAGS = -mshort -O2 -I../include
# LFLAGS = -mshort -s
# flags for Apollos using their native cc
# (as long as it claims to be __STDC__ but isn't)
# CFLAGS = -DAPOLLO -O -I../include
# flags for AIX 3.1 cc on IBM RS/6000 to define
# a suitable subset of standard libraries
# (note that there is more info regarding the "-qchars=signed"
# switch in file Install.unx note 8)
# CFLAGS = -D_NO_PROTO -D_XOPEN_SOURCE -O -I../include -qchars=signed
# and for AIX 3.2:
# CFLAGS = -D_NO_PROTO -D_XOPEN_SOURCE -D_ALL_SOURCE -O -I../include -qchars=signed
# flags for A/UX 2.01 using native cc or c89
# gcc predefines AUX so that's not needed there
# CFLAGS = -ZS -D_POSIX_SOURCE -O -I../include -DAUX
# flags for IRIX 4.0.x using native cc
# SGI cc 3.10 will fail to compile makedefs with -O
# CFLAGS = -I../include -D__STDC__ -woff 100,293
# flags for Linux
# compile normally
# CFLAGS = -O2 -fomit-frame-pointer -I../include
# LFLAGS = -L/usr/X11R6/lib
# OR compile backwards compatible a.out format
# CFLAGS = -O2 -b i486-linuxaout -fomit-frame-pointer -I../include
# LFLAGS = -b i486-linuxaout -L/usr/X11R6/lib
# flags for BeOS using the command line
# BeOS on a Mac/BeBox:
#CC = mwcc
#CFLAGS = -I../include
# BeOS on Intel:
# the default values are fine
# flags for debugging:
# CFLAGS = -g -I../include
#CFLAGS = -O -I../include
#LFLAGS =
# -lm required by lua
LFLAGS += -lm
# we specify C preprocessor flags via CFLAGS; files built with default rules
# might include $(CPPFLAGS) which could get a value from user's environment;
# we avoid that by forcing it empty rather than by overriding default rules
CPPFLAGS =
LIBS =
OBJDIR = ../src
# This is the universal ctags utility which produces the tags in the
# format that util/readtags requires.
# https://github.com/universal-ctags/ctags.git
#CTAGSCMD = universal-ctags
CTAGSCMD = ctags
# if you change this to 1, feedback while building will omit -Dthis -Wthat
# -Isomewhere so that each file being compiled is listed on one short line;
# it requires support for '$<' in rules with more than one prerequisite
# (rather than just in suffix default rule), such as is implemented by
# gnu make and others which have picked up its extensions;
# allowed values are 0, 1, and empty (which behaves like 0)
QUIETCC=0
# TODO? the link/load commands below are handled differently from the ones
# in Makefile.src; these use '$(CC) $(LFLAGS)' and ought to be changed to use
# $(LD) or $(LINK) as appropriate [quiet mode echoes a misleading $< value]
# [LINK might be defined to use $(CXX); we don't want that here.]
CLINK=$(CC)
CXXLINK=$(CXX)
# ----------------------------------------
#
# Nothing below this line should have to be changed.
# Verbosity definitions, begin
# Set QUIETCC=1 above to output less feedback while building.
# CC and CXX obey verbosity, LD and LINK don't.
# AT is @ when not verbose, empty otherwise
ACTUAL_CC := $(CC)
ACTUAL_CXX := $(CXX)
ACTUAL_LD := $(LD)
ACTUAL_CLINK := $(CLINK)
CC_V0 = $(ACTUAL_CC)
CC_V = $(CC_V0)
CC_V1 = @echo "[CC] $<"; $(ACTUAL_CC)
CC = $(CC_V$(QUIETCC))
CXX_V0 = $(ACTUAL_CXX)
CXX_V = $(CXX_V0)
CXX_V1 = @echo "[CXX] $<"; $(ACTUAL_CXX)
CXX = $(CXX_V$(QUIETCC))
# LD and LINK might be based on invoking CC and may not be able to substitute
# for QUIETCC, so feedback from them is handled differently (via $AT)
LD = $(ACTUAL_LD)
CLINK = $(ACTUAL_CLINK)
AT_V0 :=
AT_V := $(AT_V0)
AT_V1 := @
AT = $(AT_V$(QUIETCC))
# Verbosity, end
GAME=nethack
# timestamps for primary header files, matching src/Makefile
CONFIG_H = ../src/config.h-t
HACK_H = ../src/hack.h-t
# utility .c files
MAKESRC = makedefs.c ../src/mdlib.c
RECOVSRC = recover.c
DLBSRC = dlb_main.c
UTILSRCS = $(MAKESRC) panic.c $(RECOVSRC) $(DLBSRC)
# files that define all monsters and objects
CMONOBJ = ../src/monst.c ../src/objects.c
OMONOBJ = $(OBJDIR)/monst.o $(OBJDIR)/objects.o
# files that provide access to NetHack's names
CNAMING = ../src/drawing.c $(CMONOBJ)
ONAMING = $(OBJDIR)/drawing.o $(OMONOBJ)
# dynamic memory allocation
CALLOC = ../src/alloc.c panic.c
OALLOC = $(OBJDIR)/alloc.o panic.o
# build time info
CDATE = ../src/date.c
ODATE = $(OBJDIR)/date.o
# hacklib utility routines
HACKLIB = $(OBJDIR)/hacklib.a
HACKLIBSRC = ../src/hacklib.c
HACKLIBOBJ = $(OBJDIR)/hacklib.o panic.o
# object files for makedefs
MAKEOBJS = makedefs.o $(OMONOBJ) $(ODATE) $(OALLOC)
# object files for recovery utility
RECOVOBJS = recover.o recover-version.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) $(CSTD)
TARGET_CLINK = $(CLINK)
TARGET_LFLAGS = $(LFLAGS)
TARGET_CXX = $(CXX)
TARGET_CXXFLAGS = $(CXXFLAGS)
TARGET_AR = $(AR)
#
# dependencies for makedefs
#
makedefs: $(HACKLIB) $(MAKEOBJS) mdgrep.h
$(CLINK) $(LFLAGS) -o makedefs $(MAKEOBJS) $(HACKLIB)
# note: the headers listed here are maintained manually rather than via
# 'make depend'; only the ones which are directly included by
# makedefs.c are listed, without various nested ones that they include;
# for makedefs (but not for nethack's core), mdlib.c gets included
# rather than be compiled separately
makedefs.o: makedefs.c ../src/mdlib.c $(CONFIG_H) \
../include/permonst.h ../include/objclass.h \
../include/artilist.h ../include/dungeon.h ../include/obj.h \
../include/monst.h ../include/monsters.h ../include/objects.h \
../include/you.h ../include/context.h ../include/flag.h \
../include/dlb.h ../include/patchlevel.h mdgrep.h
$(CC) $(CFLAGS) $(CSTD) -c makedefs.c -o $@
$(OBJDIR)/hacklib.o: $(HACKLIBSRC)
# Don't require perl to build; that is why mdgrep.h is spelled wrong below.
mdgreph: mdgrep.pl
perl mdgrep.pl
# These are for reference purposes only. They aren't required in the build.
../include/onames.h: makedefs ../include/objects.h
./makedefs -o
../include/pm.h: makedefs ../include/monsters.h
./makedefs -p
lintdefs:
@lint -axbh -I../include -DLINT $(MAKESRC) $(CMONOBJ) | sed '/_flsbuf/d'
# we defer this makedefs call to the src Makefile, since it knows all about
# the main src and include files date.h is a timestamp for
../include/date.h::
@( cd ../src ; $(MAKE) ../include/date.h )
$(HACKLIB): $(CONFIG_H) $(HACKLIBSRC) panic.o
@( cd ../src ; $(MAKE) hacklib.a )
# support code used by several of the utility programs (but not makedefs)
panic.o: panic.c $(CONFIG_H)
$(CC) $(CFLAGS) $(CSTD) -c panic.c -o $@
# with all of extern.h's functions to complain about, we drown in
# 'defined but not used' without -u
lintdgn:
@lint -axhu -I../include -DLINT $(UTILSRCS) $(CALLOC) \
| sed '/_flsbuf/d'
# dependencies for recover
#
recover: $(RECOVOBJS) $(HACKLIB)
$(CLINK) $(LFLAGS) -o recover \
$(RECOVOBJS) $(HACKLIB) $(LIBS)
recover.o: recover.c $(CONFIG_H)
$(CC) $(CFLAGS) $(CSTD) -c recover.c -o $@
recover-version.o: ../src/version.c $(HACK_H)
$(CC) $(CFLAGS) $(CSTD) -DMINIMAL_FOR_RECOVER -c ../src/version.c -o $@
#
# dependencies for optional sfctool
#
# object files for sfctool utility
SFCTOOLOBJS = $(TARGETPFX)sfctool.o $(TARGETPFX)sf-alloc.o \
$(TARGETPFX)sf-monst.o $(TARGETPFX)sf-objects.o \
$(TARGETPFX)sfbase.o $(TARGETPFX)sfstruct.o \
$(TARGETPFX)sfexpasc.o \
$(TARGETPFX)sfdata.o $(TARGETPFX)sf-nhlua.o \
$(TARGETPFX)panic.o $(TARGETPFX)sf-date.o \
$(TARGETPFX)sf-decl.o $(TARGETPFX)sf-artifact.o \
$(TARGETPFX)sf-dungeon.o $(TARGETPFX)sf-end.o \
$(TARGETPFX)sf-engrave.o $(TARGETPFX)sf-cfgfiles.o \
$(TARGETPFX)sf-files.o $(TARGETPFX)sf-light.o \
$(TARGETPFX)sf-mdlib.o $(TARGETPFX)sf-mkmaze.o \
$(TARGETPFX)sf-mkroom.o $(TARGETPFX)sf-o_init.o \
$(TARGETPFX)sf-region.o $(TARGETPFX)sf-restore.o \
$(TARGETPFX)sf-rumors.o $(TARGETPFX)sf-sys.o \
$(TARGETPFX)sf-timeout.o $(TARGETPFX)sf-track.o \
$(TARGETPFX)sf-version.o $(TARGETPFX)sf-worm.o \
$(TARGETPFX)strutil.o
SFCTOOLBIN = sfctool
SFFLAGS=-DSFCTOOL -DNOPANICTRACE -DNOCRASHREPORT -DNO_CHRONICLE
sfutil: $(SFCTOOLBIN)
@echo '$(SFCTOOLBIN) is up to date.'
$(SFCTOOLBIN): $(SFCTOOLOBJS) $(HACKLIB)
$(TARGET_CLINK) $(TARGET_LFLAGS) -o $@ $(SFCTOOLOBJS) $(HACKLIB) $(TARGET_LIBS)
$(TARGETPFX)sfctool.o: sfctool.c $(HACK_H) ../include/sfprocs.h
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c sfctool.c
$(TARGETPFX)sfdata.o: sfdata.c $(HACK_H) ../include/sfprocs.h ../include/sfproto.h
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c sfdata.c
$(TARGETPFX)sfexpasc.o: sfexpasc.c $(HACK_H) ../include/sfprocs.h ../include/sfproto.h
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c sfexpasc.c
$(TARGETPFX)sf-alloc.o: ../src/alloc.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/alloc.c
$(TARGETPFX)sf-date.o: ../src/date.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/date.c
$(TARGETPFX)sf-decl.o: ../src/decl.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/decl.c
$(TARGETPFX)sf-panic.o: panic.c $(CONFIG_H)
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c panic.c
$(TARGETPFX)sf-monst.o: ../src/monst.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/monst.c
$(TARGETPFX)sf-objects.o: ../src/objects.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/objects.c
$(TARGETPFX)sf-sfbase.o: ../src/sfbase.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/sfbase.c
$(TARGETPFX)sfstruct.o: ../src/sfstruct.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/sfstruct.c
$(TARGETPFX)sf-artifact.o: ../src/artifact.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/artifact.c
$(TARGETPFX)sf-dungeon.o: ../src/dungeon.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/dungeon.c
$(TARGETPFX)sf-end.o: ../src/end.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/end.c
$(TARGETPFX)sf-engrave.o: ../src/engrave.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/engrave.c
$(TARGETPFX)sf-cfgfiles.o: ../src/cfgfiles.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/cfgfiles.c
$(TARGETPFX)sf-files.o: ../src/files.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/files.c
$(TARGETPFX)sf-light.o: ../src/light.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/light.c
$(TARGETPFX)sf-mdlib.o: ../src/mdlib.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/mdlib.c
$(TARGETPFX)sf-mkmaze.o: ../src/mkmaze.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/mkmaze.c
$(TARGETPFX)sf-mkroom.o: ../src/mkroom.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/mkroom.c
$(TARGETPFX)sf-o_init.o: ../src/o_init.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/o_init.c
$(TARGETPFX)sf-region.o: ../src/region.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/region.c
$(TARGETPFX)sf-restore.o: ../src/restore.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/restore.c
$(TARGETPFX)sf-rumors.o: ../src/rumors.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/rumors.c
$(TARGETPFX)sf-sys.o: ../src/sys.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/sys.c
$(TARGETPFX)sf-timeout.o: ../src/timeout.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/timeout.c
$(TARGETPFX)sf-track.o: ../src/track.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/track.c
$(TARGETPFX)sf-version.o: ../src/version.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/version.c
$(TARGETPFX)sf-worm.o: ../src/worm.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/worm.c
$(TARGETPFX)sf-nhlua.o: ../src/nhlua.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/nhlua.c
$(TARGETPFX)sfbase.o: ../src/sfbase.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/sfbase.c
$(TARGETPFX)strutil.o: ../src/strutil.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/strutil.c
sftags: sftags.o
$(CLINK) $(LFLAGS) -o $@ sftags.o $(LIBS)
sftags.o: sftags.c $(HACK_H)
$(CC) $(CFLAGS) -c sftags.c
../include/sfproto.h: sf.tags sftags
./sftags
sfdata.c: sf.tags sftags
./sftags
# dependencies for sftags
# #
CTAGDEP = ../include/align.h ../include/artifact.h ../include/artilist.h \
../include/attrib.h ../include/context.h ../include/coord.h \
../include/decl.h ../include/dungeon.h ../include/engrave.h \
../include/flag.h ../include/func_tab.h ../include/global.h \
../include/hack.h ../include/mextra.h \
../include/mkroom.h ../include/monst.h ../include/defsym.h \
../include/obj.h ../include/objclass.h ../include/prop.h \
../include/quest.h ../include/rect.h ../include/region.h \
../include/rm.h ../include/skills.h ../include/spell.h \
../include/sys.h ../include/timeout.h ../include/trap.h \
../include/you.h ../include/onames.h ../include/wintype.h
# ../include/permonst.h
CTAGSOPT = --language-force=c --sort=no -D"Bitfield(x,n)=unsigned x : n" --excmd=pattern
#
INCL=../include/
SRC=../src/
sf.tags: $(CTAGDEP)
$(CTAGSCMD) $(CTAGSOPT) -f $@ $(INCL)align.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)artifact.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(SRC)artifact.c
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)artilist.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)attrib.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(SRC)bones.c
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)context.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)coord.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)decl.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(SRC)decl.c
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)dungeon.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)engrave.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(SRC)engrave.c
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)flag.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)func_tab.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)global.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)hack.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)mextra.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)mkroom.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)monst.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)defsym.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)obj.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)objclass.h
# $(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)permonst.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)prop.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)quest.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)rect.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)region.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)rm.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)skills.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)spell.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)stairs.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)sys.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)timeout.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)trap.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)you.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)onames.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)wintype.h
# dependencies for dlb
#
dlb: $(DLBOBJS) $(HACKLIB)
$(CLINK) $(LFLAGS) -o dlb $(DLBOBJS) $(HACKLIB) $(LIBS)
dlb_main.o: dlb_main.c $(CONFIG_H) ../include/dlb.h
$(CC) $(CFLAGS) $(CSTD) -c dlb_main.c -o $@
stripbs: stripbs.o
$(CC) $(LFLAGS) -o stripbs stripbs.o
stripbs.o: stripbs.c
$(CC) $(CFLAGS) -c stripbs.c
# dependencies for tile utilities
#
TEXT_IO = tiletext.o tiletxt.o $(OALLOC) $(ONAMING)
GIFREADERS = gifread.o
PPMWRITERS = ppmwrite.o
tileutils: tilemap gif2txt txt2ppm tile2x11
gif2txt: $(GIFREADERS) $(TEXT_IO)
$(CLINK) $(LFLAGS) -o gif2txt $(GIFREADERS) $(TEXT_IO) $(LIBS)
txt2ppm: $(PPMWRITERS) $(TEXT_IO)
$(CLINK) $(LFLAGS) -o txt2ppm $(PPMWRITERS) $(TEXT_IO) $(LIBS)
tile2x11: tile2x11.o $(TEXT_IO) $(HACKLIB)
$(CLINK) $(LFLAGS) -o tile2x11 tile2x11.o $(TEXT_IO) \
$(HACKLIB) $(LIBS)
tile2img.ttp: tile2img.o bitmfile.o $(TEXT_IO)
$(CLINK) $(LFLAGS) -o tile2img.ttp tile2img.o bitmfile.o \
$(TEXT_IO) $(LIBS)
tile2bmp: tile2bmp.o $(TEXT_IO) $(HACKLIB)
$(CLINK) $(LFLAGS) -o tile2bmp tile2bmp.o $(TEXT_IO) $(HACKLIB)
xpm2img.ttp: xpm2img.o bitmfile.o
$(CLINK) $(LFLAGS) -o xpm2img.ttp xpm2img.o bitmfile.o $(LIBS)
tile2beos: tile2beos.o $(TEXT_IO) $(HACKLIB)
$(CXXLINK) $(LFLAGS) -o tile2beos tile2beos.o \
$(TEXT_IO) $(HACKLIB) -lbe
#--compiling and linking in one step leaves extra debugging files (in their
# own subdirectories!) on OSX; compile and link separately to suppress
# that without mucking about with extra OS-specific CFLAGS and/or LFLAGS
#tilemap: ../win/share/tilemap.c $(HACK_H)
# $(CC) $(CFLAGS) $(LFLAGS) -o tilemap ../win/share/tilemap.c $(LIBS)
tilemap: tilemap.o $(OBJDIR)/objects.o $(OBJDIR)/monst.o $(OBJDIR)/drawing.o \
$(HACKLIB)
$(CLINK) $(LFLAGS) -o tilemap tilemap.o $(OBJDIR)/objects.o \
$(OBJDIR)/monst.o $(OBJDIR)/drawing.o $(HACKLIB) \
$(LIBS)
../src/tile.c: tilemap
./tilemap
tiletext.o: ../win/share/tiletext.c $(CONFIG_H) ../win/share/tile.h
$(CC) $(CFLAGS) $(CSTD) -I../win/share -c ../win/share/tiletext.c -o $@
tiletxt.o: ../win/share/tiletxt.c ../win/share/tilemap.c $(HACK_H)
$(CC) $(CFLAGS) $(CSTD) -I../win/share -c ../win/share/tiletxt.c -o $@
tilemap.o: ../win/share/tilemap.c $(HACK_H)
$(CC) $(CFLAGS) $(CSTD) -c ../win/share/tilemap.c -o $@
gifread.o: ../win/share/gifread.c $(CONFIG_H) ../win/share/tile.h
$(CC) $(CFLAGS) $(CSTD) -I../win/share -c ../win/share/gifread.c -o $@
ppmwrite.o: ../win/share/ppmwrite.c $(CONFIG_H) ../win/share/tile.h
$(CC) $(CFLAGS) $(CSTD) -I../win/share -c ../win/share/ppmwrite.c -o $@
tile2bmp.o: ../win/share/tile2bmp.c $(HACK_H) ../win/share/tile.h
$(CC) $(CFLAGS) $(CSTD) -I../win/share -c ../win/share/tile2bmp.c -o $@
tile2x11.o: ../win/X11/tile2x11.c $(HACK_H) ../win/share/tile.h \
../include/tile2x11.h
$(CC) $(CFLAGS) $(CSTD) -I../win/share -c ../win/X11/tile2x11.c -o $@
tile2img.o: ../win/gem/tile2img.c $(HACK_H) ../win/share/tile.h \
../include/bitmfile.h
$(CC) $(CFLAGS) $(CSTD) -I../win/share -c ../win/gem/tile2img.c -o $@
xpm2img.o: ../win/gem/xpm2img.c $(HACK_H) ../include/bitmfile.h
$(CC) $(CFLAGS) $(CSTD) -c ../win/gem/xpm2img.c -o $@
bitmfile.o: ../win/gem/bitmfile.c ../include/bitmfile.h
$(CC) $(CFLAGS) $(CSTD) -c ../win/gem/bitmfile.c -o $@
tile2beos.o: ../win/BeOS/tile2beos.cpp $(HACK_H) ../win/share/tile.h
$(CXX) $(CFLAGS) $(CSTD) -I../win/share -c ../win/BeOS/tile2beos.cpp -o $@
# note: tileedit.cpp was developed for Qt2 and will not compile using Qt5
tileedit.o: ../win/Qt/tileedit.cpp
$(CXX) -I../include -I$(QTDIR)/include ../win/Qt/tileedit.cpp
tileedit: tileedit.o $(TEXT_IO)
$(QTDIR)/bin/moc -o tileedit.moc tileedit.h
$(CXXLINK) -o tileedit -L$(QTDIR)/lib tileedit.o $(TEXT_IO) -lqt
uudecode: uudecode.o
$(CLINK) $(LFLAGS) -o uudecode uudecode.o $(LIBS)
uudecode.o: ../sys/share/uudecode.c
$(CC) $(CFLAGS) $(CSTD) -c -o uudecode.o ../sys/share/uudecode.c
# using dependencies like
# ../src/foo::
# @( cd ../src ; $(MAKE) foo )
# would always force foo to be up-to-date according to the src Makefile
# when it's needed here. Unfortunately, some makes believe this syntax
# means foo always changes, instead of foo should always be checked.
# therefore, approximate via config.h dependencies, and hope that anybody
# changing anything other than basic configuration also knows when not
# to improvise things not in the instructions, like 'make makedefs' here
# in util...
# make sure host object files from src are available when needed
# (note: these dependencies have been copied from Makefile.src so only come
# indirectly from 'make depend', hence are subject to bit rot as src changes)
$(OBJDIR)/alloc.o: ../src/alloc.c $(CONFIG_H) ../include/nhlua.h
$(CC) $(CFLAGS) $(CSTD) -c ../src/alloc.c -o $@
$(OBJDIR)/drawing.o: ../src/drawing.c $(CONFIG_H) ../include/color.h \
../include/rm.h ../include/objclass.h ../include/defsym.h \
../include/objects.h ../include/sym.h
$(CC) $(CFLAGS) $(CSTD) -c ../src/drawing.c -o $@
$(OBJDIR)/decl.o: ../src/decl.c $(HACK_H)
$(CC) $(CFLAGS) $(CSTD) -c ../src/decl.c -o $@
$(OBJDIR)/monst.o: ../src/monst.c $(CONFIG_H) ../include/permonst.h \
../include/align.h ../include/monattk.h ../include/monflag.h \
../include/monsters.h ../include/wintype.h ../include/sym.h \
../include/defsym.h ../include/color.h
$(CC) $(CFLAGS) $(CSTD) -c ../src/monst.c -o $@
$(OBJDIR)/objects.o: ../src/objects.c $(CONFIG_H) ../include/obj.h \
../include/prop.h ../include/skills.h ../include/color.h \
../include/objclass.h ../include/defsym.h ../include/objects.h
$(CC) $(CFLAGS) $(CSTD) -c ../src/objects.c -o $@
$(OBJDIR)/dlb.o: ../src/dlb.c $(CONFIG_H) ../include/dlb.h
$(CC) $(CFLAGS) $(CSTD) -c ../src/dlb.c -o $@
# this differs substantially from what Makefile.src specifies
$(OBJDIR)/date.o: ../src/date.c $(CONFIG_H)
$(CC) $(CFLAGS) $(CSTD) -c ../src/date.c -o $@
../include/nhlua.h:
@( cd .. ; $(MAKE) lua_support )
# make sure hack.h dependencies get transitive information
$(HACK_H): $(CONFIG_H)
@( cd ../src ; $(MAKE) $(HACK_H) )
$(CONFIG_H): ../include/config.h
@( cd ../src ; $(MAKE) $(CONFIG_H) )
SYSSHARE=../sys/share/
tags: $(UTILSRCS)
@ctags -tw $(UTILSRCS)
# note: 3.6 copied tile.h from win/share/ to include/ and if someone
# switches branches from 3.6 to 3.7 without executing 'make spotless'
# first, the old tile.h sticks around and gets found during compile
# instead of current one; various tile utilities won't build in that
# mis-configuration so allow 'make clean' and 'make spotless' in 3.7
# to fix things up by deleting the out of date file (if present)
clean-fixup:
-rm -f ../include/tile.h
clean: clean-fixup
-rm -f *.o
# obsolete dgn_comp and lev_comp could be left around from 3.6.x
spotless: clean
-rm -f makedefs recover dlb $(HACKLIB)
-rm -f gif2txt txt2ppm tile2x11 tile2img.ttp xpm2img.ttp \
tilemap tileedit tile2bmp uudecode
-rm -f dgn_comp* dgn_lex.c dgn_yacc.c ../include/dgn_comp.h \
lev_comp* lev_lex.c lev_yacc.c ../include/lev_comp.h