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