1*b30d1939SAndy Fiddaman/*
2*b30d1939SAndy Fiddaman * initialization for all packages
3*b30d1939SAndy Fiddaman */
4*b30d1939SAndy Fiddaman
5*b30d1939SAndy FiddamanID = ast
6*b30d1939SAndy FiddamanSILENT = /* this component builds silent -- this prevents us from using it while building it */
7*b30d1939SAndy Fiddaman
8*b30d1939SAndy Fiddaman:PACKAGE: license=$(ID)
9*b30d1939SAndy Fiddaman
10*b30d1939SAndy FiddamanLICENSE = since=1994,author=gsf
11*b30d1939SAndy Fiddaman
12*b30d1939SAndy FiddamanPACKAGEROOT = $(INSTALLROOT:T=F:P=L*:O=n)
13*b30d1939SAndy Fiddaman
14*b30d1939SAndy Fiddamanhurl :: hurl.sh LICENSE=since=2003,author=gsf
15*b30d1939SAndy Fiddaman
16*b30d1939SAndy Fiddamaniffe :: iffe.sh LICENSE=since=1994,author=gsf+kpv
17*b30d1939SAndy Fiddaman
18*b30d1939SAndy Fiddamanmktest :: mktest.sh LICENSE=since=2005,author=gsf
19*b30d1939SAndy Fiddaman
20*b30d1939SAndy Fiddamanpackage :: package.sh
21*b30d1939SAndy Fiddaman
22*b30d1939SAndy Fiddamanregress :: regress.sh LICENSE=since=1995,author=gsf
23*b30d1939SAndy Fiddaman
24*b30d1939SAndy Fiddamanrt :: rt.sh LICENSE=since=2005,author=gsf
25*b30d1939SAndy Fiddaman
26*b30d1939SAndy Fiddaman$(PACKAGEROOT)/bin :INSTALLDIR: execrate ignore mamprobe package silent
27*b30d1939SAndy Fiddaman
28*b30d1939SAndy Fiddamancrossexec :: crossexec.sh
29*b30d1939SAndy Fiddaman
30*b30d1939SAndy Fiddamanditto :: ditto.sh LICENSE=since=2001,author=gsf+ek
31*b30d1939SAndy Fiddaman
32*b30d1939SAndy Fiddamanexecrate :: execrate.sh LICENSE=since=2002,author=gsf
33*b30d1939SAndy Fiddaman
34*b30d1939SAndy Fiddamanfilter :: filter.sh
35*b30d1939SAndy Fiddaman
36*b30d1939SAndy Fiddamanignore :: ignore.sh
37*b30d1939SAndy Fiddaman
38*b30d1939SAndy Fiddamansilent :: silent.sh
39*b30d1939SAndy Fiddaman
40*b30d1939SAndy Fiddaman$(PACKAGEROOT)/lib/package :INSTALLDIR: package.mk CONVERT.mk
41*b30d1939SAndy Fiddaman
42*b30d1939SAndy Fiddaman$(LIBDIR)/make :INSTALLDIR: package.mk PROBE.mk TEST.mk WWW.mk \
43*b30d1939SAndy Fiddaman	MSGFUN.mk MSGKEY.mk MAPLIB.mk
44*b30d1939SAndy Fiddaman
45*b30d1939SAndy Fiddaman:TEST: iffe mamake
46*b30d1939SAndy Fiddaman
47*b30d1939SAndy Fiddamancc ld ldd :PACKAGE_INIT: mamake.c proto.c ratz.c release.c
48*b30d1939SAndy Fiddaman
49*b30d1939SAndy Fiddaman:: RELEASE hosttype.tst p.c hello.c \
50*b30d1939SAndy Fiddaman	ar.ibm.risc \
51*b30d1939SAndy Fiddaman	cc.specialize cc.pentium4 \
52*b30d1939SAndy Fiddaman	ldd.cygwin.i386 \
53*b30d1939SAndy Fiddaman	cc.darwin.i386 cc.darwin.i386-64 cc.darwin ldd.darwin \
54*b30d1939SAndy Fiddaman	cc.hp.ia64 cc.hp.pa cc.hp.pa64 ld.hp.pa ldd.hp.pa \
55*b30d1939SAndy Fiddaman	cc.ibm.risc cc.ibm.risc.gcc ldd.ibm.risc \
56*b30d1939SAndy Fiddaman	cc.linux.ia64-icc cc.linux.i386-icc cc.linux.i386-64-icc \
57*b30d1939SAndy Fiddaman	cc.lynxos.i386 cc.lynxos.ppc ldd.lynxos \
58*b30d1939SAndy Fiddaman	cc.mvs.390 cc.next.i386 cc.next.m68k ldd.mvs.390 \
59*b30d1939SAndy Fiddaman	cc.osf.alpha \
60*b30d1939SAndy Fiddaman	cc.sco.i386 \
61*b30d1939SAndy Fiddaman	cc.sgi.mips2 cc.sgi.mips3 cc.sgi.mips3-o32 cc.sgi.mips4 \
62*b30d1939SAndy Fiddaman	cc.sgi.mips4-n32 ldd.sgi \
63*b30d1939SAndy Fiddaman	cc.unix.mc68k
64*b30d1939SAndy Fiddaman
65*b30d1939SAndy FiddamanLICENSE : .DONTCARE
66*b30d1939SAndy Fiddaman
67*b30d1939SAndy Fiddamanif ! CC.HOSTTYPE
68*b30d1939SAndy Fiddaman	CC.HOSTTYPE := $(_hosttype_|HOSTTYPE)
69*b30d1939SAndy Fiddamanend
70*b30d1939SAndy Fiddaman
71*b30d1939SAndy Fiddaman$(BINDIR)/mkdir :INSTALL: mkdir.sh
72*b30d1939SAndy Fiddaman	if	test ! -x $(<) -a -x /bin/mkdir
73*b30d1939SAndy Fiddaman	then	mkdir -p 2>/dev/null || :
74*b30d1939SAndy Fiddaman		if	test -d ./-p
75*b30d1939SAndy Fiddaman		then	rmdir ./-p
76*b30d1939SAndy Fiddaman			cp $(*) $(<)
77*b30d1939SAndy Fiddaman			chmod +x $(<)
78*b30d1939SAndy Fiddaman		fi
79*b30d1939SAndy Fiddaman	fi
80*b30d1939SAndy Fiddaman
81*b30d1939SAndy Fiddaman/*
82*b30d1939SAndy Fiddaman * ksh93 function search on PATH
83*b30d1939SAndy Fiddaman * ksh93 builtin command library -lcmd
84*b30d1939SAndy Fiddaman * ksh93 ld library path search on PATH
85*b30d1939SAndy Fiddaman */
86*b30d1939SAndy Fiddaman
87*b30d1939SAndy Fiddaman$(BINDIR)/.paths :INSTALL: (CC.DIALECT)
88*b30d1939SAndy Fiddaman	if	test ! -f $(<) -o -w $(<)
89*b30d1939SAndy Fiddaman	then	N='$("\n")'
90*b30d1939SAndy Fiddaman		H=$(CC.HOSTTYPE)
91*b30d1939SAndy Fiddaman		P="$(-mam:??$(.GETCONF LIBPATH:/:/ /G:/,/ : /G:Q)?)"
92*b30d1939SAndy Fiddaman		b= f= h= l= n= p= u= B= L=
93*b30d1939SAndy Fiddaman		set : $P
94*b30d1939SAndy Fiddaman		while	:
95*b30d1939SAndy Fiddaman		do	while	:
96*b30d1939SAndy Fiddaman			do	case $1 in
97*b30d1939SAndy Fiddaman				'')	break 2 ;;
98*b30d1939SAndy Fiddaman				:)	shift; break ;;
99*b30d1939SAndy Fiddaman				esac
100*b30d1939SAndy Fiddaman				shift
101*b30d1939SAndy Fiddaman			done
102*b30d1939SAndy Fiddaman			case $# in
103*b30d1939SAndy Fiddaman			0|1)	break ;;
104*b30d1939SAndy Fiddaman			esac
105*b30d1939SAndy Fiddaman			case $L in
106*b30d1939SAndy Fiddaman			?*)	L="$L|" ;;
107*b30d1939SAndy Fiddaman			esac
108*b30d1939SAndy Fiddaman			L="$L$2=*"
109*b30d1939SAndy Fiddaman			B=$1
110*b30d1939SAndy Fiddaman		done
111*b30d1939SAndy Fiddaman		if	test -f $(<)
112*b30d1939SAndy Fiddaman		then	while	read x
113*b30d1939SAndy Fiddaman			do	case $x in
114*b30d1939SAndy Fiddaman				*\$\(\"*)	break # to fix 2012-06-18 edit botch #
115*b30d1939SAndy Fiddaman						;;
116*b30d1939SAndy Fiddaman				'#'?*)		case $h in
117*b30d1939SAndy Fiddaman						'')	h=$x ;;
118*b30d1939SAndy Fiddaman						esac
119*b30d1939SAndy Fiddaman						;;
120*b30d1939SAndy Fiddaman				$L)		l=$x
121*b30d1939SAndy Fiddaman						;;
122*b30d1939SAndy Fiddaman				*BUILTIN_LIB=*)	b=$x
123*b30d1939SAndy Fiddaman						;;
124*b30d1939SAndy Fiddaman				*FPATH=*)	f=$x
125*b30d1939SAndy Fiddaman						;;
126*b30d1939SAndy Fiddaman				*PLUGIN_LIB=*)	p=$x
127*b30d1939SAndy Fiddaman						;;
128*b30d1939SAndy Fiddaman				*)		case $u in
129*b30d1939SAndy Fiddaman						?*)	u=$u$N ;;
130*b30d1939SAndy Fiddaman						esac
131*b30d1939SAndy Fiddaman						u=$u$x
132*b30d1939SAndy Fiddaman						;;
133*b30d1939SAndy Fiddaman				esac
134*b30d1939SAndy Fiddaman			done < $(<)
135*b30d1939SAndy Fiddaman		fi
136*b30d1939SAndy Fiddaman		ifs=$IFS
137*b30d1939SAndy Fiddaman		m=
138*b30d1939SAndy Fiddaman		case $p in
139*b30d1939SAndy Fiddaman		?*)	b=
140*b30d1939SAndy Fiddaman			;;
141*b30d1939SAndy Fiddaman		esac
142*b30d1939SAndy Fiddaman		case $b in
143*b30d1939SAndy Fiddaman		?*)	IFS='='
144*b30d1939SAndy Fiddaman			set $b
145*b30d1939SAndy Fiddaman			IFS=$ifs
146*b30d1939SAndy Fiddaman			shift
147*b30d1939SAndy Fiddaman			p="PLUGIN_LIB=$*"
148*b30d1939SAndy Fiddaman			case $b in
149*b30d1939SAndy Fiddaman			[Nn][Oo]*)	p=no$p ;;
150*b30d1939SAndy Fiddaman			esac
151*b30d1939SAndy Fiddaman			m=1
152*b30d1939SAndy Fiddaman			;;
153*b30d1939SAndy Fiddaman		esac
154*b30d1939SAndy Fiddaman		case $f in
155*b30d1939SAndy Fiddaman		'')	f="FPATH=../fun"
156*b30d1939SAndy Fiddaman			m=1
157*b30d1939SAndy Fiddaman			;;
158*b30d1939SAndy Fiddaman		esac
159*b30d1939SAndy Fiddaman		case $h in
160*b30d1939SAndy Fiddaman		'')	h='# use { no NO } prefix to permanently disable #' ;;
161*b30d1939SAndy Fiddaman		esac
162*b30d1939SAndy Fiddaman		case $l in
163*b30d1939SAndy Fiddaman		'')	set x x : $P
164*b30d1939SAndy Fiddaman			l=
165*b30d1939SAndy Fiddaman			while	:
166*b30d1939SAndy Fiddaman			do	while	:
167*b30d1939SAndy Fiddaman				do	case $# in
168*b30d1939SAndy Fiddaman					0)	break ;;
169*b30d1939SAndy Fiddaman					esac
170*b30d1939SAndy Fiddaman					x=$1
171*b30d1939SAndy Fiddaman					shift
172*b30d1939SAndy Fiddaman					case $x in
173*b30d1939SAndy Fiddaman					:)	break ;;
174*b30d1939SAndy Fiddaman					esac
175*b30d1939SAndy Fiddaman				done
176*b30d1939SAndy Fiddaman				case $# in
177*b30d1939SAndy Fiddaman				0|1)	break
178*b30d1939SAndy Fiddaman					;;
179*b30d1939SAndy Fiddaman				2)	l=$2
180*b30d1939SAndy Fiddaman					;;
181*b30d1939SAndy Fiddaman				*)	case "$H" in
182*b30d1939SAndy Fiddaman					$3)	l=$2; break ;;
183*b30d1939SAndy Fiddaman					esac
184*b30d1939SAndy Fiddaman					;;
185*b30d1939SAndy Fiddaman				esac
186*b30d1939SAndy Fiddaman			done
187*b30d1939SAndy Fiddaman			case $l in
188*b30d1939SAndy Fiddaman			'')	if	test -x /lib/dld.sl
189*b30d1939SAndy Fiddaman				then	l=SHLIB_PATH
190*b30d1939SAndy Fiddaman				elif	test -x /usr/lib/dyld
191*b30d1939SAndy Fiddaman				then	l=DYLD_LIBRARY_PATH
192*b30d1939SAndy Fiddaman				else	case "$H" in
193*b30d1939SAndy Fiddaman					ibm.*|mvs.*)
194*b30d1939SAndy Fiddaman						l=LIBPATH
195*b30d1939SAndy Fiddaman						;;
196*b30d1939SAndy Fiddaman					sgi.mips3)
197*b30d1939SAndy Fiddaman						l=LD_LIBRARYN32_PATH
198*b30d1939SAndy Fiddaman						;;
199*b30d1939SAndy Fiddaman					sgi.mips4)
200*b30d1939SAndy Fiddaman						l=LD_LIBRARYN64_PATH
201*b30d1939SAndy Fiddaman						;;
202*b30d1939SAndy Fiddaman					*)	l=LD_LIBRARY_PATH
203*b30d1939SAndy Fiddaman						;;
204*b30d1939SAndy Fiddaman					esac
205*b30d1939SAndy Fiddaman				fi
206*b30d1939SAndy Fiddaman				;;
207*b30d1939SAndy Fiddaman			esac
208*b30d1939SAndy Fiddaman			case $l in
209*b30d1939SAndy Fiddaman			?*)	case $B in
210*b30d1939SAndy Fiddaman				'')	B=lib ;;
211*b30d1939SAndy Fiddaman				esac
212*b30d1939SAndy Fiddaman				l="$l=../$B"
213*b30d1939SAndy Fiddaman				m=1
214*b30d1939SAndy Fiddaman				;;
215*b30d1939SAndy Fiddaman			esac
216*b30d1939SAndy Fiddaman			;;
217*b30d1939SAndy Fiddaman		esac
218*b30d1939SAndy Fiddaman		case $p in
219*b30d1939SAndy Fiddaman		'')	p="PLUGIN_LIB=cmd"
220*b30d1939SAndy Fiddaman			case '$(CC.DIALECT:N=*EXPORT=[AD]LL*)' in
221*b30d1939SAndy Fiddaman			'')	p=no$p ;;
222*b30d1939SAndy Fiddaman			esac
223*b30d1939SAndy Fiddaman			m=1
224*b30d1939SAndy Fiddaman			;;
225*b30d1939SAndy Fiddaman		esac
226*b30d1939SAndy Fiddaman		case $m in
227*b30d1939SAndy Fiddaman		1)	case $u in
228*b30d1939SAndy Fiddaman			?*)	u=$N$u ;;
229*b30d1939SAndy Fiddaman			esac
230*b30d1939SAndy Fiddaman			echo "$h$N$p$N$f$N$l$u" > $(<)
231*b30d1939SAndy Fiddaman			;;
232*b30d1939SAndy Fiddaman		esac
233*b30d1939SAndy Fiddaman	fi
234*b30d1939SAndy Fiddaman
235*b30d1939SAndy Fiddaman/*
236*b30d1939SAndy Fiddaman * probe initialization
237*b30d1939SAndy Fiddaman */
238*b30d1939SAndy Fiddaman
239*b30d1939SAndy Fiddamanfor T C+probe C+make+probe.lcl C+pp+probe.lcl
240*b30d1939SAndy Fiddaman	if T == "*.lcl"
241*b30d1939SAndy Fiddaman		$(T) : .DONTCARE
242*b30d1939SAndy Fiddaman	end
243*b30d1939SAndy Fiddaman	$(LIBDIR)/probe/$(T:C,+,/,G) :INSTALL: $(T)
244*b30d1939SAndy Fiddamanend
245*b30d1939SAndy Fiddaman
246*b30d1939SAndy Fiddaman$(LIBDIR)/probe/C/mam/probe :INSTALL: mprobe
247*b30d1939SAndy Fiddaman
248*b30d1939SAndy Fiddamanmprobe :: mprobe.sh
249*b30d1939SAndy Fiddaman
250*b30d1939SAndy Fiddaman$(LIBDIR)/probe/C/make :INSTALLDIR: probe probe.ini
251*b30d1939SAndy Fiddaman
252*b30d1939SAndy Fiddamanprobe.sh : C+probe make.probe
253*b30d1939SAndy Fiddaman	cat $(*) > $(<)
254*b30d1939SAndy Fiddaman
255*b30d1939SAndy Fiddamanprobe :: probe.sh
256*b30d1939SAndy Fiddaman
257*b30d1939SAndy Fiddamanprobe.ini : (CC.HOSTTYPE) probe.win32
258*b30d1939SAndy Fiddaman	t=$(CC.HOSTTYPE)
259*b30d1939SAndy Fiddaman	ifs=$IFS
260*b30d1939SAndy Fiddaman	IFS=.
261*b30d1939SAndy Fiddaman	set x $t
262*b30d1939SAndy Fiddaman	IFS=$ifs
263*b30d1939SAndy Fiddaman	t=$2
264*b30d1939SAndy Fiddaman	set x $(*)
265*b30d1939SAndy Fiddaman	while	:
266*b30d1939SAndy Fiddaman	do	shift
267*b30d1939SAndy Fiddaman		case $# in
268*b30d1939SAndy Fiddaman		0)	break ;;
269*b30d1939SAndy Fiddaman		esac
270*b30d1939SAndy Fiddaman		case $1 in
271*b30d1939SAndy Fiddaman		*probe.$t)
272*b30d1939SAndy Fiddaman			break
273*b30d1939SAndy Fiddaman		esac
274*b30d1939SAndy Fiddaman	done
275*b30d1939SAndy Fiddaman	case $1 in
276*b30d1939SAndy Fiddaman	?*)	cmp -s $1 $(<) || cp $1 $(<) ;;
277*b30d1939SAndy Fiddaman	*)	: > $(<)
278*b30d1939SAndy Fiddaman	esac
279*b30d1939SAndy Fiddaman
280*b30d1939SAndy Fiddaman/*
281*b30d1939SAndy Fiddaman * proto initialization
282*b30d1939SAndy Fiddaman */
283*b30d1939SAndy Fiddaman
284*b30d1939SAndy Fiddaman$(INCLUDEDIR)/$(ID) :INSTALLDIR: prototyped.h
285*b30d1939SAndy Fiddaman
286*b30d1939SAndy Fiddamanprototyped.h : $(BINDIR)/proto
287*b30d1939SAndy Fiddaman	proto -f /dev/null > h.$(tmp).h
288*b30d1939SAndy Fiddaman	if	$(CMP) -s h.$(tmp).h $(<)
289*b30d1939SAndy Fiddaman	then	$(RM) -f h.$(tmp).h
290*b30d1939SAndy Fiddaman	else	$(MV) h.$(tmp).h $(<)
291*b30d1939SAndy Fiddaman	fi
292*b30d1939SAndy Fiddaman
293*b30d1939SAndy Fiddaman/*
294*b30d1939SAndy Fiddaman * check if -ldl is required
295*b30d1939SAndy Fiddaman * this allows makefiles to use -ldl on all systems
296*b30d1939SAndy Fiddaman *
297*b30d1939SAndy Fiddaman * NOTE: this works around the sgi botch:
298*b30d1939SAndy Fiddaman *	 (1) irix 5.* made -ldl optional but warned
299*b30d1939SAndy Fiddaman *	 (2) irix 6.* has no -ldl
300*b30d1939SAndy Fiddaman *	 (3) dynamic progs built on irix 5.* and using -ldl fail
301*b30d1939SAndy Fiddaman *           at runtime on irix 6.* because -ldl is not there
302*b30d1939SAndy Fiddaman */
303*b30d1939SAndy Fiddaman
304*b30d1939SAndy Fiddamandl :MAPLIB: dl.c
305*b30d1939SAndy Fiddaman
306*b30d1939SAndy Fiddaman/*
307*b30d1939SAndy Fiddaman * requiring these is a botch
308*b30d1939SAndy Fiddaman */
309*b30d1939SAndy Fiddaman
310*b30d1939SAndy Fiddamaniconv :MAPLIB: iconv.c
311*b30d1939SAndy Fiddaman
312*b30d1939SAndy Fiddamanw :MAPLIB: w.c w2.c
313*b30d1939SAndy Fiddaman
314*b30d1939SAndy Fiddaman/*
315*b30d1939SAndy Fiddaman * miscellaneous -l* checks
316*b30d1939SAndy Fiddaman */
317*b30d1939SAndy Fiddaman
318*b30d1939SAndy Fiddamanintl :MAPLIB: intl.c
319*b30d1939SAndy Fiddaman
320*b30d1939SAndy Fiddamanm :MAPLIB: m.c m2.c m3.c m4.c m5.c m6.c
321*b30d1939SAndy Fiddaman
322*b30d1939SAndy Fiddamannsl :MAPLIB: nsl.c
323*b30d1939SAndy Fiddaman
324*b30d1939SAndy Fiddaman/*
325*b30d1939SAndy Fiddaman * what was sco smoking
326*b30d1939SAndy Fiddaman * almost all of gethost* are in -lnsl except gethostbyname which
327*b30d1939SAndy Fiddaman * is in -lsocket which isn't needed to resolve socket() but seems
328*b30d1939SAndy Fiddaman * to do the -lnsl job
329*b30d1939SAndy Fiddaman */
330*b30d1939SAndy Fiddaman
331*b30d1939SAndy Fiddamansocket :MAPLIB: socket.c nsl.c
332*b30d1939SAndy Fiddaman
333*b30d1939SAndy Fiddaman/*
334*b30d1939SAndy Fiddaman * more substance abuse
335*b30d1939SAndy Fiddaman * gdbm's ndbm "compatibility" doesn't supply <ndbm.h>, instead supplies
336*b30d1939SAndy Fiddaman * <gdbm/ndbm.h> which provides K&R prototypes *and* it requires -lgdbm
337*b30d1939SAndy Fiddaman * some <ndbm.h> implementations use -lndbm, others -ldbm, still others -lc
338*b30d1939SAndy Fiddaman * this is why unix is starting to look like windows
339*b30d1939SAndy Fiddaman * this map allows makefiles to use -ldbm on all systems
340*b30d1939SAndy Fiddaman *
341*b30d1939SAndy Fiddaman * and this just in: sometimes its <gdbm-ndbm.h> and possibly -lgdbm_compat
342*b30d1939SAndy Fiddaman *
343*b30d1939SAndy Fiddaman * at least the -l* buck stops here
344*b30d1939SAndy Fiddaman */
345*b30d1939SAndy Fiddaman
346*b30d1939SAndy Fiddamandbm db - gdbm_compat - gdbm - ndbm - dbm :MAPLIB: db.c gdbm.c gdbm1.c gdbm2.c