3 # cal - makefile for calc standard resource files
5 # Copyright (C) 1999-2006 Landon Curt Noll
7 # Calc is open software; you can redistribute it and/or modify it under
8 # the terms of the version 2.1 of the GNU Lesser General Public License
9 # as published by the Free Software Foundation.
11 # Calc is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
14 # Public License for more details.
16 # A copy of version 2.1 of the GNU Lesser General Public License is
17 # distributed with calc under the filename COPYING-LGPL. You should have
18 # received a copy with calc; if not, write to Free Software Foundation, Inc.
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 # @(#) $Revision: 30.7 $
22 # @(#) $Id: Makefile,v 30.7 2013/08/11 09:07:26 chongo Exp $
23 # @(#) $Source: /usr/local/src/bin/calc/cal/RCS/Makefile,v $
25 # Under source code control: 1991/07/21 05:00:54
26 # File existed as early as: 1991
28 # chongo <was here> /\oo/\ http://www.isthe.com/chongo/
29 # Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
31 # calculator by David I. Bell with help/mods from others
32 # Makefile by Landon Curt Noll
39 # Normally, the upper level makefile will set these values. We provide
40 # a default here just in case you want to build from this directory.
43 # Normally certain files depend on the Makefile. If the Makefile is
44 # changed, then certain steps should be redone. If MAKE_FILE is
45 # set to Makefile, then these files will depend on Makefile. If
46 # MAKE_FILE is empty, then they wont.
48 # If in doubt, set MAKE_FILE to Makefile
52 # Controlling file makefile basename (without the path)
54 # This is the basename same of the makefile that may/does/will drive
57 # If in doubt, set TOP_MAKE_FILE to Makefile
59 TOP_MAKE_FILE
= Makefile
61 # Where the system include (.h) files are kept
65 # INCDIR= /dev/env/DJDIR/include
69 # INCDIR= /usr/include
72 #INCDIR= /usr/local/include
73 #INCDIR= /dev/env/DJDIR/include
76 # where to install calc realted things
78 # ${BINDIR} where to install calc binary files
79 # ${LIBDIR} where calc link library (*.a) files are installed
80 # ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
82 # NOTE: The install rule prepends installation paths with ${T}, which
83 # by default is empty. If ${T} is non-empty, then installation
84 # locations will be relative to the ${T} directory.
88 # BINDIR= /dev/env/DJDIR/bin
89 # LIBDIR= /dev/env/DJDIR/lib
90 # CALC_SHAREDIR= /dev/env/DJDIR/share/calc
96 # CALC_SHAREDIR= /usr/share/calc
98 #BINDIR= /usr/local/bin
99 #BINDIR= /dev/env/DJDIR/bin
102 #LIBDIR= /usr/local/lib
103 #LIBDIR= /dev/env/DJDIR/lib
106 #CALC_SHAREDIR= /usr/local/lib/calc
107 #CALC_SHAREDIR= /dev/env/DJDIR/share/calc
108 CALC_SHAREDIR
= /usr
/share
/calc
110 # By default, these values are based CALC_SHAREDIR, INCDIR, BINDIR
111 # ---------------------------------------------------------------
112 # ${HELPDIR} where the help directory is installed
113 # ${CALC_INCDIR} where the calc include files are installed
114 # ${SCRIPTDIR} where calc shell scripts are installed
116 # NOTE: The install rule prepends installation paths with ${T}, which
117 # by default is empty. If ${T} is non-empty, then installation
118 # locations will be relative to the ${T} directory.
122 # HELPDIR= ${CALC_SHAREDIR}/help
123 # CALC_INCDIR= ${INCDIR}/calc
124 # SCRIPTDIR= ${BINDIR}/cscript
126 HELPDIR
= ${CALC_SHAREDIR}/help
127 CALC_INCDIR
= ${INCDIR}/calc
128 SCRIPTDIR
= ${BINDIR}/cscript
130 # T - top level directory under which calc will be installed
132 # The calc install is performed under ${T}, the calc build is
133 # performed under /. The purpose for ${T} is to allow someone
134 # to install calc somewhere other than into the system area.
140 # CALC_SHAREDIR= /usr/share/calc
144 # T= /var/tmp/testing
146 # Then the installation locations will be:
148 # calc binary files: /var/tmp/testing/usr/bin
149 # calc link library: /var/tmp/testing/usr/lib
150 # calc help, .cal ...: /var/tmp/testing/usr/share/calc
151 # ... etc ... /var/tmp/testing/...
153 # If ${T} is empty, calc is installed under /, which is the same
154 # top of tree for which it was built. If ${T} is non-empty, then
155 # calc is installed under ${T}, as if one had to chroot under
156 # ${T} for calc to operate.
158 # If in doubt, use T=
164 # Q=@ do not echo internal makefile actions (quiet mode)
165 # Q= echo internal makefile actions (debug / verbose mode)
183 # The calc files to install
185 CALC_FILES
= alg_config.cal beer.cal bernoulli.cal bernpoly.cal \
186 bigprime.cal bindings brentsolve.cal chi.cal chrem.cal constants.cal \
187 deg.cal dms.cal dotest.cal ellip.cal factorial2.cal factorial.cal \
188 gvec.cal hello.cal hms.cal intfile.cal lambertw.cal linear.cal \
189 lnseries.cal lucas.cal lucas_chk.cal lucas_tbl.cal mersenne.cal \
190 mfactor.cal mod.cal natnumset.cal pell.cal pi.cal pix.cal pollard.cal \
191 poly.cal prompt.cal psqrt.cal qtime.cal quat.cal randbitrun.cal \
192 randmprime.cal randombitrun.cal randomrun.cal randrun.cal README \
193 regress.cal repeat.cal screen.cal seedrandom.cal set8700.cal \
194 set8700.line solve.cal specialfunctions.cal statistics.cal sumsq.cal \
195 sumtimes.cal surd.cal test1700.cal test2300.cal test2600.cal \
196 test2700.cal test3100.cal test3300.cal test3400.cal test3500.cal \
197 test4000.cal test4100.cal test4600.cal test5100.cal test5200.cal \
198 test8400.cal test8500.cal test8600.cal test8900.cal toomcook.cal \
199 unitfrac.cal varargs.cal xx_print.cal zeta2.cal
201 # These files are found (but not built) in the distribution
203 DISTLIST
= ${CALC_FILES} ${MAKE_FILE}
205 # These files are used to make (but not built) a calc .a link library
209 all: ${CALC_FILES} ${MAKE_FILE} .
all
211 # used by the upper level Makefile to determine of we have done all
219 # File list generation. You can ignore this section.
222 # We will form the names of source files as if they were in a
223 # sub-directory called calc/cal.
225 # NOTE: Due to bogus shells found on one common system we must have
226 # an non-emoty else clause for every if condition. *sigh*
230 distlist
: ${DISTLIST}
231 ${Q} for i in
${DISTLIST} /dev
/null
; do \
232 if
[ X
"$$i" != X
"/dev/null" ]; then \
241 ${Q} for i in
${CALCLIBLIST} /dev
/null
; do \
242 if
[ X
"$$i" != X
"/dev/null" ]; then \
254 ${Q} for i in
${CALC_FILES} /dev
/null
; do \
255 if
[ X
"$$i" != X
"/dev/null" ]; then \
256 echo __file__
${CALC_SHAREDIR}/$$i; \
273 # NOTE: Keep the uninstall rule in reverse order to the install rule
276 -${Q} if
[ ! -d
${T}${CALC_SHAREDIR} ]; then \
277 echo
${MKDIR} ${T}${CALC_SHAREDIR}; \
278 ${MKDIR} ${T}${CALC_SHAREDIR}; \
279 if
[ ! -d
"${T}${CALC_SHAREDIR}" ]; then \
280 echo
${MKDIR} -p
"${T}${CALC_SHAREDIR}"; \
281 ${MKDIR} -p
"${T}${CALC_SHAREDIR}"; \
283 echo
${CHMOD} 0755 ${T}${CALC_SHAREDIR}; \
284 ${CHMOD} 0755 ${T}${CALC_SHAREDIR}; \
288 ${Q} for i in
${CALC_FILES} /dev
/null
; do \
289 if
[ "$$i" = "/dev/null" ]; then \
292 if
${CMP} -s
$$i ${T}${CALC_SHAREDIR}/$$i; then \
295 ${RM} -f
${T}${CALC_SHAREDIR}/$$i.new
; \
296 ${CP} -f
$$i ${T}${CALC_SHAREDIR}/$$i.new
; \
297 ${CHMOD} 0444 ${T}${CALC_SHAREDIR}/$$i.new
; \
298 ${MV} -f
${T}${CALC_SHAREDIR}/$$i.new
${T}${CALC_SHAREDIR}/$$i;\
299 echo
"installed ${T}${CALC_SHAREDIR}/$$i"; \
303 # Try to remove everything that was installed
305 # NOTE: Keep the uninstall rule in reverse order to the install rule
308 -${Q} for i in
${CALC_FILES} /dev
/null
; do \
309 if
[ "$$i" = "/dev/null" ]; then \
312 if
[ -f
"${T}${CALC_SHAREDIR}/$$i" ]; then \
313 ${RM} -f
"${T}${CALC_SHAREDIR}/$$i"; \
314 if
[ -f
"${T}${CALC_SHAREDIR}/$$i" ]; then \
315 echo
"cannot uninstall ${T}${CALC_SHAREDIR}/$$i"; \
317 echo
"uninstalled ${T}${CALC_SHAREDIR}/$$i"; \
321 -${Q} for i in
${CALC_SHAREDIR}; do \
322 if
[ -d
"${T}$$i" ]; then \
323 ${RMDIR} "${T}$$i" 2>/dev
/null
; \
324 echo
"cleaned up ${T}$$i"; \