make system cleanup

This commit is contained in:
Adam Powers
2020-08-27 21:38:21 -07:00
parent e5604d575f
commit 18254eb291
7 changed files with 12 additions and 326 deletions

View File

@@ -600,6 +600,7 @@ $(WASM_DATA_DIR):
touch $(WASM_DATA_DIR)/record
touch $(WASM_DATA_DIR)/logfile
touch $(WASM_DATA_DIR)/xlogfile
( cd ..; $(MAKE) dlb )
( cd ..; $(MAKE) dofiles-dlb )
cp ../sys/lib/sysconf $(WASM_DATA_DIR)/sysconf
@@ -767,7 +768,7 @@ tags: $(CSOURCES)
@( cd ../util ; $(MAKE) tags )
clean:
-rm -f *.o $(HACK_H) $(CONFIG_H) $(WASM_TARGET) $(WASM_TARGET:.js=.wasm) $(LIBNH_TARGET)
-rm -f *.o $(HACK_H) $(CONFIG_H) $(WASM_TARGET) $(WASM_TARGET:.js=.wasm) $(WASM_TARGET:.js=.data) $(LIBNH_TARGET)
-rm -rf $(WASM_DATA_DIR)
spotless: clean

View File

@@ -211,7 +211,7 @@ title.img:
check-dlb: options
@if egrep -s librarian dat/options ; then $(MAKE) dlb ; else true ; fi
dlb:
dlb: $(VARDATD)
( cd util ; $(MAKE) dlb )
( cd dat ; LC_ALL=C ; ../util/dlb cf nhdat $(DATDLB) )
@@ -320,13 +320,11 @@ clean:
( cd src ; $(MAKE) clean )
( cd util ; $(MAKE) clean )
( cd dat ; $(MAKE) clean )
( cd doc ; $(MAKE) clean )
( cd lib/lua-$(LUA_VERSION)/src && $(MAKE) clean )
# 'make spotless' returns the source tree to near-distribution condition.
# it removes .o files, executables, and compiled data files
spotless::
spotless: clean
( cd src ; $(MAKE) spotless )
( cd util ; $(MAKE) spotless )
( cd dat ; $(MAKE) spotless )
( cd doc ; $(MAKE) spotless )

View File

@@ -95,6 +95,7 @@ NHSROOT=..
#CFLAGS = -O -I../include
#LFLAGS =
CFLAGS+=-DNOTTYGRAPHICS -DSHIM_GRAPHICS -DDEFAULT_WINDOW_SYS=\"shim\"
# -lm required by lua
LFLAGS += -lm

View File

@@ -1,37 +0,0 @@
#------------------------------------------------------------------------------
# NetHack 3.7 multiw-1.2020 $NHDT-Date: 1597332785 2020/08/13 15:33:05 $ $NHDT-Branch: NetHack-3.7 $
# 1. Which windowing interface(s) should be included in this binary?
# One or more of these can be manually uncommented and/or can be specified
# on the 'make' command line. If none are enabled, tty will be used.
#WANT_WIN_TTY=1
#WANT_WIN_CURSES=1
#WANT_WIN_X11=1
#WANT_WIN_QT=1
# 2. What is the default window system?
# Exactly one of these can be manually uncommented and/or can be specified
# on the 'make' command line. If none is enabled, the first among
# WANT_WIN_{tty,curses,X11,Qt} that is enabled will become default.
#WANT_DEFAULT=tty
#WANT_DEFAULT=curses
#WANT_DEFAULT=Qt
#WANT_DEFAULT=X11
# 3. compiler detection or optional override
CCISCLANG := $(shell echo `$(CC) --version` | grep clang)
ifeq "$(CCISCLANG)" ""
CXX=g++ -std=gnu++11
else
CXX=clang++ -std=gnu++11
endif
# if you want to override the compiler detection just carried out
# uncomment one of the following pairs as desired.
#CC= gcc
#CXX= g++ -std-gnu++11
#
#CC= clang
#CXX=clang++ -std=gnu++11
#end of multiw-1.2020
#------------------------------------------------------------------------------

View File

