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