perl 1.0 patch 7: use of included malloc.c should be optional
[p5sagit/p5-mst-13.2.git] / x2p / Makefile.SH
1 case $CONFIG in
2 '')
3     if test ! -f config.sh; then
4         ln ../config.sh . || \
5         ln ../../config.sh . || \
6         ln ../../../config.sh . || \
7         (echo "Can't find config.sh."; exit 1)
8     fi
9     . config.sh
10     ;;
11 esac
12 case "$0" in
13 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
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 1.0.1.1 88/01/26 14:15:24 root Exp $
22 #
23 # $Log: Makefile.SH,v $
24 # Revision 1.0.1.1  88/01/26  14:15:24  root
25 # Added mallocsrc stuff.
26
27 # Revision 1.0  87/12/18  17:50:17  root
28 # Initial revision
29
30
31
32 CC = $cc
33 bin = $bin
34 lib = $lib
35 mansrc = $mansrc
36 manext = $manext
37 CFLAGS = $ccflags -O
38 LDFLAGS = $ldflags
39 SMALL = $small
40 LARGE = $large $split
41 mallocsrc = $mallocsrc
42 mallocobj = $mallocobj
43
44 libs = $libnm -lm
45 !GROK!THIS!
46
47 cat >>Makefile <<'!NO!SUBS!'
48
49 public = a2p s2p
50
51 private = 
52
53 manpages = a2p.man s2p.man
54
55 util =
56
57 sh = Makefile.SH makedepend.SH
58
59 h = EXTERN.h INTERN.h config.h handy.h hash.h a2p.h str.h util.h
60
61 c = hash.c $(mallocsrc) str.c util.c walk.c
62
63 obj = hash.o $(mallocobj) str.o util.o walk.o
64
65 lintflags = -phbvxac
66
67 addedbyconf = Makefile.old bsd eunice filexp loc pdp11 usg v7
68
69 # grrr
70 SHELL = /bin/sh
71
72 .c.o:
73         $(CC) -c $(CFLAGS) $(LARGE) $*.c
74
75 all: $(public) $(private) $(util)
76         touch all
77
78 a2p: $(obj) a2p.o
79         $(CC) $(LDFLAGS) $(LARGE) $(obj) a2p.o $(libs) -o a2p
80
81 a2p.c: a2p.y
82         @ echo Expect 107 shift/reduce errors...
83         yacc a2p.y
84         mv y.tab.c a2p.c
85
86 a2p.o: a2p.c a2py.c a2p.h EXTERN.h util.h INTERN.h handy.h
87         $(CC) -c $(CFLAGS) $(LARGE) a2p.c
88
89 # if a .h file depends on another .h file...
90 $(h):
91         touch $@
92 install: a2p s2p
93 # won't work with csh
94         export PATH || exit 1
95         - mv $(bin)/a2p $(bin)/a2p.old
96         - mv $(bin)/s2p $(bin)/s2p.old
97         - if test `pwd` != $(bin); then cp $(public) $(bin); fi
98         cd $(bin); \
99 for pub in $(public); do \
100 chmod 755 `basename $$pub`; \
101 done
102         - test $(bin) = /bin || rm -f /bin/a2p
103 #       chmod 755 makedir
104 #       - makedir `filexp $(lib)`
105 #       - \
106 #if test `pwd` != `filexp $(lib)`; then \
107 #cp $(private) `filexp $(lib)`; \
108 #fi
109 #       cd `filexp $(lib)`; \
110 #for priv in $(private); do \
111 #chmod 755 `basename $$priv`; \
112 #done
113         - if test `pwd` != $(mansrc); then \
114 for page in $(manpages); do \
115 cp $$page $(mansrc)/`basename $$page .man`.$(manext); \
116 done; \
117 fi
118
119 clean:
120         rm -f *.o
121
122 realclean:
123         rm -f a2p *.orig */*.orig *.o core $(addedbyconf)
124
125 # The following lint has practically everything turned on.  Unfortunately,
126 # you have to wade through a lot of mumbo jumbo that can't be suppressed.
127 # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
128 # for that spot.
129
130 lint:
131         lint $(lintflags) $(defs) $(c) > a2p.fuzz
132
133 depend: ../makedepend
134         ../makedepend
135
136 clist:
137         echo $(c) | tr ' ' '\012' >.clist
138
139 hlist:
140         echo $(h) | tr ' ' '\012' >.hlist
141
142 shlist:
143         echo $(sh) | tr ' ' '\012' >.shlist
144
145 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
146 $(obj):
147         @ echo "You haven't done a "'"make depend" yet!'; exit 1
148 makedepend: makedepend.SH
149         /bin/sh makedepend.SH
150 !NO!SUBS!
151 $eunicefix Makefile
152 case `pwd` in
153 *SH)
154     $rm -f ../Makefile
155     ln Makefile ../Makefile
156     ;;
157 esac