something concrete for discussion:

infrastructure for NOSTATICFN, replacing NOSTATICCORE
This commit is contained in:
nhkeni
2024-03-13 11:39:24 -04:00
parent a13b9da286
commit 59486fb8ad
4 changed files with 31 additions and 26 deletions
+14 -2
View File
@@ -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) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2016. */ /*-Copyright (c) Robert Patrick Rankin, 2016. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -272,12 +272,24 @@
# define PANICTRACE # define PANICTRACE
# endif # endif
# ifdef __linux__ # ifdef __linux__
# define PANICTRACE # define PANICTRACE
# define NOSTATICFN
# endif # endif
// This test isn't quite right: CNG is only available from Windows 2000 on. // This test isn't quite right: CNG is only available from Windows 2000 on.
// But we'll check that at runtime. // But we'll check that at runtime.
# ifdef WIN32 # ifdef WIN32
# define PANICTRACE # define PANICTRACE
# define NOSTATICFN
# endif
#endif
#ifdef NONOSTATICFN
# define staticfn static
#else
# ifdef NOSTATICFN
# define staticfn
# else
# define staticfn static
# endif # endif
#endif #endif
+1 -22
View File
@@ -447,30 +447,9 @@ QUIETCC=0
# NB: This is not used for all .c files (see explicit rules in # NB: This is not used for all .c files (see explicit rules in
# dependencies). # dependencies).
# if NOSTATICCORE
# A normal or cross compile. # 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 $(TARGETPFX)%.o : %.c
@if [ x$(NOSTATICCORE) = 'x' ]; then \ $(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ $<
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
# Verbosity definitions, begin # Verbosity definitions, begin
# Set QUIETCC=1 above to output less feedback while building. # Set QUIETCC=1 above to output less feedback while building.
+13 -2
View File
@@ -45,8 +45,11 @@ GAMEGRP = games
# This gives better backtraces by making all core functions global; this # This gives better backtraces by making all core functions global; this
# works around a limitation in glibc's backtrace(3) function. # works around a limitation in glibc's backtrace(3) function.
# Recommended with CRASHREPORT. # This will be turned on automatically with CRASHREPROT.
#NOSTATICCORE = 1 # 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 #-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; -e 's;PANICTRACE_GDB=1;PANICTRACE_GDB=0;' $(INSTDIR)/sysconf;
endif endif
ifeq 'USENONOSTATICFN' '1'
CFLAGS += -DNONOSTATICFN
else
ifeq 'USE_NOSTATICFN' '1'
CFLAGS += -DNOSTATICFN
endif
endif
# Lua # Lua
# when building liblua.a, avoid warning that use of tmpnam() should be # 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 # replaced by mkstemp(); the lua code doesn't use nethack's config.h so
+3
View File
@@ -308,6 +308,9 @@ override GAME=
MOREALL += ( cd src ; $(MAKE) pregame ; $(MAKE) $(TARGETPFX)libnh.a ) MOREALL += ( cd src ; $(MAKE) pregame ; $(MAKE) $(TARGETPFX)libnh.a )
endif # WANT_LIBNH endif # WANT_LIBNH
# XXX TESTING ONLY - macOS doesn't need this:
CFLAGS += -DNOSTATICFN
# Lua # Lua
# when building liblua.a, avoid warning that use of tmpnam() should be # 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 # replaced by mkstemp(); the lua code doesn't use nethack's config.h so