modified: makefile
[GalaxyCodeBases.git] / c_cpp / etc / calc / cal / Makefile
blob6e23b45460efad2ad149ffeaff03da6f7eca7188
1 #!/bin/make
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
34 # required vars
36 SHELL= /bin/sh
38 ####
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.
41 ####
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
50 MAKE_FILE= Makefile
52 # Controlling file makefile basename (without the path)
54 # This is the basename same of the makefile that may/does/will drive
55 # this makefile.
57 # If in doubt, set TOP_MAKE_FILE to Makefile
59 TOP_MAKE_FILE= Makefile
61 # Where the system include (.h) files are kept
63 # For DJGPP, select:
65 # INCDIR= /dev/env/DJDIR/include
67 # If in doubt, set:
69 # INCDIR= /usr/include
72 #INCDIR= /usr/local/include
73 #INCDIR= /dev/env/DJDIR/include
74 INCDIR= /usr/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.
86 # For DJGPP, select:
88 # BINDIR= /dev/env/DJDIR/bin
89 # LIBDIR= /dev/env/DJDIR/lib
90 # CALC_SHAREDIR= /dev/env/DJDIR/share/calc
92 # If in doubt, set:
94 # BINDIR= /usr/bin
95 # LIBDIR= /usr/lib
96 # CALC_SHAREDIR= /usr/share/calc
98 #BINDIR= /usr/local/bin
99 #BINDIR= /dev/env/DJDIR/bin
100 BINDIR= /usr/bin
102 #LIBDIR= /usr/local/lib
103 #LIBDIR= /dev/env/DJDIR/lib
104 LIBDIR= /usr/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.
120 # If in doubt, set:
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.
136 # For example, if:
138 # BINDIR= /usr/bin
139 # LIBDIR= /usr/lib
140 # CALC_SHAREDIR= /usr/share/calc
142 # and if:
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=
162 # Makefile debug
164 # Q=@ do not echo internal makefile actions (quiet mode)
165 # Q= echo internal makefile actions (debug / verbose mode)
170 # standard tools
172 CHMOD= chmod
173 CMP= cmp
174 RM= rm
175 MKDIR= mkdir
176 RMDIR= rmdir
177 CP= cp
178 MV= mv
179 CO= co
180 TRUE= true
181 TOUCH= touch
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
207 CALCLIBLIST=
209 all: ${CALC_FILES} ${MAKE_FILE} .all
211 # used by the upper level Makefile to determine of we have done all
213 .all:
214 ${RM} -f .all
215 ${TOUCH} .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 \
233 echo cal/$$i; \
234 fi; \
235 done
237 distdir:
238 ${Q} echo cal
240 calcliblist:
241 ${Q} for i in ${CALCLIBLIST} /dev/null; do \
242 if [ X"$$i" != X"/dev/null" ]; then \
243 echo cal/$$i; \
244 fi; \
245 done
249 # rpm rules
253 echo_inst_files:
254 ${Q} for i in ${CALC_FILES} /dev/null; do \
255 if [ X"$$i" != X"/dev/null" ]; then \
256 echo __file__ ${CALC_SHAREDIR}/$$i; \
257 fi; \
258 done
262 # Utility rules
266 clean:
268 clobber: clean
269 ${RM} -f .all
271 # install everything
273 # NOTE: Keep the uninstall rule in reverse order to the install rule
275 install: all
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}"; \
282 fi; \
283 echo ${CHMOD} 0755 ${T}${CALC_SHAREDIR}; \
284 ${CHMOD} 0755 ${T}${CALC_SHAREDIR}; \
285 else \
286 ${TRUE}; \
288 ${Q} for i in ${CALC_FILES} /dev/null; do \
289 if [ "$$i" = "/dev/null" ]; then \
290 continue; \
291 fi; \
292 if ${CMP} -s $$i ${T}${CALC_SHAREDIR}/$$i; then \
293 ${TRUE}; \
294 else \
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"; \
300 fi; \
301 done
303 # Try to remove everything that was installed
305 # NOTE: Keep the uninstall rule in reverse order to the install rule
307 uninstall:
308 -${Q} for i in ${CALC_FILES} /dev/null; do \
309 if [ "$$i" = "/dev/null" ]; then \
310 continue; \
311 fi; \
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"; \
316 else \
317 echo "uninstalled ${T}${CALC_SHAREDIR}/$$i"; \
318 fi; \
319 fi; \
320 done
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"; \
325 fi; \
326 done