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