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