checkpoint on ALLOW_CUSTOM use

Updated comments in Makefile.local for how to Diagnosing memory,
thread, and crash issues under RHEL and macOS.

We no longer support the Makefile variable ${ALLOW_CUSTOM} to be empty.
Normally ${ALLOW_CUSTOM} is:

    ALLOW_CUSTOM= -DCUSTOM

Now, to disable custom disable custom even if -C is given, use:

    ALLOW_CUSTOM="-UCUSTOM"

Added comments in Makefile.local for how to reduce dependency chains
under macOS.  XXX - this doesn't yet work so don't uncomment - XXX.
This commit is contained in:
Landon Curt Noll
2023-08-13 16:17:10 -07:00
parent 77405e1d84
commit b408b59d8d
10 changed files with 65 additions and 40 deletions

11
CHANGES
View File

@@ -22,8 +22,17 @@ The following are the changes from calc version 2.14.3.1 to date:
Updated comments in Makefile.local for how to Diagnosing memory,
thread, and crash issues under RHEL and macOS.
We no longer support the Makefile variable ${ALLOW_CUSTOM} to be empty.
Normally ${ALLOW_CUSTOM} is:
ALLOW_CUSTOM= -DCUSTOM
Now, to disable custom disable custom even if -C is given, use:
ALLOW_CUSTOM="-UCUSTOM"
Added comments in Makefile.local for how to reduce dependency chains
under macOS
under macOS. XXX - this doesn't yet work so don't uncomment - XXX.
The following are the changes from calc version 2.14.2.1 to 2.14.3.0:

View File

