4ab3ec9c126e7a0a068a84608e85461bb6028b94
[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
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 3.0.1.8 91/01/11 18:34:40 lwall Locked $
23 #
24 # $Log: Makefile.SH,v $
25 # Revision 3.0.1.8  91/01/11  18:34:40  lwall
26 # patch42: x2p/Makefile.SH blew up on /afs misfeature
27
28 # Revision 3.0.1.7  90/11/10  02:20:15  lwall
29 # patch38: random cleanup
30
31 # Revision 3.0.1.6  90/10/16  11:28:18  lwall
32 # patch29: various portability fixes
33
34 # Revision 3.0.1.5  90/08/13  22:41:05  lwall
35 # patch28: shift/reduce count was off for a2p's Makefile
36
37 # Revision 3.0.1.4  90/03/01  10:28:09  lwall
38 # patch9: a2p didn't allow logical expressions everywhere it should
39
40 # Revision 3.0.1.3  89/12/21  20:29:00  lwall
41 # patch7: Configure now lets you pick between yacc or bison
42
43 # Revision 3.0.1.2  89/11/17  15:49:55  lwall
44 # patch: in x2p/Makefile.SH, removed reference to nm library
45
46 # Revision 3.0.1.1  89/10/26  23:29:11  lwall
47 # patch1: in x2p/Makefile.SH, added dependency on ../config.sh
48
49 # Revision 3.0  89/10/18  15:33:52  lwall
50 # 3.0 baseline
51
52 # Revision 2.0.1.2  88/09/07  17:13:30  lwall
53 # patch14: added redirection of stderr to /dev/null
54
55 # Revision 2.0.1.1  88/07/11  23:13:39  root
56 # patch2: now expects more shift/reduce errors
57
58 # Revision 2.0  88/06/05  00:15:31  root
59 # Baseline version 2.0.
60
61
62
63 CC = $cc
64 YACC = $yacc
65 bin = $bin
66 lib = $lib
67 mansrc = $mansrc
68 manext = $manext
69 CFLAGS = $ccflags $optimize
70 LDFLAGS = $ldflags
71 SMALL = $small
72 LARGE = $large $split
73 mallocsrc = $mallocsrc
74 mallocobj = $mallocobj
75
76 libs = $libs
77 !GROK!THIS!
78
79 cat >>Makefile <<'!NO!SUBS!'
80
81 public = a2p s2p
82
83 private = 
84
85 manpages = a2p.man s2p.man
86
87 util =
88
89 sh = Makefile.SH makedepend.SH
90
91 h = EXTERN.h INTERN.h config.h handy.h hash.h a2p.h str.h util.h
92
93 c = hash.c $(mallocsrc) str.c util.c walk.c
94
95 obj = hash.o $(mallocobj) str.o util.o walk.o
96
97 lintflags = -phbvxac
98
99 addedbyconf = Makefile.old bsd eunice filexp loc pdp11 usg v7
100
101 # grrr
102 SHELL = /bin/sh
103
104 .c.o:
105         $(CC) -c $(CFLAGS) $(LARGE) $*.c
106
107 all: $(public) $(private) $(util)
108         touch all
109
110 a2p: $(obj) a2p.o
111         $(CC) $(LARGE) $(LDFLAGS) $(obj) a2p.o $(libs) -o a2p
112
113 a2p.c: a2p.y
114         @ echo Expect 226 shift/reduce conflicts...
115         $(YACC) a2p.y
116         mv y.tab.c a2p.c
117
118 a2p.o: a2p.c a2py.c a2p.h EXTERN.h util.h INTERN.h handy.h ../config.h str.h hash.h
119         $(CC) -c $(CFLAGS) $(LARGE) a2p.c
120
121 install: a2p s2p
122 # won't work with csh
123         export PATH || exit 1
124         - mv $(bin)/a2p $(bin)/a2p.old 2>/dev/null
125         - mv $(bin)/s2p $(bin)/s2p.old 2>/dev/null
126         - if test `pwd` != $(bin); then cp $(public) $(bin); fi
127         cd $(bin); \
128 for pub in $(public); do \
129 chmod +x `basename $$pub`; \
130 done
131 #       chmod +x makedir
132 #       - ./makedir `filexp $(lib)`
133 #       - \
134 #if test `pwd` != `filexp $(lib)`; then \
135 #cp $(private) `filexp $(lib)`; \
136 #fi
137 #       cd `filexp $(lib)`; \
138 #for priv in $(private); do \
139 #chmod +x `basename $$priv`; \
140 #done
141         - if test `pwd` != $(mansrc); then \
142 for page in $(manpages); do \
143 cp $$page $(mansrc)/`basename $$page .man`.$(manext); \
144 done; \
145 fi
146
147 clean:
148         rm -f a2p *.o
149
150 realclean: clean
151         rm -f *.orig */*.orig core $(addedbyconf) a2p.c s2p all
152
153 # The following lint has practically everything turned on.  Unfortunately,
154 # you have to wade through a lot of mumbo jumbo that can't be suppressed.
155 # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
156 # for that spot.
157
158 lint:
159         lint $(lintflags) $(defs) $(c) > a2p.fuzz
160
161 depend: ../makedepend
162         ../makedepend
163
164 clist:
165         echo $(c) | tr ' ' '\012' >.clist
166
167 hlist:
168         echo $(h) | tr ' ' '\012' >.hlist
169
170 shlist:
171         echo $(sh) | tr ' ' '\012' >.shlist
172
173 config.sh: ../config.sh
174         rm -f config.sh
175         ln ../config.sh .
176
177 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
178 $(obj):
179         @ echo "You haven't done a "'"make depend" yet!'; exit 1
180 makedepend: makedepend.SH
181         /bin/sh makedepend.SH
182 !NO!SUBS!
183 $eunicefix Makefile
184 case `pwd` in
185 *SH)
186     $rm -f ../Makefile
187     ln Makefile ../Makefile
188     ;;
189 esac