add Makefile.config, change all Makefile includes

Moved makefile variables that configure calc and configure how to
compile calc from Makefile into a new Makefile.config file.

The Makeifle includes the Makefile.config file.
The cal/Makeifle includes the Makefile.config file.
The cscript/Makeifle includes the Makefile.config file.
The custom/Makeifle includes the Makefile.config file.
The help/Makeifle includes the Makefile.config file.

Now, the Makefile.config file will consistently configure
calc and how calc is compiled and built by all calc Makefiles.

The platform target section from the old Makefile has been moved to
a new file, Makefile.target.  The custom/Makefile no longer includes
Makefile.

The Makeifle includes the Makefile.target file.
The cal/Makeifle includes the Makefile.target file.
The cscript/Makeifle includes the Makefile.target file.
The custom/Makeifle includes the Makefile.target file.
The help/Makeifle includes the Makefile.target file.

Now, the Makefile.target file will consistently set
target information for all calc Makefiles.

The cal/Makeifle includes the Makefile.local file.
The cscript/Makeifle includes the Makefile.local file.
The custom/Makeifle includes the Makefile.local file.
The help/Makeifle includes the Makefile.local file.

Thus, one may modify or append many Makefile variables
in all calc Makefiles.
This commit is contained in:
Landon Curt Noll
2023-08-13 23:40:33 -07:00
parent 06dcb3e51e
commit 21ab25d1c9
7 changed files with 1678 additions and 2252 deletions

View File