@@ -1158,12 +1158,12 @@ CATMODE= 0444
# disable custom builtin functions by not compiling any custom code
#
# ALLOW_CUSTOM= -DCUSTOM # allow custom only if -C is given
# ALLOW_CUSTOM= # disable custom even if -C is given
# ALLOW_CUSTOM= -UCUSTOM # disable custom even if -C is given
#
# If in doubt, use ALLOW_CUSTOM= -DCUSTOM
#
ALLOW_CUSTOM= -DCUSTOM
#ALLOW_CUSTOM=
#ALLOW_CUSTOM= -UCUSTOM
# If the $CALCPATH environment variable is not defined, then the following
# path will be searched for calc resource file routines.
@@ -1173,13 +1173,13 @@ ALLOW_CUSTOM= -DCUSTOM
#if 0 /* start of skip for non-Gnu makefiles */
#
ifdef RPM_TOP
ifdef ALLOW_CUSTOM
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
CALCPATH= .:./cal:~/.cal:${CALC_SHAREDIR}:${CUSTOMCALDIR}
else
CALCPATH= .:./cal:~/.cal:${CALC_SHAREDIR}
endif
else
ifdef ALLOW_CUSTOM
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
#
#endif /* end of skip for non-Gnu makefiles */
CALCPATH= .:./cal:~/.cal:${T}${CALC_SHAREDIR}:${T}${CUSTOMCALDIR}
@@ -1375,8 +1375,16 @@ LD_DEBUG=
#
# CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=.:./custom DYLD_LIBRARY_PATH=.
#
#if 0 /* start of skip for non-Gnu makefiles */
#
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=. DYLD_LIBRARY_PATH=. CALCHELP=./help \
CALCCUSTOMHELP=./custom
else
CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=. DYLD_LIBRARY_PATH=. CALCHELP=./help
endif
#
#endif /* end of skip for non-Gnu makefiles */
# Some out of date operating systems require/want an executable to
# end with a certain file extension. Some compiler systems such as
@@ -1486,7 +1494,7 @@ ARCH_CFLAGS=
#
#if 0 /* start of skip for non-Gnu makefiles */
#
ifdef ALLOW_CUSTOM
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
#
#endif /* end of skip for non-Gnu makefiles */
COMMON_CFLAGS= -DCALC_SRC ${ALLOW_CUSTOM} ${CCWARN} \
@@ -1606,7 +1614,7 @@ DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
@@ -1676,7 +1684,7 @@ else
LIBCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib \
${ARCH_CFLAGS}
endif
ifdef ALLOW_CUSTOM
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
ifeq ($(SET_INSTALL_NAME),yes)
LIBCUSTCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib \
-install_name ${LIBDIR}/libcustcalc${LIB_EXT_VERSION} ${ARCH_CFLAGS}
@@ -1746,7 +1754,7 @@ DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
@@ -1807,7 +1815,7 @@ DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
@@ -1862,7 +1870,7 @@ DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
@@ -1972,7 +1980,7 @@ DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
@@ -2474,7 +2482,7 @@ OBJS= ${LIBOBJS} ${CALCOBJS} ${UTIL_OBJS} ${SAMPLE_OBJ}
#
#if 0 /* start of skip for non-Gnu makefiles */
#
ifdef ALLOW_CUSTOM
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
#
#endif /* end of skip for non-Gnu makefiles */
CALC_STATIC_LIBS= libcalc.a libcustcalc.a
@@ -2490,7 +2498,7 @@ endif
#
#if 0 /* start of skip for non-Gnu makefiles */
#
ifdef ALLOW_CUSTOM
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
#
#endif /* end of skip for non-Gnu makefiles */
CALC_DYNAMIC_LIBS= libcalc${LIB_EXT_VERSION} libcustcalc${LIB_EXT_VERSION}
@@ -2506,7 +2514,7 @@ endif
#
#if 0 /* start of skip for non-Gnu makefiles */
#
ifdef ALLOW_CUSTOM
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
#
#
#endif /* end of skip for non-Gnu makefiles */
@@ -2551,7 +2559,7 @@ STATIC_FIRST_TARGETS= ${LICENSE} .static
#
#if 0 /* start of skip for non-Gnu makefiles */
#
ifdef ALLOW_CUSTOM
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
#
#endif /* end of skip for non-Gnu makefiles */
EARLY_TARGETS= hsrc .hsrc custom/.all custom/Makefile
@@ -2857,7 +2865,7 @@ endif
${Q} echo '' >> $@
#if 0 /* start of skip for non-Gnu makefiles */
#
ifdef ALLOW_CUSTOM
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
#
#endif /* end of skip for non-Gnu makefiles */
${Q} echo '/* the location of the custom help directory */' >> $@
@@ -4620,7 +4628,7 @@ ${CSCRIPT_TARGETS}: cscript/Makefile
#if 0 /* start of skip for non-Gnu makefiles */
#
ifdef ALLOW_CUSTOM
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
#
#endif /* end of skip for non-Gnu makefiles */
custom/.all: custom/Makefile
@@ -4675,7 +4683,7 @@ libcalc.a: ${LIBOBJS} ${MAKE_FILE} ${LOC_MKF}
#if 0 /* start of skip for non-Gnu makefiles */
#
ifdef ALLOW_CUSTOM
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
#
#endif /* end of skip for non-Gnu makefiles */
custom/libcustcalc.a: custom/Makefile
@@ -5102,6 +5110,7 @@ env:
@echo 'DIFF=${DIFF}'; echo ''
@echo 'DISTLIST=${DISTLIST}'; echo ''
@echo 'E=${E}'; echo ''
@echo 'EARLY_TARGETS=${EARLY_TARGETS}'; echo ''
@echo 'EXT=${EXT}'; echo ''
@echo 'FMT=${FMT}'; echo ''
@echo 'FPOS_BITS=${FPOS_BITS}'; echo ''
@@ -5152,6 +5161,7 @@ env:
@echo 'INCDIR=${INCDIR}'; echo ''
@echo 'INODE_BITS=${INODE_BITS}'; echo ''
@echo 'LANG=${LANG}'; echo ''
@echo 'LATE_TARGETS=${LATE_TARGETS}'; echo ''
@echo 'LCC=${LCC}'; echo ''
@echo 'LDCONFIG=${LDCONFIG}'; echo ''
@echo 'LDFLAGS=${LDFLAGS}'; echo ''
@@ -5591,7 +5601,7 @@ install: ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all custom/Makefile
fi
#if 0 /* start of skip for non-Gnu makefiles */
#
ifdef ALLOW_CUSTOM
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
#
#endif /* end of skip for non-Gnu makefiles */
-${Q} if [ ! -d ${T}${CUSTOMCALDIR} ]; then \
@@ -5707,7 +5717,7 @@ endif
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
#if 0 /* start of skip for non-Gnu makefiles */
#
ifdef ALLOW_CUSTOM
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
#
#endif /* end of skip for non-Gnu makefiles */
${V} echo '=-=-=-=-= Invoking $@ rule for custom =-=-=-=-='

