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 | # |
fed7345c | 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 | |
232e078e | 80 | LD = $ld |
16d20bd9 | 81 | |
2304df62 AD |
82 | LDFLAGS = $ldflags |
83 | CLDFLAGS = $ldflags | |
85e6fe83 | 84 | |
2304df62 AD |
85 | SMALL = $small |
86 | LARGE = $large $split | |
87 | mallocsrc = $mallocsrc | |
88 | mallocobj = $mallocobj | |
85e6fe83 | 89 | LNS = $lns |
2304df62 | 90 | RMS = rm -f |
85e6fe83 LW |
91 | ranlib = $ranlib |
92 | ||
16d20bd9 AD |
93 | # The following are mentioned only to make metaconfig include the |
94 | # appropriate questions in Configure. If you want to change these, | |
95 | # edit config.sh instead, or specify --man1dir=/wherever on | |
96 | # installman commandline. | |
97 | bin = $installbin | |
98 | scriptdir = $scriptdir | |
99 | privlib = $installprivlib | |
100 | man1dir = $man1dir | |
101 | man1ext = $man1ext | |
102 | man3dir = $man3dir | |
103 | man3ext = $man3ext | |
104 | ||
85e6fe83 LW |
105 | # The following are used to build and install shared libraries for |
106 | # dynamic loading. | |
107 | LDDLFLAGS = $lddlflags | |
108 | CCDLFLAGS = $ccdlflags | |
a0d0e21e | 109 | DLSUFFIX = .$dlext |
ecfc5424 AD |
110 | PLDLFLAGS = $pldlflags |
111 | PLIBSUF = $plibsuf | |
112 | SHRPENV = $shrpenv | |
a0d0e21e LW |
113 | |
114 | dynamic_ext = $dynamic_list | |
115 | static_ext = $static_list | |
116 | ext = \$(dynamic_ext) \$(static_ext) | |
117 | static_ext_autoinit = $static_ai_list | |
75f92628 AD |
118 | DYNALOADER = lib/auto/DynaLoader/DynaLoader.a |
119 | ||
2304df62 AD |
120 | |
121 | libs = $libs $cryptlib | |
122 | ||
123 | public = perl $suidperl | |
124 | ||
125 | shellflags = $shellflags | |
126 | ||
a0d0e21e | 127 | ## To use an alternate make, set \$altmake in config.sh. |
2304df62 AD |
128 | MAKE = ${altmake-make} |
129 | !GROK!THIS! | |
130 | ||
85e6fe83 | 131 | ## In the following dollars and backticks do not need the extra backslash. |
2304df62 AD |
132 | $spitshell >>Makefile <<'!NO!SUBS!' |
133 | ||
a0d0e21e | 134 | CCCMD = `sh $(shellflags) cflags $(perllib) $@` |
2304df62 | 135 | |
fed7345c | 136 | private = preplibrary lib/ExtUtils/Miniperl.pm lib/Config.pm |
2304df62 | 137 | |
16d20bd9 AD |
138 | sh = Makefile.SH c2ph.SH cflags.SH config_h.SH h2ph.SH h2xs.SH makeaperl.SH \ |
139 | makedepend.SH makedir.SH perl_exp.SH perldoc.SH writemain.SH | |
2304df62 | 140 | |
16d20bd9 AD |
141 | addedbyconf = UU Makefile c2ph cflags config.h h2ph h2xs makeaperl \ |
142 | makedepend makedir perl_exp perldoc writemain | |
2304df62 | 143 | |
fed7345c | 144 | h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h |
a0d0e21e | 145 | h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h |
2304df62 AD |
146 | h3 = opcode.h patchlevel.h perl.h perly.h pp.h proto.h regcomp.h |
147 | h4 = regexp.h scope.h sv.h unixish.h util.h | |
148 | h = $(h1) $(h2) $(h3) $(h4) | |
149 | ||
a0d0e21e LW |
150 | c1 = $(mallocsrc) av.c scope.c op.c doop.c doio.c dump.c hv.c mg.c |
151 | c2 = perl.c perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c | |
ecfc5424 | 152 | c3 = gv.c sv.c taint.c toke.c util.c deb.c run.c globals.c |
2304df62 | 153 | |
a0d0e21e | 154 | c = $(c1) $(c2) $(c3) miniperlmain.c perlmain.c |
2304df62 | 155 | |
a0d0e21e LW |
156 | obj1 = $(mallocobj) gv.o toke.o perly.o op.o regcomp.o dump.o util.o mg.o |
157 | obj2 = hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o | |
ecfc5424 | 158 | obj3 = doop.o doio.o regexec.o taint.o deb.o globals.o |
2304df62 | 159 | |
85e6fe83 | 160 | obj = $(obj1) $(obj2) $(obj3) |
2304df62 | 161 | |
a0d0e21e LW |
162 | # Once perl has been Configure'd and built ok you build different |
163 | # perl variants (Debugging, Embedded, Multiplicity etc) by saying: | |
164 | # make clean; make perllib=libperl<type>.a | |
165 | # where <type> is some combination of 'd' and(or) 'e' or 'm'. | |
166 | # See cflags to understand how this works. | |
167 | # | |
168 | # Eventually some form of 'make-a-perl' script will automate this | |
169 | # together with linking a perl executable with any desired | |
170 | # static modules. | |
ecfc5424 | 171 | perllib = libperl$(PLIBSUF) |
a0d0e21e | 172 | |
2304df62 AD |
173 | lintflags = -hbvxac |
174 | ||
2304df62 AD |
175 | # grrr |
176 | SHELL = /bin/sh | |
177 | ||
2304df62 | 178 | .c.o: |
ecfc5424 | 179 | $(CCCMD) $(PLDLFLAGS) $*.c |
2304df62 | 180 | |
fed7345c | 181 | all: makefile miniperl $(private) $(public) $(dynamic_ext) |
a0d0e21e | 182 | @echo " "; echo " Making x2p stuff"; cd x2p; $(MAKE) all |
16d20bd9 AD |
183 | |
184 | # This is now done by installman only if you actually want the man pages. | |
185 | # @echo " "; echo " Making docs"; cd pod; $(MAKE) all; | |
85e6fe83 LW |
186 | |
187 | # Phony target to force checking subdirectories. | |
188 | FORCE: | |
189 | ||
2304df62 AD |
190 | # The $& notation tells Sequent machines that it can do a parallel make, |
191 | # and is harmless otherwise. | |
192 | ||
a0d0e21e LW |
193 | miniperl: $& miniperlmain.o $(perllib) |
194 | $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain.o $(perllib) $(libs) | |
2304df62 | 195 | |
ecfc5424 AD |
196 | miniperlmain.o: miniperlmain.c |
197 | $(CCCMD) $(PLDLFLAGS) $*.c | |
198 | ||
a0d0e21e LW |
199 | perlmain.c: miniperlmain.c config.sh makefile $(static_ext_autoinit) |
200 | sh writemain $(DYNALOADER) $(static_ext) > tmp | |
201 | sh mv-if-diff tmp perlmain.c | |
85e6fe83 | 202 | |
2304df62 | 203 | perlmain.o: perlmain.c |
ecfc5424 | 204 | $(CCCMD) $(PLDLFLAGS) $*.c |
85e6fe83 | 205 | |
a0d0e21e LW |
206 | # The file ext.libs is a list of libraries that must be linked in |
207 | # for static extensions, e.g. -lm -lgdbm, etc. The individual | |
208 | # static extension Makefile's add to it. | |
fed7345c | 209 | ext.libs: $(static_ext) |
a0d0e21e | 210 | -@test -f ext.libs || touch ext.libs |
85e6fe83 | 211 | |
a0d0e21e | 212 | perl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs |
ecfc5424 | 213 | $(SHRPENV) $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) |
85e6fe83 | 214 | |
a0d0e21e LW |
215 | pureperl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs |
216 | purify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) | |
2304df62 | 217 | |
a0d0e21e LW |
218 | quantperl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs |
219 | quantify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) | |
2304df62 | 220 | |
a0d0e21e | 221 | $(perllib): $& perl.o $(obj) |
ecfc5424 AD |
222 | !NO!SUBS! |
223 | ||
224 | case "$d_shrplib" in | |
225 | *define*) | |
226 | $spitshell >>Makefile <<'!NO!SUBS!' | |
232e078e | 227 | $(LD) $(LDDLFLAGS) -o $@ perl.o $(obj) |
ecfc5424 AD |
228 | !NO!SUBS! |
229 | ;; | |
230 | *) | |
231 | $spitshell >>Makefile <<'!NO!SUBS!' | |
5d94fbed | 232 | rm -f $(perllib) |
a0d0e21e LW |
233 | ar rcu $(perllib) perl.o $(obj) |
234 | @$(ranlib) $(perllib) | |
ecfc5424 AD |
235 | !NO!SUBS! |
236 | ;; | |
237 | esac | |
238 | ||
239 | $spitshell >>Makefile <<'!NO!SUBS!' | |
2304df62 AD |
240 | |
241 | # This version, if specified in Configure, does ONLY those scripts which need | |
242 | # set-id emulation. Suidperl must be setuid root. It contains the "taint" | |
243 | # checks as well as the special code to validate that the script in question | |
244 | # has been invoked correctly. | |
245 | ||
a0d0e21e LW |
246 | suidperl: $& sperl.o perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs |
247 | $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o suidperl perlmain.o sperl.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) | |
2304df62 AD |
248 | |
249 | sperl.o: perl.c perly.h patchlevel.h $(h) | |
250 | $(RMS) sperl.c | |
85e6fe83 | 251 | $(LNS) perl.c sperl.c |
2304df62 AD |
252 | $(CCCMD) -DIAMSUID sperl.c |
253 | $(RMS) sperl.c | |
254 | ||
16d20bd9 AD |
255 | # The following three header files are generated automatically |
256 | # The correct versions should be already supplied with the perl kit, | |
257 | # in case you don't have perl or 'sh' available. | |
258 | # The - is to ignore error return codes in case you have the source | |
259 | # installed read-only or you don't have perl yet. | |
260 | keywords.h: keywords.pl | |
261 | @echo "Don't worry if this fails." | |
262 | - perl keywords.pl | |
263 | ||
2304df62 | 264 | opcode.h: opcode.pl |
16d20bd9 | 265 | @echo "Don't worry if this fails." |
85e6fe83 | 266 | - perl opcode.pl |
2304df62 | 267 | |
3edbfbe5 | 268 | embed.h: embed_h.sh global.sym interp.sym |
16d20bd9 AD |
269 | @echo "Don't worry if this fails." |
270 | - sh embed_h.sh | |
2304df62 | 271 | |
fec02dd3 AD |
272 | # We have to call our ./makedir because Ultrix 4.3 make can't handle the line |
273 | # test -d lib/auto || mkdir lib/auto | |
274 | # | |
a0d0e21e | 275 | preplibrary: miniperl lib/Config.pm |
ecfc5424 | 276 | @./makedir lib/auto |
a0d0e21e LW |
277 | @echo " AutoSplitting perl library" |
278 | @./miniperl -Ilib -e 'use AutoSplit; \ | |
279 | autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm | |
2304df62 | 280 | |
75f92628 | 281 | # Take care to avoid modifying lib/Config.pm without reason |
a0d0e21e | 282 | lib/Config.pm: config.sh miniperl |
75f92628 AD |
283 | ./miniperl configpm tmp |
284 | sh mv-if-diff tmp lib/Config.pm | |
2304df62 | 285 | |
fed7345c AD |
286 | lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl minimod.PL lib/Config.pm |
287 | ./miniperl minimod.PL > tmp && mv tmp $@ | |
288 | ||
16d20bd9 AD |
289 | install: all install.perl install.man |
290 | ||
291 | install.perl: all | |
2304df62 | 292 | ./perl installperl |
a0d0e21e | 293 | |
16d20bd9 AD |
294 | install.man: all |
295 | ./perl installman | |
296 | ||
297 | # Not implemented yet. | |
298 | #install.html: all | |
299 | # ./perl installhtml | |
300 | ||
a0d0e21e | 301 | # I now supply perly.c with the kits, so the following section is |
56febc5e AD |
302 | # used only if you force byacc to run by saying |
303 | # make run_byacc | |
304 | # Since we patch up the byacc output, the perly.fixer script needs | |
305 | # to run with precisely the same version of byacc as I use. You | |
306 | # normally shouldn't remake perly.[ch]. | |
307 | ||
232e078e | 308 | run_byacc: FORCE |
56febc5e AD |
309 | @ echo 'Expect' 109 shift/reduce and 1 reduce/reduce conflict |
310 | $(BYACC) -d perly.y | |
311 | sh $(shellflags) ./perly.fixer y.tab.c perly.c | |
312 | mv y.tab.h perly.h | |
313 | echo 'extern YYSTYPE yylval;' >>perly.h | |
314 | ||
315 | # We don't want to regenerate perly.c and perly.h, but they might | |
316 | # appear out-of-date after a patch is applied or a new distribution is | |
317 | # made. | |
318 | perly.c: perly.y | |
232e078e | 319 | -@touch perly.c |
56febc5e AD |
320 | |
321 | perly.h: perly.y | |
232e078e | 322 | -@touch perly.h |
a0d0e21e | 323 | |
a0d0e21e LW |
324 | # Extensions: |
325 | # Names added to $(dynamic_ext) or $(static_ext) will automatically | |
fed7345c | 326 | # get built. There should ordinarily be no need to change any of |
a0d0e21e LW |
327 | # this part of makefile. |
328 | # | |
329 | # The dummy dependency is a place holder in case $(dynamic_ext) or | |
330 | # $(static_ext) is empty. | |
331 | # | |
332 | # DynaLoader may be needed for extensions that use Makefile.PL. | |
333 | ||
334 | $(DYNALOADER): miniperl preplibrary FORCE | |
40000a8c | 335 | @sh ext/util/make_ext static $@ LIBPERL_A=$(perllib) |
a0d0e21e LW |
336 | |
337 | d_dummy $(dynamic_ext): miniperl preplibrary $(DYNALOADER) FORCE | |
40000a8c | 338 | @sh ext/util/make_ext dynamic $@ LIBPERL_A=$(perllib) |
a0d0e21e LW |
339 | |
340 | s_dummy $(static_ext): miniperl preplibrary $(DYNALOADER) FORCE | |
40000a8c | 341 | @sh ext/util/make_ext static $@ LIBPERL_A=$(perllib) |
2304df62 AD |
342 | |
343 | clean: | |
42793c05 | 344 | rm -f *.o *.a all perlmain.c |
fed7345c | 345 | rm -f perl.exp ext.libs |
a0d0e21e LW |
346 | -cd x2p; $(MAKE) clean |
347 | -cd pod; $(MAKE) clean | |
75f92628 | 348 | -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \ |
42793c05 | 349 | sh ext/util/make_ext clean $$x ; \ |
a0d0e21e | 350 | done |
ecfc5424 | 351 | rm -f perl suidperl miniperl $(perllib) |
2304df62 AD |
352 | |
353 | realclean: clean | |
a0d0e21e | 354 | -cd x2p; $(MAKE) realclean |
5d94fbed | 355 | -cd pod; $(MAKE) realclean |
42793c05 TB |
356 | @for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \ |
357 | sh ext/util/make_ext realclean $$x ; \ | |
a0d0e21e | 358 | done |
42793c05 | 359 | rm -f *.orig */*.orig *~ */*~ core t/core t/c t/perl |
a0d0e21e | 360 | rm -rf $(addedbyconf) |
16d20bd9 | 361 | rm -f makefile makefile.old |
fed7345c | 362 | rm -f $(private) |
a0d0e21e | 363 | rm -rf lib/auto |
232e078e | 364 | rm -f lib/.exists |
16d20bd9 | 365 | rm -f h2ph.man pstruct |
a0d0e21e | 366 | rm -rf .config |
75f92628 | 367 | @echo "Note that make realclean does not delete config.sh" |
2304df62 | 368 | |
ecfc5424 AD |
369 | clobber: realclean |
370 | rm -f config.sh cppstdin | |
fed7345c | 371 | |
ecfc5424 AD |
372 | distclean: clobber |
373 | ||
2304df62 AD |
374 | # The following lint has practically everything turned on. Unfortunately, |
375 | # you have to wade through a lot of mumbo jumbo that can't be suppressed. | |
376 | # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message | |
377 | # for that spot. | |
378 | ||
379 | lint: perly.c $(c) | |
380 | lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz | |
381 | ||
a0d0e21e | 382 | makefile: Makefile |
1aef975c | 383 | $(MAKE) depend |
a0d0e21e | 384 | |
75f92628 AD |
385 | config.h: config.sh |
386 | /bin/sh config_h.SH | |
387 | ||
a0d0e21e | 388 | # When done, touch perlmain.c so that it doesn't get remade each time. |
2304df62 | 389 | depend: makedepend |
2304df62 | 390 | ./makedepend |
a0d0e21e | 391 | - test -s perlmain.c && touch perlmain.c |
2304df62 AD |
392 | cd x2p; $(MAKE) depend |
393 | ||
a0d0e21e | 394 | test: miniperl perl preplibrary $(dynamic_ext) |
2304df62 | 395 | - cd t && chmod +x TEST */*.t |
85e6fe83 | 396 | - cd t && (rm -f perl; $(LNS) ../perl perl) && ./perl TEST </dev/tty |
2304df62 | 397 | |
16d20bd9 AD |
398 | minitest: miniperl |
399 | - cd t && chmod +x TEST */*.t | |
400 | - cd t && (rm -f perl; $(LNS) ../miniperl perl) \ | |
401 | && ./perl TEST base/*.t comp/*.t cmd/*.t io/*.t op/*.t </dev/tty | |
402 | ||
85e6fe83 | 403 | clist: $(c) |
2304df62 AD |
404 | echo $(c) | tr ' ' '\012' >.clist |
405 | ||
85e6fe83 | 406 | hlist: $(h) |
2304df62 AD |
407 | echo $(h) | tr ' ' '\012' >.hlist |
408 | ||
85e6fe83 | 409 | shlist: $(sh) |
2304df62 AD |
410 | echo $(sh) | tr ' ' '\012' >.shlist |
411 | ||
412 | # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE | |
413 | # If this runs make out of memory, delete /usr/include lines. | |
414 | !NO!SUBS! | |
415 | ||
85e6fe83 | 416 | $eunicefix Makefile |
2304df62 AD |
417 | case `pwd` in |
418 | *SH) | |
85e6fe83 LW |
419 | $rm -f ../Makefile |
420 | ln Makefile ../Makefile | |
2304df62 AD |
421 | ;; |
422 | esac | |
423 | rm -f makefile |