@@ -1,108 +0,0 @@
#------------------------------------------------------------------------------
# NetHack 3.7 multiw-2.2020 $NHDT-Date: 1597332785 2020/08/13 15:33:05 $ $NHDT-Branch: NetHack-3.7 $
#
# Sorts out support for multiple window ports (interfaces) to included in the build.
#
# Included from:
# hints/linux.2020
# hints/macOS.2020
#
# The following will be set appropriately following this:
# - WANT_WIN_XXX (at least one will be set; default is TTY)
# - WANT_DEFAULT (set to match one of the enabled WANT_WIN_XXX)
# - WINCFLAGS
# - WINSRC
# - WINOBJ0
#---
# User selections could be specified as combinations of any of the following:
# WIN_WANT_TTY=1, WIN_WANT_CURSES=1, WIN_WANT_QT=1, WIN_WANT_X11=1
# The selections will all be linked into the same binary.
#
# Assuming you have the prerequisite packages mentioned above, you can
# specify, right on the make command line, which window ports (or interfaces)
# to include in your build. Doing it via the make command line means that won't
# have to edit the Makefile.
#
# make WANT_WIN_QT=1 WANT_WIN_X11=1 WANT_WIN_CURSES=1 WANT_WIN_TTY=1 install
#
# Add WANT_DEFAULT=Qt (or other interface) if you want nethack to use
# something other than tty as the default interface.
#
# Make sure that at least one interface is enabled.
ifndef WANT_WIN_ALL
ifndef WANT_WIN_TTY
ifndef WANT_WIN_CURSES
ifndef WANT_WIN_X11
ifndef WANT_WIN_QT
WANT_WIN_TTY=1
endif
endif
endif
endif
endif
ifdef WANT_WIN_ALL
WANT_WIN_TTY=1
WANT_WIN_CURSES=1
WANT_WIN_X11=1
WANT_WIN_QT=1
endif
# Make sure that a default interface is specified; this doesn't guarantee
# sanity for something like 'make WANT_WIN_CURSES=1 WANT_DEFAULT=X11' but
# 'makedefs -v' would notice, complain, and quit causing 'make' to quit.
ifndef WANT_DEFAULT
# pick the first one enabled among { tty, curses, X11, Qt }
ifdef WANT_WIN_TTY
WANT_DEFAULT=tty
else
ifdef WANT_WIN_CURSES
WANT_DEFAULT=curses
else
ifdef WANT_WIN_X11
WANT_DEFAULT=X11
else
ifdef WANT_WIN_QT
WANT_DEFAULT=Qt
else
# ? shouldn't be able to get here...
endif
endif
endif
endif
endif
WINCFLAGS=
WINSRC =
WINOBJ0 =
ifdef WANT_WIN_TTY
WINSRC += $(WINTTYSRC)
WINOBJ0 += $(WINTTYOBJ)
else
WINCFLAGS += -DNOTTYGRAPHICS
endif
ifdef WANT_WIN_CURSES
WINCFLAGS += -DCURSES_GRAPHICS
WINSRC += $(WINCURSESSRC)
WINOBJ0 += $(WINCURSESOBJ)
endif
ifdef WANT_WIN_X11
WINCFLAGS += -DX11_GRAPHICS
WINSRC += $(WIINX11SRC)
WINOBJ0 += $(WINX11OBJ)
endif
ifdef WANT_WIN_QT
WINCFLAGS += -DQT_GRAPHICS
WINSRC += $(WINQTSRC)
WINOBJ0 += $(WINQTOBJ)
endif
#end of hints/include/multiw-2.2020
#------------------------------------------------------------------------------

View File

