summaryrefslogtreecommitdiff
path: root/src/cmd/INIT/Makefile
blob: b1af6aad9b6273d1faa0bea85e9444b00c678ae8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
/*
 * initialization for all packages
 */

:PACKAGE: license=ast

LICENSE = since=1994,author=gsf

PACKAGEROOT = $(INSTALLROOT:T=F:P=L*:O=n)

hurl :: hurl.sh LICENSE=since=2003,author=gsf

iffe :: iffe.sh LICENSE=since=1994,author=gsf+kpv

mktest :: mktest.sh LICENSE=since=2005,author=gsf

package :: package.sh

regress :: regress.sh LICENSE=since=1995,author=gsf

rt :: rt.sh LICENSE=since=2005,author=gsf

$(PACKAGEROOT)/bin :INSTALLDIR: execrate ignore mamprobe package silent

crossexec :: crossexec.sh

ditto :: ditto.sh LICENSE=since=2001,author=gsf+ek

execrate :: execrate.sh LICENSE=since=2002,author=gsf

filter :: filter.sh

ignore :: ignore.sh

silent :: silent.sh

$(PACKAGEROOT)/lib/package :INSTALLDIR: package.mk CONVERT.mk

$(LIBDIR)/make :INSTALLDIR: package.mk PROBE.mk TEST.mk WWW.mk \
	MSGFUN.mk MSGKEY.mk MAPLIB.mk

:TEST: iffe mamake

cc ld ldd :PACKAGE_INIT: mamake.c proto.c ratz.c release.c

:: RELEASE hosttype.tst p.c hello.c \
	ar.ibm.risc \
	cc.specialize cc.pentium4 \
	ldd.cygwin.i386 \
	cc.darwin.i386 cc.darwin.i386-64 cc.darwin ldd.darwin \
	cc.hp.ia64 cc.hp.pa cc.hp.pa64 ld.hp.pa ldd.hp.pa \
	cc.ibm.risc cc.ibm.risc.gcc ldd.ibm.risc \
	cc.linux.ia64-icc cc.linux.i386-icc cc.linux.i386-64-icc \
	cc.lynxos.i386 cc.lynxos.ppc ldd.lynxos \
	cc.mvs.390 cc.next.i386 cc.next.m68k ldd.mvs.390 \
	cc.osf.alpha \
	cc.sco.i386 \
	cc.sgi.mips2 cc.sgi.mips3 cc.sgi.mips3-o32 cc.sgi.mips4 \
	cc.sgi.mips4-n32 ldd.sgi \
	cc.unix.mc68k

LICENSE : .DONTCARE

if ! CC.HOSTTYPE
	CC.HOSTTYPE := $(_hosttype_|HOSTTYPE)
end

$(BINDIR)/mkdir :INSTALL: mkdir.sh
	if	test ! -x $(<) -a -x /bin/mkdir
	then	mkdir -p 2>/dev/null || :
		if	test -d ./-p
		then	rmdir ./-p
			cp $(*) $(<)
			chmod +x $(<)
		fi
	fi

/*
 * ksh93 function search on PATH
 * ksh93 builtin command library -lcmd
 * ksh93 ld library path search on PATH
 */

$(BINDIR)/.paths :INSTALL: (CC.DIALECT)
	if	test ! -f $(<) -o -w $(<)
	then	nl="
