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