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