@@ -36,177 +36,54 @@
# Makefile by Landon Curt Noll
# The shell used by this Makefile
#
# On some systems, /bin/sh is a rather reduced shell with
# deprecated behavior.
#
# If your system has a up to date, bash shell, then
# you may wish to use:
#
# SHELL= bash
#
# On some systems such as macOS, the bash shell is very
# far behind to the point where is cannot be depended on.
# On such systems, the sh may be a much better alternative
# shell for this Makefile to use:
#
# SHELL= sh
#
SHELL= bash
#SHELL= sh
#if 0 /* start of skip for non-Gnu makefiles */
#
ifeq ($(target),Darwin)
SHELL:= /bin/sh
endif
#endif /* end of skip for non-Gnu makefiles */
####
# Normally, the upper level makefile will set these values. We provide
# a default here just in case you want to build from this directory.
####
# PREFIX - Top level location for calc
#
# The PREFIX is often prepended to paths within calc and calc Makefiles.
#
# Starting with calc v2.13.0.1, nearly all Makefile places that used
# /usr/local now use ${PREFIX}. An exception is the olduninstall rule
# and, of course, this section. :-)
#
# NOTE: The ${PREFIX} is not the same as ${T}. The ${T} specifies
# a top level directory under which calc installs things.
# While usually ${T} is empty, it can be specific path
# as if calc where "chrooted" during an install.
# The ${PREFIX} value, during install, is a path between
# the top level ${T} install directory and the object
# such as an include file.
#
# NOTE: See also, ${T}, below.
#
# There are some paths that do NOT call under ${PREFIX}, such as
# ${CALCPATH}, that include paths not under ${PREFIX}, but those
# too are exceptions to this general rule.
#
# When in doubt, try:
#
# PREFIX= /usr/local
#
PREFIX= /usr/local
#PREFIX= /usr
#PREFIX= /usr/global
###########################################
# Files used or included by this Makefile #
###########################################
# Normally certain files depend on the Makefile. If the Makefile is
# changed, then certain steps should be redone. If MAKE_FILE is
# set to Makefile, then these files will depend on Makefile. If
# MAKE_FILE is empty, then they wont.
# MAKE_FILE is empty, then they won't.
#
# If in doubt, set MAKE_FILE to Makefile
#
MAKE_FILE= Makefile
# Where the system include (.h) files are kept
#
# For DJGPP, select:
#
# INCDIR= /dev/env/DJDIR/include
#
# If in doubt, set:
#
# INCDIR= /usr/include
# Calc configuration and compile configuration values
#
CONFIG_MKF= ../Makefile.config
#INCDIR= ${PREFIX}/include
#INCDIR= /dev/env/DJDIR/include
INCDIR= /usr/include
# Host targets that are shared in common with both Makefile
# and custom/Makefile.
#
TARGET_MKF= ../Makefile.target
# where to install calc related things
# Local file that is included just prior to the first rule,
# that allows one to override any values set in this Makefile.
#
# ${BINDIR} where to install calc binary files
# ${LIBDIR} where calc link library (*.a) files are installed
# ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
#
# NOTE: The install rule prepends installation paths with ${T}, which
# by default is empty. If ${T} is non-empty, then installation
# locations will be relative to the ${T} directory.
#
# For DJGPP, select:
#
# BINDIR= /dev/env/DJDIR/bin
# LIBDIR= /dev/env/DJDIR/lib
# CALC_SHAREDIR= /dev/env/DJDIR/share/calc
#
# If in doubt, set:
#
# BINDIR= /usr/bin
# LIBDIR= /usr/lib
# CALC_SHAREDIR= /usr/share/calc
#
#BINDIR= ${PREFIX}/bin
#BINDIR= /dev/env/DJDIR/bin
BINDIR= /usr/bin
LOCAL_MKF= ../Makefile.local
#LIBDIR= ${PREFIX}/lib
#LIBDIR= /dev/env/DJDIR/lib
LIBDIR= /usr/lib
# The set of Makefiles
#
MK_SET= ${MAKE_FILE} ${CONFIG_MKF} ${TARGET_MKF} ${LOCAL_MKF}
#CALC_SHAREDIR= ${PREFIX}/lib/calc
#CALC_SHAREDIR= /dev/env/DJDIR/share/calc
CALC_SHAREDIR= /usr/share/calc
# By default, these values are based CALC_SHAREDIR, INCDIR, BINDIR
# ---------------------------------------------------------------
# ${HELPDIR} where the help directory is installed
# ${CALC_INCDIR} where the calc include files are installed
# ${SCRIPTDIR} where calc shell scripts are installed
#
# NOTE: The install rule prepends installation paths with ${T}, which
# by default is empty. If ${T} is non-empty, then installation
# locations will be relative to the ${T} directory.
#
# If in doubt, set:
#
# HELPDIR= ${CALC_SHAREDIR}/help
# CALC_INCDIR= ${INCDIR}/calc
# SCRIPTDIR= ${BINDIR}/cscript
#
HELPDIR= ${CALC_SHAREDIR}/help
CALC_INCDIR= ${INCDIR}/calc
SCRIPTDIR= ${BINDIR}/cscript
#######################################################
# Calc configuration and compile configuration values #
#######################################################
include ${CONFIG_MKF}
###############################
# host target section include #
###############################
include ${TARGET_MKF}
##########################################################################
#=-=-=-=-=- Be careful if you change something below this line -=-=-=-=-=#
##########################################################################
# T - top level directory under which calc will be installed
#
# The calc install is performed under ${T}, the calc build is
# performed under /. The purpose for ${T} is to allow someone
# to install calc somewhere other than into the system area.
#
# For example, if:
#
# BINDIR= /usr/bin
# LIBDIR= /usr/lib
# CALC_SHAREDIR= /usr/share/calc
#
# and if:
#
# T= /var/tmp/testing
#
# Then the installation locations will be:
#
# calc binary files: /var/tmp/testing/usr/bin
# calc link library: /var/tmp/testing/usr/lib
# calc help, .cal ...: /var/tmp/testing/usr/share/calc
# ... etc ... /var/tmp/testing/...
#
# If ${T} is empty, calc is installed under /, which is the same
# top of tree for which it was built. If ${T} is non-empty, then
# calc is installed under ${T}, as if one had to chroot under
# ${T} for calc to operate.
#
# If in doubt, use T=
#
T=
# Makefile debug
#
@@ -240,22 +117,6 @@ H=@
V=@:
#V=@
# standard tools
#
CHMOD= chmod
CMP= cmp
CO= co
CP= cp
FMT= fmt
MKDIR= mkdir
MV= mv
RM= rm
RMDIR= rmdir
SED= sed
SORT= sort
TOUCH= touch
TRUE= true
# The calc files to install
#
# This list is produced by the detaillist rule when no WARNINGS are detected.
@@ -300,8 +161,24 @@ CALCLIBLIST=
#
PHONY= all clobber distlist install
############################################################
# Allow Makefile.local to change any of the above settings #
############################################################
include ${LOCAL_MKF}
###########################################
# all - First and default Makefile target #
###########################################
all: ${CALC_FILES} ${MAKE_FILE} .all
###############################
# additional Makefile targets #
###############################
# used by the upper level Makefile to determine of we have done all
#
.all: