diff --git a/include/config.h b/include/config.h index ba49103f1..7774eef3f 100644 --- a/include/config.h +++ b/include/config.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 config.h $NHDT-Date: 1704043695 2023/12/31 17:28:15 $ $NHDT-Branch: keni-luabits2 $:$NHDT-Revision: 1.181 $ */ +/* NetHack 3.7 config.h $NHDT-Date: 1710344316 2024/03/13 15:38:36 $ $NHDT-Branch: keni-staticfn $:$NHDT-Revision: 1.188 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2016. */ /* NetHack may be freely redistributed. See license for details. */ @@ -272,12 +272,24 @@ # define PANICTRACE # endif # ifdef __linux__ - # define PANICTRACE +# define PANICTRACE +# define NOSTATICFN # endif // This test isn't quite right: CNG is only available from Windows 2000 on. // But we'll check that at runtime. # ifdef WIN32 # define PANICTRACE +# define NOSTATICFN +# endif +#endif + +#ifdef NONOSTATICFN +# define staticfn static +#else +# ifdef NOSTATICFN +# define staticfn +# else +# define staticfn static # endif #endif diff --git a/sys/unix/Makefile.src b/sys/unix/Makefile.src index 46766aa9c..9aa4d58f0 100644 --- a/sys/unix/Makefile.src +++ b/sys/unix/Makefile.src @@ -447,30 +447,9 @@ QUIETCC=0 # NB: This is not used for all .c files (see explicit rules in # dependencies). -# if NOSTATICCORE # A normal or cross compile. -# else -# NOSTATICCORE: A compile that makes all functions non-static. -# Rule /=/ allows 2 definitions of char array brief_feeling -# fi $(TARGETPFX)%.o : %.c - @if [ x$(NOSTATICCORE) = 'x' ]; then \ - echo $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ $< ; \ - $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ $< ; \ - else \ - ( \ - echo "Generating " intermediate file .$< ; \ - $(AWK) ' \ - BEGIN{print "#line 1 \"$<\""}; \ - /=/{print;next}; \ - sub(/^static inline/, ""){print;next}; \ - sub(/^static( |$$)/, ""){print;next}; \ - {print}; \ - ' < $< > .$< && \ - echo $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ .$< ; \ - $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ .$< ; \ - ) \ - fi + $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ $< # Verbosity definitions, begin # Set QUIETCC=1 above to output less feedback while building. diff --git a/sys/unix/hints/linux.370 b/sys/unix/hints/linux.370 index 279b177cf..06c69b7be 100755 --- a/sys/unix/hints/linux.370 +++ b/sys/unix/hints/linux.370 @@ -45,8 +45,11 @@ GAMEGRP = games # This gives better backtraces by making all core functions global; this # works around a limitation in glibc's backtrace(3) function. -# Recommended with CRASHREPORT. -#NOSTATICCORE = 1 +# This will be turned on automatically with CRASHREPROT. +# 1 to enable, 0 to disable +USE_NOSTATICFN = 1 +# If you want CRASHREPORT but absolutely don't want NOSTATICFN, define this: +#USE_NONOSTATICFN = 1 #----------------------------------------------------------------------------- #-INCLUDE cross-pre1.370 @@ -344,6 +347,14 @@ POSTINSTALL+= sed -i -e 's;^GDBPATH=/usr/bin/gdb;\#GDBPATH=/usr/bin/gdb;' \ -e 's;PANICTRACE_GDB=1;PANICTRACE_GDB=0;' $(INSTDIR)/sysconf; endif +ifeq 'USENONOSTATICFN' '1' +CFLAGS += -DNONOSTATICFN +else +ifeq 'USE_NOSTATICFN' '1' +CFLAGS += -DNOSTATICFN +endif +endif + # Lua # when building liblua.a, avoid warning that use of tmpnam() should be # replaced by mkstemp(); the lua code doesn't use nethack's config.h so diff --git a/sys/unix/hints/macOS.370 b/sys/unix/hints/macOS.370 index 4a5d59816..7d2f4929f 100755 --- a/sys/unix/hints/macOS.370 +++ b/sys/unix/hints/macOS.370 @@ -308,6 +308,9 @@ override GAME= MOREALL += ( cd src ; $(MAKE) pregame ; $(MAKE) $(TARGETPFX)libnh.a ) endif # WANT_LIBNH +# XXX TESTING ONLY - macOS doesn't need this: +CFLAGS += -DNOSTATICFN + # Lua # when building liblua.a, avoid warning that use of tmpnam() should be # replaced by mkstemp(); the lua code doesn't use nethack's config.h so