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