"
		o=`cat $(<) 2>/dev/null` || :
		v=
		n=
		case $nl$o in
		*${nl}FPATH=*|*#FPATH=*|*[Nn][Oo]FPATH=*)
			;;
		*)	case $n in
			'')	;;
			*)	n="$n$nl" v="$v|" ;;
			esac
			n="${n}FPATH=../fun"
			v="${v}FPATH"
			;;
		esac
		case $nl$o in
		*${nl}BUILTIN_LIB=*|*#BUILTIN_LIB=*|*[Nn][Oo]BUILTIN_LIB=*)
			;;
		*)	case $n in
			'')	;;
			*)	n="$n$nl" v="$v|" ;;
			esac
			case '$(CC.DIALECT:N=*EXPORT=[AD]LL*)' in
			?*)	p= c= ;;
			*)	p='XX' ;;
			esac
			n="${n}${p}BUILTIN_LIB=cmd"
			v="${v}BUILTIN_LIB"
			;;
		esac
		set x x : $(-mam:??$(.GETCONF LIBPATH:/:/ /G:/,/ : /G:Q)?)
		p=
		while	:
		do	while	:
			do	case $# in
				0)	break ;;
				esac
				x=$1
				shift
				case $x in
				:)	break ;;
				esac
			done
			case $# in
			0|1)	break
				;;
			2)	p=$2
				;;
			*)	case "$(CC.HOSTTYPE)" in
				$3)	p=$2; break ;;
				esac
				;;
			esac
		done
		case $p in
		'')	if	test -x /lib/dld.sl
			then	p=SHLIB_PATH
			elif	test -x /usr/lib/dyld
			then	p=DYLD_LIBRARY_PATH
			else	case "$(CC.HOSTTYPE)" in
				ibm.*|mvs.*)
					p=LIBPATH
					;;
				sgi.mips3)	
					p=LD_LIBRARYN32_PATH
					;;
				sgi.mips4)	
					p=LD_LIBRARYN64_PATH
					;;
				*)	p=LD_LIBRARY_PATH
					;;
				esac
			fi
			;;
		esac
		case $nl$o in
		*${nl}${p}=*|*#${p}=*|*[Nn][Oo]${p}=*)
			;;
		*)	case $n in
			'')	;;
			*)	n="$n$nl" v="$v|" ;;
			esac
			n="${n}${p}=../lib"
			v="${v}${p}"
			;;
		esac
		case $n in
		?*)	case $o in
			?*)	o=`egrep -v "($v)=" $(<)`$nl ;;
			esac
			echo "# use { # no NO } prefix instead of XX to permanently disable #$nl$o$n" > $(<)
			;;
		esac
	fi

/*
 * probe initialization
 */

for T C+probe C+make+probe.lcl C+pp+probe.lcl
	if T == "*.lcl"
		$(T) : .DONTCARE
	end
	$(LIBDIR)/probe/$(T:C,+,/,G) :INSTALL: $(T)
end

$(LIBDIR)/probe/C/mam/probe :INSTALL: mprobe

mprobe :: mprobe.sh

$(LIBDIR)/probe/C/make :INSTALLDIR: probe probe.ini

probe.sh : C+probe make.probe
	cat $(*) > $(<)

probe :: probe.sh

probe.ini : (CC.HOSTTYPE) probe.win32
	t=$(CC.HOSTTYPE)
	ifs=$IFS
	IFS=.
	set x $t
	IFS=$ifs
	t=$2
	set x $(*)
	while	:
	do	shift
		case $# in
		0)	break ;;
		esac
		case $1 in
		*probe.$t)
			break
		esac
	done
	case $1 in
	?*)	cmp -s $1 $(<) || cp $1 $(<) ;;
	*)	: > $(<)
	esac

/*
 * proto initialization
 */

$(INCLUDEDIR) :INSTALLDIR: prototyped.h

prototyped.h : $(BINDIR)/proto
	proto -f /dev/null > h.$(tmp).h
	if	$(CMP) -s h.$(tmp).h $(<)
	then	$(RM) -f h.$(tmp).h
	else	$(MV) h.$(tmp).h $(<)
	fi

/*
 * check if -ldl is required
 * this allows makefiles to use -ldl on all systems
 *
 * NOTE: this works around the sgi botch:
 *	 (1) irix 5.* made -ldl optional but warned
 *	 (2) irix 6.* has no -ldl
 *	 (3) dynamic progs built on irix 5.* and using -ldl fail
 *           at runtime on irix 6.* because -ldl is not there
 */

dl :MAPLIB: dl.c

/*
 * requiring these is a botch
 */

iconv :MAPLIB: iconv.c

w :MAPLIB: w.c w2.c

/*
 * miscellaneous -l* checks
 */

intl :MAPLIB: intl.c

m :MAPLIB: m.c m2.c m3.c m4.c m5.c m6.c

nsl :MAPLIB: nsl.c

/*
 * what was sco smoking
 * almost all of gethost* are in -lnsl except gethostbyname which
 * is in -lsocket which isn't needed to resolve socket() but seems
 * to do the -lnsl job
 */

socket :MAPLIB: socket.c nsl.c

/*
 * more substance abuse
 * gdbm's ndbm "compatibility" doesn't supply <ndbm.h>, instead supplies
 * <gdbm/ndbm.h> which provides K&R prototypes *and* it requires -lgdbm
 * some <ndbm.h> implementations use -lndbm, others -ldbm, still others -lc
 * this is why unix is starting to look like windows
 * this map allows makefiles to use -ldbm on all systems
 *
 * and this just in: sometimes its <gdbm-ndbm.h> and possibly -lgdbm_compat
 *
 * at least the -l* buck stops here
 */

dbm db - gdbm_compat - gdbm - ndbm - dbm :MAPLIB: db.c gdbm.c gdbm1.c gdbm2.c