@@ -16,28 +16,6 @@
# macOS X hints file
#
####-INCLUDE multiw-1.2020
# 4. If you set WANT_WIN_QT, you need to
# A) set QTDIR either here or in the environment to point to the Qt5
# library installation root. (Qt2, Qt3, Qt4 will not work)
# B) set XPMLIB to point to the Xpm library
ifndef WANT_WIN_QT
ifdef WANT_WIN_ALL
WANT_WIN_QT=1
endif
endif
ifdef WANT_WIN_QT
#QTDIR=/Developer/Qt
# Qt installed via homebrew
QTDIR=$(shell brew --prefix)/opt/qt
# Qt installed via macports
#QTDIR=/opt/local/libexec/qt5
endif # WANT_WIN_QT
ifndef LIBXPM
LIBXPM= -L/opt/X11/lib -lXpm
endif
# 5. Other
#-----------------------------------------------------------------------------
@@ -45,25 +23,11 @@ endif
# you're reading this in Makefile augmented by hints, that may not be true).
#
####-INCLUDE multiw-2.2020
AR=ar rcu
RANLIB=ranlib
# XXX -g vs -O should go here, -I../include goes in the makefile
CFLAGS+=-g -I../include -DNOTPARMDECL
ifndef WANT_WIN_QT
# these are normally used when compiling nethack's core
CFLAGS+=-ansi -pedantic -Wno-long-long
# but -ansi forces -std=c90 for C or -std=c++98 for C++;
# win/Qt/qt_*.cpp compiled with C++98 semantics trigger
#In file included from .../qt5/include/QtCore/qglobal.h:105:
#.../qt5/include/QtCore/qcompilerdetection.h:561:6:
# error Qt requires a C++11 compiler and yours does not seem to be that.
# so we suppress -ansi when the build includes Qt
endif
# As of LLVM build 2336.1.00, this gives dozens of spurious messages, so
# leave it out by default.
#CFLAGS+=-Wunreachable-code
#TODO NHLIB
#CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings
CFLAGS+=-Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wformat -Wswitch -Wshadow -Wwrite-strings
CFLAGS+=-DGCC_WARN
@@ -87,7 +51,7 @@ CFLAGS+=-DNOMAIL
#CFLAGS+=-DTTY_TILES_ESCCODES
#CFLAGS+=-DTTY_SOUND_ESCCODES
#CFLAGS+=-DDEFAULT_WINDOW_SYS=\"shim\" -DNOTTYGRAPHICS -DLIBNH
CFLAGS+=-DDEFAULT_WINDOW_SYS=\"shim\" -DNOTTYGRAPHICS -DLIBNH
CFLAGS+= $(WINCFLAGS) #WINCFLAGS set from multiw-2.2020
@@ -100,54 +64,7 @@ HINTSRC=$(CHAINSRC)
HINTOBJ=$(CHAINOBJ)
endif # WANT_WIN_CHAIN
ifdef WANT_WIN_TTY
CURSESLIB = -lncurses
endif
ifdef WANT_WIN_CURSES
CURSESLIB = -lncurses
endif
ifdef CURSESLIB
WINLIB += $(CURSESLIB)
endif
ifdef WANT_WIN_X11
USE_XPM=1
WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11
VARDATND0 += x11tiles NetHack.ad pet_mark.xbm pilemark.xbm
# -x: if built without dlb, some versions of mkfontdir think *.lev are fonts
POSTINSTALL += bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; ( cd $(HACKDIR); mkfontdir -x .lev );
# separate from CFLAGS so that we don't pass it to every file
X11CFLAGS = -I/opt/X11/include
# avoid repeated complaints about _X_NONNULL(args...) in <X11/Xfuncproto.h>
X11CFLAGS += -Wno-variadic-macros
ifdef USE_XPM
CFLAGS += -DUSE_XPM
WINX11LIB += -lXpm
VARDATND0 += rip.xpm
endif
WINLIB += $(WINX11LIB)
LFLAGS=-L/opt/X11/lib
endif # WANT_WIN_X11
ifdef WANT_WIN_QT
# Qt5 requires C++11
LINK = $(CXX)
QTCXXFLAGS += -Wno-deprecated-declarations
QTCXXFLAGS += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags)
WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs)
WINSRC += $(WINQTSRC)
WINOBJ0 += $(WINQTOBJ)
VARDATND0 += nhtiles.bmp rip.xpm nhsplash.xpm
# XXX if /Developer/qt exists and QTDIR not set, use that
ifndef QTDIR
$(error QTDIR not defined in the environment or Makefile)
endif # QTDIR
# XXX make sure QTDIR points to something reasonable
else # !WANT_WIN_QT
LINK=$(CC)
endif # !WANT_WIN_QT
# prevent duplicate tile.o in WINOBJ
WINOBJ = $(sort $(WINOBJ0))