View File

@@ -1035,12 +1035,12 @@ CATMODE= 0444
# disable custom builtin functions by not compiling any custom code
#
# ALLOW_CUSTOM= -DCUSTOM # allow custom only if -C is given
# ALLOW_CUSTOM= # disable custom even if -C is given
# ALLOW_CUSTOM= -UCUSTOM # disable custom even if -C is given
#
# If in doubt, use ALLOW_CUSTOM= -DCUSTOM
#
ALLOW_CUSTOM= -DCUSTOM
#ALLOW_CUSTOM=
#ALLOW_CUSTOM= -UCUSTOM
# If the $CALCPATH environment variable is not defined, then the following
# path will be searched for calc resource file routines.
@@ -1220,8 +1220,6 @@ LD_DEBUG=
#
# CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=.:./custom DYLD_LIBRARY_PATH=.
#
CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=. DYLD_LIBRARY_PATH=. CALCHELP=./help \
CALCCUSTOMHELP=./custom
# Some out of date operating systems require/want an executable to
# end with a certain file extension. Some compiler systems such as
@@ -4389,6 +4387,7 @@ env:
@echo 'DIFF=${DIFF}'; echo ''
@echo 'DISTLIST=${DISTLIST}'; echo ''
@echo 'E=${E}'; echo ''
@echo 'EARLY_TARGETS=${EARLY_TARGETS}'; echo ''
@echo 'EXT=${EXT}'; echo ''
@echo 'FMT=${FMT}'; echo ''
@echo 'FPOS_BITS=${FPOS_BITS}'; echo ''
@@ -4439,6 +4438,7 @@ env:
@echo 'INCDIR=${INCDIR}'; echo ''
@echo 'INODE_BITS=${INODE_BITS}'; echo ''
@echo 'LANG=${LANG}'; echo ''
@echo 'LATE_TARGETS=${LATE_TARGETS}'; echo ''
@echo 'LCC=${LCC}'; echo ''
@echo 'LDCONFIG=${LDCONFIG}'; echo ''
@echo 'LDFLAGS=${LDFLAGS}'; echo ''

View File

@@ -1,7 +1,7 @@
/*
* custom - interface for custom software and hardware interfaces
*
* Copyright (C) 1999-2007,2021 Landon Curt Noll
* Copyright (C) 1999-2007,2021,2023 Landon Curt Noll
*
* Calc is open software; you can redistribute it and/or modify it under
* the terms of the version 2.1 of the GNU Lesser General Public License
@@ -26,7 +26,7 @@
/*
* Be careful what you put in this file, upper .c files include
* this file even when CUSTOM is not defined (ALLOW_CUSTOM is empty).
* this file even when CUSTOM is not defined (ALLOW_CUSTOM="-UCUSTOM").
*
* Don't include anything, let the including .c file bring in:
*

View File

@@ -19,6 +19,10 @@ must be invoked with a -C argument:
when it is run.
To disable custom even if -C is given, calc must be built with:
ALLOW_CUSTOM="-UCUSTOM"
See the ../cal/README or "help resource" for information about
calc resource standards and guidelines.
@@ -41,7 +45,7 @@ pzasusb8.cal
Run custom("pzasusb8") on a standard set of data, print Endian
related information and print value size information.
## Copyright (C) 1999,2021 Landon Curt Noll
## Copyright (C) 1999,2021,2023 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License

View File

@@ -168,8 +168,7 @@ Step 5: Write your custom function
#endif /* CUSTOM */
This allows this code to 'go away' when the upper Makefile
disables the custom code (because ALLOW_CUSTOM no longer
has the -DCUSTOM define).
disables the custom code when CUSTOM is not defined.
b) The function type must be:

