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