View File

@@ -4,7 +4,7 @@
WANT_WASM=1
WASM_DEBUG=1
WASM_DATA_DIR=$(NHSROOT)/src/wasm-data/Users/ampower/nethackdir
WASM_DATA_DIR=$(NHSROOT)/src/wasm-data
# toolchain
EMCC=emcc
@@ -51,100 +51,14 @@ else
EMCC_CFLAGS+=$(EMCC_PROD_CFLAGS)
endif
ifdef WANT_SHARE_INSTALL
# if $GAMEUID is root, we install into roughly proper Mac locations, otherwise
# we install into ~/nethackdir
ifeq ($(GAMEUID),root)
PREFIX:=/Library/NetHack
SHELLDIR=/usr/local/bin
HACKDIR=$(PREFIX)/nethackdir
CHOWN=chown
CHGRP=chgrp
# We run sgid so the game has access to both HACKDIR and user preferences.
GAMEPERM = 02755
else # ! root
PREFIX:=/Users/$(GAMEUID)
SHELLDIR=$(PREFIX)/bin
HACKDIR=$(PREFIX)/Library/NetHack/nethackdir
CHOWN=/usr/bin/true
CHGRP=/usr/bin/true
GAMEPERM = 0500
endif # ! root
VARFILEPERM = 0664
VARDIRPERM = 0775
ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1)
# XXX it's nice we don't write over sysconf, but we've already erased it
# make sure we have group GAMEUID and group GAMEGRP
PREINSTALL= . sys/unix/hints/macosx.sh user2 $(GAMEUID); \
. sys/unix/hints/macosx.sh group2 $(GAMEGRP); \
mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR)
POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; \
$(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; \
$(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; \
chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
else ifdef WANT_SOURCE_INSTALL
PREFIX=$(abspath $(NHSROOT))
# suppress nethack.sh
#SHELLDIR=
HACKDIR=$(PREFIX)/playground
# installation config
# hackdir is the wasm / emscripten embed data root directory
HACKDIR=/
CHOWN=/usr/bin/true
CHGRP=/usr/bin/true
GAMEPERM = 0700
VARFILEPERM = 0600
VARDIRPERM = 0700
POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf;
# We can use "make all" to build the whole thing - but it misses some things:
MOREALL=$(MAKE) install
CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
else # !WANT_SOURCE_INSTALL
PREFIX:=$(wildcard ~)
SHELLDIR=$(PREFIX)/bin
HACKDIR=$(PREFIX)/nethackdir
CHOWN=/usr/bin/true
CHGRP=/usr/bin/true
GAMEPERM = 0700
VARFILEPERM = 0600
VARDIRPERM = 0700
ifdef ($(WANT_DEFAULT),X11)
# install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists
PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc || true
endif # WANT_DEFAULT X11
POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; \
$(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; \
$(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; \
chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
ifdef WANT_BUNDLE
#
# Bundle
#
# $(HACKDIR)/$(GAME).app/
# Contents/
# Frameworks/
# Info.plist
# MacOS/
# $(GAME)
# PkgInfo/
# PlugIns/
# Resources/
# SharedFrameWorks/
#
BUNDLE = mkdir -p $(HACKDIR)/nethack.app/Contents/MacOS; \
sys/unix/hints/macosx.sh infoplist > $(HACKDIR)/nethack.app/Contents/Info.plist; \
mv $(HACKDIR)/nethack $(HACKDIR)/nethack.app/Contents/MacOS/nethack;
ifdef WANT_SHARE_INSTALL
BUNDLE+= chmod $(GAMEPERM) $(HACKDIR)/nethack.app/Contents/MacOS/nethack;
endif
POSTINSTALL+= $(BUNDLE)
POSTINSTALL+= if test -f $(SHELLDIR)/$(GAME); then \
sed -i '' 's;HACKDIR/$(GAME);HACKDIR/$(GAME).app/Contents/MacOS/$(GAME);' $(SHELLDIR)/$(GAME) ; fi;
endif # WANT_BUNDLE
endif # !WANT_SHARE_INSTALL
INSTDIR=$(HACKDIR)
VARDIR=$(HACKDIR)