View File

@@ -453,12 +453,13 @@ CALC_ENV= CALCPATH=./cal
# disable custom builtin functions by not compiling any of code
#
# ALLOW_CUSTOM= -DCUSTOM # allow custom only if -C is given
# ALLOW_CUSTOM= # disable custom even if -C is given
# ALLOW_CUSTOM= -UCUSTOM # disable custom even if -C is given
#
# If in doubt, use ALLOW_CUSTOM= -DCUSTOM
#
ALLOW_CUSTOM= -DCUSTOM
#ALLOW_CUSTOM=
#ALLOW_CUSTOM= -UCUSTOM
# Some out of date operating systems require / want an executable to
# end with a certain file extension. Some compile systems such as
@@ -1079,7 +1080,7 @@ install: all
${RM} -f ${T}${CUSTOMCALDIR}/libcustcalc.a; \
echo "removed old ${T}${CUSTOMCALDIR}/libcustcalc.a"; \
fi
-${Q} if [ ! -z ${ALLOW_CUSTOM} ]; then \
-${Q} if [ X"${ALLOW_CUSTOM}" = "X-DCUSTOM" ]; then \
if [ -f libcustcalc.a ]; then \
if ${CMP} -s libcustcalc.a ${T}${LIBDIR}/libcustcalc.a; then \
${TRUE}; \

View File

@@ -423,12 +423,13 @@ CALC_ENV= CALCPATH=./cal
# disable custom builtin functions by not compiling any of code
#
# ALLOW_CUSTOM= -DCUSTOM # allow custom only if -C is given
# ALLOW_CUSTOM= # disable custom even if -C is given
# ALLOW_CUSTOM= -UCUSTOM # disable custom even if -C is given
#
# If in doubt, use ALLOW_CUSTOM= -DCUSTOM
#
ALLOW_CUSTOM= -DCUSTOM
#ALLOW_CUSTOM=
#ALLOW_CUSTOM= -UCUSTOM
# Some out of date operating systems require / want an executable to
# end with a certain file extension. Some compile systems such as
@@ -1073,7 +1074,7 @@ install: all
${RM} -f ${T}${CUSTOMCALDIR}/libcustcalc.a; \
echo "removed old ${T}${CUSTOMCALDIR}/libcustcalc.a"; \
fi
-${Q} if [ ! -z ${ALLOW_CUSTOM} ]; then \
-${Q} if [ X"${ALLOW_CUSTOM}" = "X-DCUSTOM" ]; then \
if [ -f libcustcalc.a ]; then \
if ${CMP} -s libcustcalc.a ${T}${LIBDIR}/libcustcalc.a; then \
${TRUE}; \

View File

@@ -832,7 +832,7 @@ DESCRIPTION
Returns TRUE if you calc was compiled with -DCUSTOM. By default,
the calc Makefile uses ALLOW_CUSTOM= -DCUSTOM so by default
config("compile_custom") is TRUE. If, however, calc is compiled
without -DCUSTOM, then config("compile_custom") will be FALSE.
with ALLOW_CUSTOM="-UCUSTOM", then config("compile_custom") will be FALSE.
The config("compile_custom") value is only affected by compile
flags. The calc -D runtime command line option does not change
@@ -1042,7 +1042,7 @@ LINK LIBRARY
SEE ALSO
custom, custom_cal, display, epsilon, fprintf, printf, strprintf, usage
## Copyright (C) 1999-2007,2018,2021 Landon Curt Noll
## Copyright (C) 1999-2007,2018,2021,2023 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License

View File

@@ -68,7 +68,8 @@ DESCRIPTION
help contrib
EXAMPLE
If calc compiled with ALLOW_CUSTOM= (custom disabled):
If calc compiled with ALLOW_CUSTOM="-UCUSTOM", the custom system
is disabled, even when -C is used on the command line:
; print custom("sysinfo", "baseb")
Calc was built with custom functions disabled
@@ -94,7 +95,7 @@ LINK LIBRARY
SEE ALSO
custom_cal, new_custom, contrib
## Copyright (C) 1999 Landon Curt Noll
## Copyright (C) 1999,2023 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License