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