Commit | Line | Data |
---|---|---|
2304df62 AD |
1 | case $CONFIG in |
2 | '') | |
3 | if test -f config.sh; then TOP=.; | |
4 | elif test -f ../config.sh; then TOP=..; | |
5 | elif test -f ../../config.sh; then TOP=../..; | |
6 | elif test -f ../../../config.sh; then TOP=../../..; | |
7 | elif test -f ../../../../config.sh; then TOP=../../../..; | |
8 | else | |
9 | echo "Can't find config.sh."; exit 1 | |
10 | fi | |
11 | . $TOP/config.sh | |
12 | ;; | |
13 | esac | |
14 | : This forces SH files to create target in same directory as SH file. | |
15 | : This is so that make depend always knows where to find SH derivatives. | |
16 | case "$0" in | |
17 | */*) cd `expr X$0 : 'X\(.*\)/'` ;; | |
18 | esac | |
19 | ||
2304df62 AD |
20 | case "$d_dosuid" in |
21 | *define*) suidperl='suidperl' ;; | |
22 | *) suidperl='';; | |
23 | esac | |
24 | ||
ecfc5424 AD |
25 | shrpenv="" |
26 | case "$d_shrplib" in | |
27 | *define*) | |
28 | patchlevel=`egrep '^#define[ ]+PATCHLEVEL' patchlevel.h \ | |
29 | | awk '{print $3}'` | |
30 | case "$patchlevel" in | |
31 | *[0-9]) plibsuf=.$so.$patchlevel;; | |
32 | *) plibsuf=.$so;; | |
33 | esac | |
34 | case "$shrpdir" in | |
35 | /usr/lib) ;; | |
36 | "") ;; | |
37 | *) shrpenv="env LD_RUN_PATH=$shrpdir";; | |
38 | esac | |
39 | pldlflags="$cccdlflags";; | |
40 | *) plibsuf=.a | |
41 | pldlflags="";; | |
42 | esac | |
43 | ||
a0d0e21e LW |
44 | : Prepare dependency lists for Makefile. |
45 | dynamic_list=' ' | |
46 | for f in $dynamic_ext; do | |
47 | : the dependency named here will never exist | |
ecfc5424 | 48 | base=`echo "$f" | sed 's/.*\///'` |
75f92628 | 49 | dynamic_list="$dynamic_list lib/auto/$f/$base.$dlext" |
a0d0e21e LW |
50 | done |
51 | ||
52 | static_list=' ' | |
53 | static_ai_list=' ' | |
54 | for f in $static_ext; do | |
55 | base=`echo "$f" | sed 's/.*\///'` | |
75f92628 | 56 | static_list="$static_list lib/auto/$f/$base.a" |
a0d0e21e LW |
57 | if test -f ext/$f/AutoInit.c; then |
58 | static_ai_list="$static_ai_list ext/$f/AutoInit.c" | |
59 | fi | |
60 | if test -f ext/$f/AutoInit.pl; then | |
61 | static_ai_list="$static_ai_list ext/$f/AutoInit.pl" | |
62 | fi | |
63 | done | |
64 | ||
2304df62 | 65 | echo "Extracting Makefile (with variable substitutions)" |
a0d0e21e LW |
66 | $spitshell >Makefile <<'!NO!SUBS!' |
67 | # Makefile.SH | |
85e6fe83 LW |
68 | # This file is derived from Makefile.SH. Any changes made here will |
69 | # be lost the next time you run Configure. | |
70 | # Makefile is used to generate makefile. The only difference | |
71 | # is that makefile has the dependencies filled in at the end. | |
2304df62 | 72 | # |
2304df62 | 73 | # |
a0d0e21e | 74 | !NO!SUBS! |
2304df62 | 75 | |
a0d0e21e | 76 | $spitshell >>Makefile <<!GROK!THIS! |
2304df62 AD |
77 | # I now supply perly.c with the kits, so don't remake perly.c without byacc |
78 | BYACC = $byacc | |
79 | CC = $cc | |
80 | bin = $installbin | |
81 | scriptdir = $scriptdir | |
82 | privlib = $installprivlib | |
83 | mansrc = $mansrc | |
84 | manext = $manext | |
85 | LDFLAGS = $ldflags | |
86 | CLDFLAGS = $ldflags | |
85e6fe83 | 87 | |
2304df62 AD |
88 | SMALL = $small |
89 | LARGE = $large $split | |
90 | mallocsrc = $mallocsrc | |
91 | mallocobj = $mallocobj | |
85e6fe83 | 92 | LNS = $lns |
2304df62 | 93 | RMS = rm -f |
85e6fe83 LW |
94 | ranlib = $ranlib |
95 | ||
96 | # The following are used to build and install shared libraries for | |
97 | # dynamic loading. | |
98 | LDDLFLAGS = $lddlflags | |
99 | CCDLFLAGS = $ccdlflags | |
a0d0e21e | 100 | DLSUFFIX = .$dlext |
ecfc5424 AD |
101 | PLDLFLAGS = $pldlflags |
102 | PLIBSUF = $plibsuf | |
103 | SHRPENV = $shrpenv | |
a0d0e21e LW |
104 | |
105 | dynamic_ext = $dynamic_list | |
106 | static_ext = $static_list | |
107 | ext = \$(dynamic_ext) \$(static_ext) | |
108 | static_ext_autoinit = $static_ai_list | |
75f92628 AD |
109 | DYNALOADER = lib/auto/DynaLoader/DynaLoader.a |
110 | ||
2304df62 AD |
111 | |
112 | libs = $libs $cryptlib | |
113 | ||
114 | public = perl $suidperl | |
115 | ||
116 | shellflags = $shellflags | |
117 | ||
a0d0e21e | 118 | ## To use an alternate make, set \$altmake in config.sh. |
2304df62 AD |
119 | MAKE = ${altmake-make} |
120 | !GROK!THIS! | |
121 | ||
85e6fe83 | 122 | ## In the following dollars and backticks do not need the extra backslash. |
2304df62 AD |
123 | $spitshell >>Makefile <<'!NO!SUBS!' |
124 | ||
a0d0e21e | 125 | CCCMD = `sh $(shellflags) cflags $(perllib) $@` |
2304df62 AD |
126 | |
127 | private = | |
128 | ||
a0d0e21e | 129 | scripts = |
2304df62 | 130 | |
a0d0e21e | 131 | manpages = perl.man |
2304df62 AD |
132 | |
133 | util = | |
134 | ||
3edbfbe5 | 135 | sh = Makefile.SH cflags.SH makedepend.SH makedir.SH writemain.SH |
2304df62 | 136 | |
2304df62 | 137 | h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h |
a0d0e21e | 138 | h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h |
2304df62 AD |
139 | h3 = opcode.h patchlevel.h perl.h perly.h pp.h proto.h regcomp.h |
140 | h4 = regexp.h scope.h sv.h unixish.h util.h | |
141 | h = $(h1) $(h2) $(h3) $(h4) | |
142 | ||
a0d0e21e LW |
143 | c1 = $(mallocsrc) av.c scope.c op.c doop.c doio.c dump.c hv.c mg.c |
144 | c2 = perl.c perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c | |
ecfc5424 | 145 | c3 = gv.c sv.c taint.c toke.c util.c deb.c run.c globals.c |
2304df62 | 146 | |
a0d0e21e | 147 | c = $(c1) $(c2) $(c3) miniperlmain.c perlmain.c |
2304df62 | 148 | |
a0d0e21e LW |
149 | obj1 = $(mallocobj) gv.o toke.o perly.o op.o regcomp.o dump.o util.o mg.o |
150 | obj2 = hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o | |
ecfc5424 | 151 | obj3 = doop.o doio.o regexec.o taint.o deb.o globals.o |
2304df62 | 152 | |
85e6fe83 | 153 | obj = $(obj1) $(obj2) $(obj3) |
2304df62 | 154 | |
a0d0e21e LW |
155 | # Once perl has been Configure'd and built ok you build different |
156 | # perl variants (Debugging, Embedded, Multiplicity etc) by saying: | |
157 | # make clean; make perllib=libperl<type>.a | |
158 | # where <type> is some combination of 'd' and(or) 'e' or 'm'. | |
159 | # See cflags to understand how this works. | |
160 | # | |
161 | # Eventually some form of 'make-a-perl' script will automate this | |
162 | # together with linking a perl executable with any desired | |
163 | # static modules. | |
ecfc5424 | 164 | perllib = libperl$(PLIBSUF) |
a0d0e21e | 165 | |
2304df62 AD |
166 | lintflags = -hbvxac |
167 | ||
a0d0e21e | 168 | addedbyconf = UU |
2304df62 AD |
169 | |
170 | # grrr | |
171 | SHELL = /bin/sh | |
172 | ||
2304df62 | 173 | .c.o: |
ecfc5424 | 174 | $(CCCMD) $(PLDLFLAGS) $*.c |
2304df62 | 175 | |
a0d0e21e LW |
176 | all: makefile miniperl preplibrary $(public) $(dynamic_ext) |
177 | @echo " "; echo " Making x2p stuff"; cd x2p; $(MAKE) all | |
178 | @echo " "; echo " Making docs"; cd pod; $(MAKE) all; | |
85e6fe83 LW |
179 | |
180 | # Phony target to force checking subdirectories. | |
181 | FORCE: | |
182 | ||
2304df62 | 183 | !NO!SUBS! |
85e6fe83 | 184 | |
a0d0e21e | 185 | : Now on to the rest of the Makefile. |
2304df62 AD |
186 | $spitshell >>Makefile <<'!NO!SUBS!' |
187 | # The $& notation tells Sequent machines that it can do a parallel make, | |
188 | # and is harmless otherwise. | |
189 | ||
a0d0e21e LW |
190 | miniperl: $& miniperlmain.o $(perllib) |
191 | $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain.o $(perllib) $(libs) | |
2304df62 | 192 | |
ecfc5424 AD |
193 | miniperlmain.o: miniperlmain.c |
194 | $(CCCMD) $(PLDLFLAGS) $*.c | |
195 | ||
a0d0e21e LW |
196 | perlmain.c: miniperlmain.c config.sh makefile $(static_ext_autoinit) |
197 | sh writemain $(DYNALOADER) $(static_ext) > tmp | |
198 | sh mv-if-diff tmp perlmain.c | |
85e6fe83 | 199 | |
2304df62 | 200 | perlmain.o: perlmain.c |
ecfc5424 | 201 | $(CCCMD) $(PLDLFLAGS) $*.c |
85e6fe83 | 202 | |
a0d0e21e LW |
203 | # The file ext.libs is a list of libraries that must be linked in |
204 | # for static extensions, e.g. -lm -lgdbm, etc. The individual | |
205 | # static extension Makefile's add to it. | |
206 | ext.libs: $(static_ext) | |
207 | -@test -f ext.libs || touch ext.libs | |
85e6fe83 | 208 | |
a0d0e21e | 209 | perl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs |
ecfc5424 | 210 | $(SHRPENV) $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) |
85e6fe83 | 211 | |
a0d0e21e LW |
212 | pureperl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs |
213 | purify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) | |
2304df62 | 214 | |
a0d0e21e LW |
215 | quantperl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs |
216 | quantify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) | |
2304df62 | 217 | |
a0d0e21e | 218 | $(perllib): $& perl.o $(obj) |
ecfc5424 AD |
219 | !NO!SUBS! |
220 | ||
221 | case "$d_shrplib" in | |
222 | *define*) | |
223 | $spitshell >>Makefile <<'!NO!SUBS!' | |
224 | ld $(LDDLFLAGS) -o $@ perl.o $(obj) | |
225 | !NO!SUBS! | |
226 | ;; | |
227 | *) | |
228 | $spitshell >>Makefile <<'!NO!SUBS!' | |
a0d0e21e LW |
229 | ar rcu $(perllib) perl.o $(obj) |
230 | @$(ranlib) $(perllib) | |
ecfc5424 AD |
231 | !NO!SUBS! |
232 | ;; | |
233 | esac | |
234 | ||
235 | $spitshell >>Makefile <<'!NO!SUBS!' | |
2304df62 AD |
236 | |
237 | # This version, if specified in Configure, does ONLY those scripts which need | |
238 | # set-id emulation. Suidperl must be setuid root. It contains the "taint" | |
239 | # checks as well as the special code to validate that the script in question | |
240 | # has been invoked correctly. | |
241 | ||
a0d0e21e LW |
242 | suidperl: $& sperl.o perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs |
243 | $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o suidperl perlmain.o sperl.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) | |
2304df62 AD |
244 | |
245 | sperl.o: perl.c perly.h patchlevel.h $(h) | |
246 | $(RMS) sperl.c | |
85e6fe83 | 247 | $(LNS) perl.c sperl.c |
2304df62 AD |
248 | $(CCCMD) -DIAMSUID sperl.c |
249 | $(RMS) sperl.c | |
250 | ||
2304df62 | 251 | opcode.h: opcode.pl |
85e6fe83 | 252 | - perl opcode.pl |
2304df62 | 253 | |
3edbfbe5 TB |
254 | embed.h: embed_h.sh global.sym interp.sym |
255 | sh embed_h.sh | |
2304df62 | 256 | |
a0d0e21e | 257 | preplibrary: miniperl lib/Config.pm |
ecfc5424 | 258 | @./makedir lib/auto |
a0d0e21e LW |
259 | @echo " AutoSplitting perl library" |
260 | @./miniperl -Ilib -e 'use AutoSplit; \ | |
261 | autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm | |
2304df62 | 262 | |
75f92628 | 263 | # Take care to avoid modifying lib/Config.pm without reason |
a0d0e21e | 264 | lib/Config.pm: config.sh miniperl |
75f92628 AD |
265 | ./miniperl configpm tmp |
266 | sh mv-if-diff tmp lib/Config.pm | |
2304df62 AD |
267 | |
268 | install: all | |
269 | ./perl installperl | |
a0d0e21e LW |
270 | !NO!SUBS! |
271 | ||
272 | : Only print out the rules for running byacc if the user _has_ byacc. | |
273 | : Otherwise, comment them out. Users who really know what they are | |
274 | : doing can uncomment them and run yacc or bison or whatever. | |
1aef975c AD |
275 | case "$d_byacc" in |
276 | 'define') | |
277 | comment1='' | |
a0d0e21e | 278 | comment2='#' ;; |
1aef975c AD |
279 | *) comment1='#' |
280 | comment2='' ;; | |
a0d0e21e LW |
281 | esac |
282 | ||
283 | $spitshell >>Makefile <<!GROK!THIS! | |
284 | ||
285 | perly.h: perly.c | |
286 | @ echo Dummy dependency for dumb parallel make | |
287 | touch perly.h | |
288 | ||
289 | # I now supply perly.c with the kits, so the following section is | |
ecfc5424 | 290 | # used only if you have byacc. |
a0d0e21e LW |
291 | |
292 | ${comment1}perly.c: perly.y perly.c.diff | |
293 | ${comment1} @ echo 'Expect' 109 shift/reduce and 1 reduce/reduce conflict | |
294 | ${comment1} \$(BYACC) -d perly.y | |
295 | ${comment1} sh \$(shellflags) ./perly.fixer y.tab.c perly.c | |
296 | ${comment1} mv y.tab.h perly.h | |
297 | ${comment1} echo 'extern YYSTYPE yylval;' >>perly.h | |
298 | ||
ecfc5424 | 299 | # This version is used if you do not have byacc. |
a0d0e21e LW |
300 | ${comment2}perly.c: perly.y |
301 | ${comment2} touch perly.c | |
302 | ||
303 | !GROK!THIS! | |
304 | ||
305 | $spitshell >>Makefile <<'!NO!SUBS!' | |
306 | # Extensions: | |
307 | # Names added to $(dynamic_ext) or $(static_ext) will automatically | |
308 | # get built. There should ordinarily be no need to change any of | |
309 | # this part of makefile. | |
310 | # | |
311 | # The dummy dependency is a place holder in case $(dynamic_ext) or | |
312 | # $(static_ext) is empty. | |
313 | # | |
314 | # DynaLoader may be needed for extensions that use Makefile.PL. | |
315 | ||
316 | $(DYNALOADER): miniperl preplibrary FORCE | |
317 | @sh ext/util/make_ext static $@ | |
318 | ||
319 | d_dummy $(dynamic_ext): miniperl preplibrary $(DYNALOADER) FORCE | |
320 | @sh ext/util/make_ext dynamic $@ | |
321 | ||
322 | s_dummy $(static_ext): miniperl preplibrary $(DYNALOADER) FORCE | |
323 | @sh ext/util/make_ext static $@ | |
2304df62 AD |
324 | |
325 | clean: | |
42793c05 | 326 | rm -f *.o *.a all perlmain.c |
a0d0e21e LW |
327 | rm -f perl.exp ext.libs ext/util/extlibist |
328 | -cd x2p; $(MAKE) clean | |
329 | -cd pod; $(MAKE) clean | |
75f92628 | 330 | -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \ |
42793c05 | 331 | sh ext/util/make_ext clean $$x ; \ |
a0d0e21e | 332 | done |
ecfc5424 | 333 | rm -f perl suidperl miniperl $(perllib) |
2304df62 AD |
334 | |
335 | realclean: clean | |
a0d0e21e | 336 | -cd x2p; $(MAKE) realclean |
42793c05 TB |
337 | @for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \ |
338 | sh ext/util/make_ext realclean $$x ; \ | |
a0d0e21e | 339 | done |
42793c05 | 340 | rm -f *.orig */*.orig *~ */*~ core t/core t/c t/perl |
a0d0e21e LW |
341 | rm -rf $(addedbyconf) |
342 | rm -f Makefile cflags makedepend makedir writemain | |
42793c05 | 343 | rm -f config.h makefile makefile.old |
85e6fe83 | 344 | rm -f lib/Config.pm |
a0d0e21e LW |
345 | rm -rf lib/auto |
346 | rm -f h2ph h2ph.man c2ph pstruct | |
347 | rm -rf .config | |
75f92628 | 348 | @echo "Note that make realclean does not delete config.sh" |
2304df62 | 349 | |
ecfc5424 AD |
350 | clobber: realclean |
351 | rm -f config.sh cppstdin | |
352 | ||
353 | distclean: clobber | |
354 | ||
2304df62 AD |
355 | # The following lint has practically everything turned on. Unfortunately, |
356 | # you have to wade through a lot of mumbo jumbo that can't be suppressed. | |
357 | # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message | |
358 | # for that spot. | |
359 | ||
360 | lint: perly.c $(c) | |
361 | lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz | |
362 | ||
a0d0e21e | 363 | makefile: Makefile |
1aef975c | 364 | $(MAKE) depend |
a0d0e21e | 365 | |
75f92628 AD |
366 | config.h: config.sh |
367 | /bin/sh config_h.SH | |
368 | ||
a0d0e21e | 369 | # When done, touch perlmain.c so that it doesn't get remade each time. |
2304df62 AD |
370 | depend: makedepend |
371 | - test -f perly.h || cp /dev/null perly.h | |
372 | ./makedepend | |
373 | - test -s perly.h || /bin/rm -f perly.h | |
a0d0e21e | 374 | - test -s perlmain.c && touch perlmain.c |
2304df62 AD |
375 | cd x2p; $(MAKE) depend |
376 | ||
a0d0e21e | 377 | test: miniperl perl preplibrary $(dynamic_ext) |
2304df62 | 378 | - cd t && chmod +x TEST */*.t |
85e6fe83 | 379 | - cd t && (rm -f perl; $(LNS) ../perl perl) && ./perl TEST </dev/tty |
2304df62 | 380 | |
85e6fe83 | 381 | clist: $(c) |
2304df62 AD |
382 | echo $(c) | tr ' ' '\012' >.clist |
383 | ||
85e6fe83 | 384 | hlist: $(h) |
2304df62 AD |
385 | echo $(h) | tr ' ' '\012' >.hlist |
386 | ||
85e6fe83 | 387 | shlist: $(sh) |
2304df62 AD |
388 | echo $(sh) | tr ' ' '\012' >.shlist |
389 | ||
390 | # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE | |
391 | # If this runs make out of memory, delete /usr/include lines. | |
392 | !NO!SUBS! | |
393 | ||
85e6fe83 | 394 | $eunicefix Makefile |
2304df62 AD |
395 | case `pwd` in |
396 | *SH) | |
85e6fe83 LW |
397 | $rm -f ../Makefile |
398 | ln Makefile ../Makefile | |
2304df62 AD |
399 | ;; |
400 | esac | |
401 | rm -f makefile |