perl 4.0 patch 14: patch #11, continued
[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 cat >Makefile <<!GROK!THIS!
18 # $RCSfile: Makefile.SH,v $$Revision: 4.0.1.2 $$Date: 91/11/05 19:19:04 $
19 #
20 # $Log: Makefile.SH,v $
21 # Revision 4.0.1.2  91/11/05  19:19:04  lwall
22 # patch11: random cleanup
23
24 # Revision 4.0.1.1  91/06/07  12:12:14  lwall
25 # patch4: cflags now emits entire cc command except for the filename
26
27 # Revision 4.0  91/03/20  01:57:03  lwall
28 # 4.0 baseline.
29
30
31
32 CC = $cc
33 YACC = $yacc
34 bin = $bin
35 lib = $lib
36 mansrc = $mansrc
37 manext = $manext
38 LDFLAGS = $ldflags
39 SMALL = $small
40 LARGE = $large $split
41 mallocsrc = $mallocsrc
42 mallocobj = $mallocobj
43
44 libs = $libs
45 !GROK!THIS!
46
47 cat >>Makefile <<'!NO!SUBS!'
48
49 CCCMD = `sh cflags $@`
50
51 public = a2p s2p find2perl
52
53 private = 
54
55 manpages = a2p.man s2p.man
56
57 util =
58
59 sh = Makefile.SH makedepend.SH
60
61 h = EXTERN.h INTERN.h config.h handy.h hash.h a2p.h str.h util.h
62
63 c = hash.c $(mallocsrc) str.c util.c walk.c
64
65 obj = hash.o $(mallocobj) str.o util.o walk.o
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         $(CCCMD) $*.c
76
77 all: $(public) $(private) $(util)
78         touch all
79
80 a2p: $(obj) a2p.o
81         $(CC) $(LDFLAGS) $(obj) a2p.o $(libs) -o a2p
82
83 a2p.c: a2p.y
84         @ echo Expect 226 shift/reduce conflicts...
85         $(YACC) a2p.y
86         mv y.tab.c a2p.c
87
88 a2p.o: a2p.c a2py.c a2p.h EXTERN.h util.h INTERN.h handy.h ../config.h str.h hash.h
89         $(CCCMD) $(LARGE) a2p.c
90
91 install: a2p s2p
92 # won't work with csh
93         export PATH || exit 1
94         - mv $(bin)/a2p $(bin)/a2p.old 2>/dev/null
95         - mv $(bin)/s2p $(bin)/s2p.old 2>/dev/null
96         - if test `pwd` != $(bin); then cp $(public) $(bin); fi
97         cd $(bin); \
98 for pub in $(public); do \
99 chmod +x `basename $$pub`; \
100 done
101         - if test `pwd` != $(mansrc); then \
102 for page in $(manpages); do \
103 cp $$page $(mansrc)/`basename $$page .man`.$(manext); \
104 done; \
105 fi
106
107 clean:
108         rm -f a2p *.o
109
110 realclean: clean
111         rm -f *.orig */*.orig core $(addedbyconf) a2p.c s2p find2perl all cflags
112
113 # The following lint has practically everything turned on.  Unfortunately,
114 # you have to wade through a lot of mumbo jumbo that can't be suppressed.
115 # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
116 # for that spot.
117
118 lint:
119         lint $(lintflags) $(defs) $(c) > a2p.fuzz
120
121 depend: $(mallocsrc) ../makedepend
122         ../makedepend
123
124 clist:
125         echo $(c) | tr ' ' '\012' >.clist
126
127 hlist:
128         echo $(h) | tr ' ' '\012' >.hlist
129
130 shlist:
131         echo $(sh) | tr ' ' '\012' >.shlist
132
133 config.sh: ../config.sh
134         rm -f config.sh
135         ln ../config.sh .
136
137 malloc.c: ../malloc.c
138         sed 's/"perl.h"/"..\/perl.h"/' ../malloc.c >malloc.c
139
140 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
141 $(obj):
142         @ echo "You haven't done a "'"make depend" yet!'; exit 1
143 makedepend: makedepend.SH
144         /bin/sh makedepend.SH
145 !NO!SUBS!
146 $eunicefix Makefile
147 case `pwd` in
148 *SH)
149     $rm -f ../Makefile
150     ln Makefile ../Makefile
151     ;;
152 esac
153 rm -f makefile