1case "$0" in
2*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
3esac
4case $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    ;;
15esac
16echo "Extracting x2p/Makefile (with variable substitutions)"
17rm -f Makefile
18cat >Makefile <<!GROK!THIS!
19# $RCSfile: Makefile.SH,v $$Revision: 4.0.1.3 $$Date: 92/06/08 16:11:32 $
20#
21# $Log:	Makefile.SH,v $
22# Revision 4.0.1.3  92/06/08  16:11:32  lwall
23# patch20: SH files didn't work well with symbolic links
24# patch20: cray didn't give enough memory to /bin/sh
25# patch20: makefiles now display new shift/reduce expectations
26#
27# Revision 4.0.1.2  91/11/05  19:19:04  lwall
28# patch11: random cleanup
29#
30# Revision 4.0.1.1  91/06/07  12:12:14  lwall
31# patch4: cflags now emits entire cc command except for the filename
32#
33# Revision 4.0  91/03/20  01:57:03  lwall
34# 4.0 baseline.
35#
36#
37
38CC = $cc
39YACC = $yacc
40bin = $bin
41lib = $lib
42mansrc = $mansrc
43manext = $manext
44LDFLAGS = $ldflags
45SMALL = $small
46LARGE = $large $split
47mallocsrc = $mallocsrc
48mallocobj = $mallocobj
49shellflags = $shellflags
50
51libs = $libs
52!GROK!THIS!
53
54cat >>Makefile <<'!NO!SUBS!'
55
56CCCMD = `sh $(shellflags) cflags $@`
57
58public = a2p s2p find2perl
59
60private =
61
62manpages = a2p.man s2p.man
63
64util =
65
66sh = Makefile.SH makedepend.SH
67
68h = EXTERN.h INTERN.h ../config.h handy.h hash.h a2p.h str.h util.h
69
70c = hash.c $(mallocsrc) str.c util.c walk.c
71
72obj = hash.o $(mallocobj) str.o util.o walk.o
73
74lintflags = -phbvxac
75
76addedbyconf = Makefile.old bsd eunice filexp loc pdp11 usg v7
77
78# grrr
79SHELL = /bin/sh
80
81.c.o:
82	$(CCCMD) $*.c
83
84all: $(public) $(private) $(util)
85	touch all
86
87a2p: $(obj) a2p.o
88	$(CC) $(LDFLAGS) $(obj) a2p.o $(libs) -o a2p
89
90a2p.c: a2p.y
91	@echo Expect 231 shift/reduce conflicts...
92	$(YACC) a2p.y
93	mv y.tab.c a2p.c
94
95a2p.o: a2p.c a2py.c a2p.h EXTERN.h util.h INTERN.h handy.h ../config.h str.h hash.h
96	$(CCCMD) $(LARGE) a2p.c
97
98install: a2p s2p
99# won't work with csh
100	export PATH || exit 1
101	- mv $(bin)/a2p $(bin)/a2p.old 2>/dev/null
102	- mv $(bin)/s2p $(bin)/s2p.old 2>/dev/null
103	- if test `pwd` != $(bin); then cp $(public) $(bin); fi
104	cd $(bin); \
105for pub in $(public); do \
106chmod +x `basename $$pub`; \
107done
108	- if test `pwd` != $(mansrc); then \
109for page in $(manpages); do \
110cp $$page $(mansrc)/`basename $$page .man`.$(manext); \
111done; \
112fi
113
114clean:
115	rm -f a2p *.o a2p.c
116
117realclean: clean
118	rm -f *.orig */*.orig core $(addedbyconf) a2p.c s2p find2perl all cflags
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
125lint:
126	lint $(lintflags) $(defs) $(c) > a2p.fuzz
127
128depend: $(mallocsrc) ../makedepend
129	../makedepend
130
131clist:
132	echo $(c) | tr ' ' '\012' >.clist
133
134hlist:
135	echo $(h) | tr ' ' '\012' >.hlist
136
137shlist:
138	echo $(sh) | tr ' ' '\012' >.shlist
139
140config.sh: ../config.sh
141	rm -f config.sh
142	ln ../config.sh .
143
144malloc.c: ../malloc.c
145	sed 's/"perl.h"/"..\/perl.h"/' ../malloc.c >malloc.c
146
147# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
148$(obj):
149	@echo "You haven't done a "'"make depend" yet!'; exit 1
150makedepend: makedepend.SH
151	/bin/sh $(shellflags) makedepend.SH
152!NO!SUBS!
153$eunicefix Makefile
154case `pwd` in
155*SH)
156    $rm -f ../Makefile
157    ln Makefile ../Makefile
158    ;;
159esac
160rm -f makefile
161