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