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