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