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