perl 1.0 patch 13: fix for faulty patch 12, plus random portability glitches
[p5sagit/p5-mst-13.2.git] / Makefile.SH
1 case $CONFIG in
2 '')
3     if test ! -f config.sh; then
4         ln ../config.sh . || \
5         ln ../../config.sh . || \
6         ln ../../../config.sh . || \
7         (echo "Can't find config.sh."; exit 1)
8     fi
9     . config.sh
10     ;;
11 esac
12 case "$0" in
13 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
14 esac
15
16 case "$d_symlink" in
17 *define*) sln='ln -s' ;;
18 *) sln='ln';;
19 esac
20
21 echo "Extracting Makefile (with variable substitutions)"
22 cat >Makefile <<!GROK!THIS!
23 # $Header: Makefile.SH,v 1.0.1.5 88/02/02 11:20:49 root Exp $
24 #
25 # $Log: Makefile.SH,v $
26 # Revision 1.0.1.5  88/02/02  11:20:49  root
27 # patch13: added d_symlink dependency, changed TEST to ./perl TEST.
28
29 # Revision 1.0.1.4  88/01/28  10:17:59  root
30 # patch8: added perldb.man
31
32 # Revision 1.0.1.3  88/01/26  14:14:52  root
33 # Added mallocsrc stuff.
34
35 # Revision 1.0.1.2  88/01/26  08:46:04  root
36 # patch 4: make depend didn't work right if . wasn't in PATH.
37
38 # Revision 1.0.1.1  88/01/24  03:55:18  root
39 # patch 2: remove extra Log lines.
40
41 # Revision 1.0  87/12/18  16:11:50  root
42 # Initial revision
43
44
45 CC = $cc
46 bin = $bin
47 lib = $lib
48 mansrc = $mansrc
49 manext = $manext
50 CFLAGS = $ccflags -O
51 LDFLAGS = $ldflags
52 SMALL = $small
53 LARGE = $large $split
54 mallocsrc = $mallocsrc
55 mallocobj = $mallocobj
56 SLN = $sln
57
58 libs = $libnm -lm
59 !GROK!THIS!
60
61 cat >>Makefile <<'!NO!SUBS!'
62
63 public = perl perldb
64
65 private = 
66
67 manpages = perl.man perldb.man
68
69 util =
70
71 sh = Makefile.SH makedepend.SH
72
73 h1 = EXTERN.h INTERN.h arg.h array.h cmd.h config.h form.h handy.h
74 h2 = hash.h perl.h search.h spat.h stab.h str.h util.h
75
76 h = $(h1) $(h2)
77
78 c1 = arg.c array.c cmd.c dump.c form.c hash.c $(mallocsrc)
79 c2 = search.c stab.c str.c util.c version.c
80
81 c = $(c1) $(c2)
82
83 obj1 = arg.o array.o cmd.o dump.o form.o hash.o $(mallocobj)
84 obj2 = search.o stab.o str.o util.o version.o
85
86 obj = $(obj1) $(obj2)
87
88 lintflags = -phbvxac
89
90 addedbyconf = Makefile.old bsd eunice filexp loc pdp11 usg v7
91
92 # grrr
93 SHELL = /bin/sh
94
95 .c.o:
96         $(CC) -c $(CFLAGS) $(LARGE) $*.c
97
98 all: $(public) $(private) $(util)
99         touch all
100
101 perl: $(obj) perl.o
102         $(CC) $(LDFLAGS) $(LARGE) $(obj) perl.o $(libs) -o perl
103
104 perl.c: perl.y
105         @ echo Expect 2 shift/reduce errors...
106         yacc perl.y
107         mv y.tab.c perl.c
108
109 perl.o: perl.c perly.c perl.h EXTERN.h search.h util.h INTERN.h handy.h
110         $(CC) -c $(CFLAGS) $(LARGE) perl.c
111
112 # if a .h file depends on another .h file...
113 $(h):
114         touch $@
115
116 perl.man: perl.man.1 perl.man.2
117         cat perl.man.1 perl.man.2 >perl.man
118
119 install: perl perl.man
120 # won't work with csh
121         export PATH || exit 1
122         - mv $(bin)/perl $(bin)/perl.old
123         - if test `pwd` != $(bin); then cp $(public) $(bin); fi
124         cd $(bin); \
125 for pub in $(public); do \
126 chmod 755 `basename $$pub`; \
127 done
128         - test $(bin) = /bin || rm -f /bin/perl
129         - test $(bin) = /bin || ln -s $(bin)/perl /bin || cp $(bin)/perl /bin
130 #       chmod 755 makedir
131 #       - makedir `filexp $(lib)`
132 #       - \
133 #if test `pwd` != `filexp $(lib)`; then \
134 #cp $(private) `filexp $(lib)`; \
135 #fi
136 #       cd `filexp $(lib)`; \
137 #for priv in $(private); do \
138 #chmod 755 `basename $$priv`; \
139 #done
140         - if test `pwd` != $(mansrc); then \
141 for page in $(manpages); do \
142 cp $$page $(mansrc)/`basename $$page .man`.$(manext); \
143 done; \
144 fi
145
146 clean:
147         rm -f *.o
148
149 realclean:
150         rm -f perl *.orig */*.orig *.o core $(addedbyconf)
151
152 # The following lint has practically everything turned on.  Unfortunately,
153 # you have to wade through a lot of mumbo jumbo that can't be suppressed.
154 # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
155 # for that spot.
156
157 lint:
158         lint $(lintflags) $(defs) $(c) > perl.fuzz
159
160 depend: makedepend
161         ./makedepend
162
163 test: perl
164         chmod 755 t/TEST t/base.* t/comp.* t/cmd.* t/io.* t/op.*
165         cd t && (rm -f perl; $(SLN) ../perl .) && ./perl TEST
166
167 clist:
168         echo $(c) | tr ' ' '\012' >.clist
169
170 hlist:
171         echo $(h) | tr ' ' '\012' >.hlist
172
173 shlist:
174         echo $(sh) | tr ' ' '\012' >.shlist
175
176 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
177 $(obj):
178         @ echo "You haven't done a "'"make depend" yet!'; exit 1
179 makedepend: makedepend.SH
180         /bin/sh makedepend.SH
181 !NO!SUBS!
182 $eunicefix Makefile
183 case `pwd` in
184 *SH)
185     $rm -f ../Makefile
186     ln Makefile ../Makefile
187     ;;
188 esac