home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / perl / Perl / Makefile.SH < prev    next >
Makefile  |  1995-12-06  |  13KB  |  452 lines

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