perl 5.0 alpha 6
[p5sagit/p5-mst-13.2.git] / x2p / Makefile.SH
1 case "$0" in
2 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
3 esac
4 case $CONFIG in
5 '')
6     if test ! -f config.sh; then
7         ln ../config.sh . || \
8         ln -s ../config.sh . || \
9         ln ../../config.sh . || \
10         ln ../../../config.sh . || \
11         (echo "Can't find config.sh."; exit 1)
12     fi 2>/dev/null
13     . ./config.sh
14     ;;
15 esac
16 echo "Extracting x2p/Makefile (with variable substitutions)"
17 rm -f Makefile
18 cat >Makefile <<!GROK!THIS!
19 # $RCSfile: Makefile.SH,v $$Revision: 4.1 $$Date: 92/08/07 18:29:07 $
20 #
21 # $Log: Makefile.SH,v $
22 # Revision 4.1  92/08/07  18:29:07  lwall
23
24 # Revision 4.0.1.3  92/06/08  16:11:32  lwall
25 # patch20: SH files didn't work well with symbolic links
26 # patch20: cray didn't give enough memory to /bin/sh
27 # patch20: makefiles now display new shift/reduce expectations
28
29 # Revision 4.0.1.2  91/11/05  19:19:04  lwall
30 # patch11: random cleanup
31
32 # Revision 4.0.1.1  91/06/07  12:12:14  lwall
33 # patch4: cflags now emits entire cc command except for the filename
34
35 # Revision 4.0  91/03/20  01:57:03  lwall
36 # 4.0 baseline.
37
38
39
40 CC = $cc
41 YACC = $yacc
42 bin = $bin
43 lib = $lib
44 mansrc = $mansrc
45 manext = $manext
46 LDFLAGS = $ldflags
47 SMALL = $small
48 LARGE = $large $split
49 mallocsrc = $mallocsrc
50 mallocobj = $mallocobj
51 shellflags = $shellflags
52
53 libs = $libs
54 !GROK!THIS!
55
56 cat >>Makefile <<'!NO!SUBS!'
57
58 CCCMD = `sh $(shellflags) cflags $@`
59
60 public = a2p s2p find2perl
61
62 private = 
63
64 manpages = a2p.man s2p.man
65
66 util =
67
68 sh = Makefile.SH makedepend.SH
69
70 h = EXTERN.h INTERN.h ../config.h handy.h hash.h a2p.h str.h util.h
71
72 c = hash.c $(mallocsrc) str.c util.c walk.c
73
74 obj = hash.o $(mallocobj) str.o util.o walk.o
75
76 lintflags = -phbvxac
77
78 addedbyconf = Makefile.old bsd eunice filexp loc pdp11 usg v7
79
80 # grrr
81 SHELL = /bin/sh
82
83 .c.o:
84         $(CCCMD) $*.c
85
86 all: $(public) $(private) $(util)
87         touch all
88
89 a2p: $(obj) a2p.o
90         $(CC) $(LDFLAGS) $(obj) a2p.o $(libs) -o a2p
91
92 a2p.c: a2p.y
93         @ echo Expect 231 shift/reduce conflicts...
94         $(YACC) a2p.y
95         mv y.tab.c a2p.c
96
97 a2p.o: a2p.c a2py.c a2p.h EXTERN.h util.h INTERN.h handy.h ../config.h str.h hash.h
98         $(CCCMD) $(LARGE) a2p.c
99
100 install: a2p s2p
101 # won't work with csh
102         export PATH || exit 1
103         - mv $(bin)/a2p $(bin)/a2p.old 2>/dev/null
104         - mv $(bin)/s2p $(bin)/s2p.old 2>/dev/null
105         - if test `pwd` != $(bin); then cp $(public) $(bin); fi
106         cd $(bin); \
107 for pub in $(public); do \
108 chmod +x `basename $$pub`; \
109 done
110         - if test `pwd` != $(mansrc); then \
111 for page in $(manpages); do \
112 cp $$page $(mansrc)/`basename $$page .man`.$(manext); \
113 done; \
114 fi
115
116 clean:
117         rm -f a2p *.o a2p.c
118
119 realclean: clean
120         rm -f *.orig */*.orig core $(addedbyconf) a2p.c s2p find2perl all cflags
121
122 # The following lint has practically everything turned on.  Unfortunately,
123 # you have to wade through a lot of mumbo jumbo that can't be suppressed.
124 # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
125 # for that spot.
126
127 lint:
128         lint $(lintflags) $(defs) $(c) > a2p.fuzz
129
130 depend: $(mallocsrc) ../makedepend
131         ../makedepend
132
133 clist:
134         echo $(c) | tr ' ' '\012' >.clist
135
136 hlist:
137         echo $(h) | tr ' ' '\012' >.hlist
138
139 shlist:
140         echo $(sh) | tr ' ' '\012' >.shlist
141
142 config.sh: ../config.sh
143         rm -f config.sh
144         ln ../config.sh .
145
146 malloc.c: ../malloc.c
147         sed <../malloc.c >malloc.c \
148             -e 's/"perl.h"/"..\/perl.h"/' \
149             -e 's/my_exit/exit/'
150
151 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
152 $(obj):
153         @ echo "You haven't done a "'"make depend" yet!'; exit 1
154 makedepend: makedepend.SH
155         /bin/sh $(shellflags) makedepend.SH
156 !NO!SUBS!
157 $eunicefix Makefile
158 case `pwd` in
159 *SH)
160     $rm -f ../Makefile
161     ln Makefile ../Makefile
162     ;;
163 esac
164 rm -f makefile