This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Lose the loose. Fix documentation typo.
[perl5.git] / x2p / Makefile.SH
1 #!/bin/sh
2
3 case $PERL_CONFIG_SH in
4 '')
5         if test -f config.sh; then TOP=.;
6         elif test -f ../config.sh; then TOP=..;
7         elif test -f ../../config.sh; then TOP=../..;
8         elif test -f ../../../config.sh; then TOP=../../..;
9         elif test -f ../../../../config.sh; then TOP=../../../..;
10         else
11                 echo "Can't find config.sh."; exit 1
12         fi
13         . $TOP/config.sh
14         ;;
15 esac
16 : This forces SH files to create target in same directory as SH file.
17 : This is so that make depend always knows where to find SH derivatives.
18 case "$0" in
19 */Makefile.SH) cd `expr X$0 : 'X\(.*\)/'` ;;
20 Makefile.SH) ;;
21 *) case `pwd` in
22    */x2p) ;;
23    *) if test -d x2p; then cd x2p
24       else echo "Can't figure out where to write output."; exit 1
25           fi;;
26    esac;;
27 esac
28
29 echo "Extracting x2p/Makefile (with variable substitutions)"
30 rm -f Makefile
31
32 # The .PL extractions use the Cwd extension.  For statically-built
33 # perls, we need perl, not just miniperl.
34 case "$usedl" in
35     define) perl="../miniperl" ;;
36     *)      perl="../perl" ;;
37 esac
38
39 cat >Makefile <<!GROK!THIS!
40 # $RCSfile: Makefile.SH,v $$Revision: 4.1 $$Date: 92/08/07 18:29:07 $
41 #
42 # $Log: Makefile.SH,v $
43
44 CC = $cc
45 BYACC = $byacc
46 LDFLAGS = $ldflags
47 shellflags = $shellflags
48
49 libs = $perllibs
50
51 $make_set_make
52 # grrr
53 SHELL = $sh
54
55 # These variables may need to be manually set for non-Unix systems.
56 AR = $ar
57 EXE_EXT = $_exe
58 LIB_EXT = $_a
59 OBJ_EXT = $_o
60 PATH_SEP = $p_
61
62 FIRSTMAKEFILE = $firstmakefile
63
64 # how to tr(anslate) newlines
65
66 TRNL = '$trnl'
67
68 OPTIMIZE = $optimize
69
70 .SUFFIXES: .c \$(OBJ_EXT)
71
72 RUN = $run
73 PERL = $perl
74
75 !GROK!THIS!
76
77 cat >>Makefile <<'!NO!SUBS!'
78
79 REALPERL = ../perl
80 CCCMD = `sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $@`
81
82 public = a2p$(EXE_EXT) s2p find2perl
83
84 private = 
85
86 manpages = a2p.man s2p.man
87
88 util =
89
90 sh = Makefile.SH cflags.SH
91 shextract = Makefile cflags
92
93 pl = find2perl.PL s2p.PL
94 plextract = find2perl s2p
95 plexe = find2perl.exe s2p.exe
96 plc   = find2perl.c s2p.c
97 plm   = a2p.loadmap
98
99 addedbyconf = $(shextract) $(plextract)
100
101 h = EXTERN.h INTERN.h ../config.h ../handy.h hash.h a2p.h str.h util.h
102
103 c = hash.c str.c util.c walk.c
104
105 obj = hash$(OBJ_EXT) str$(OBJ_EXT) util$(OBJ_EXT) walk$(OBJ_EXT)
106
107 lintflags = -phbvxac
108
109
110 .c$(OBJ_EXT):
111         $(CCCMD) -DPERL_FOR_X2P $*.c
112
113 all: $(public) $(private) $(util)
114         @echo " "
115
116 a2p$(EXE_EXT): $(obj) a2p$(OBJ_EXT)
117         $(CC) -o a2p $(LDFLAGS) $(obj) a2p$(OBJ_EXT) $(libs)
118
119 # I now supply a2p.c with the kits, so the following section is
120 # used only if you force byacc to run by saying
121 #    make run_byacc
122 # byacc 1.8.2 or 1.9 are recommended.
123
124 run_byacc:      FORCE
125         @ echo Expect many shift/reduce and reduce/reduce conflicts
126         $(BYACC) a2p.y
127         rm -f a2p.c
128         sed -e 's/(yyn = yydefred\[yystate\])/((yyn = yydefred[yystate]))/' \
129             -e 's/(yys = getenv("YYDEBUG"))/((yys = getenv("YYDEBUG")))/' \
130             -e 's/^yyerrlab://' \
131             -e 's/^    goto yyerrlab;//' \
132             -e 's/^yynewerror://' \
133             -e 's/^    goto yynewerror;//' \
134             -e 's|^static char yysccsid\(.*\)|/* static char yysccsid\1 */|' \
135             -e 's/^\(char \*yyname\[\]\)/const \1/' \
136             -e 's/^\(char \*yyrule\[\]\)/const \1/' \
137             -e 's/^\(    register\) \(char \*yys;\)/\1 const \2/' \
138             < y.tab.c > a2p.c
139
140 FORCE:
141
142 # We don't want to regenerate a2p.c, but it might appear out-of-date
143 # after a patch is applied or a new distribution is made.
144 a2p.c: a2p.y
145         -@sh -c true
146
147 a2p$(OBJ_EXT): a2p.c a2py.c a2p.h EXTERN.h util.h INTERN.h \
148                 ../handy.h ../config.h str.h hash.h
149         $(CCCMD) a2p.c
150
151 clean:
152         rm -f a2p$(EXE_EXT) psed *$(OBJ_EXT) $(plexe) $(plc) $(plm)
153
154 distclean: veryclean
155
156 realclean: clean
157         -rmdir .depending
158         rm -f core $(addedbyconf) all
159         rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old makefile.old
160
161 veryclean: realclean
162         rm -f *~ *.orig
163
164 # The following lint has practically everything turned on.  Unfortunately,
165 # you have to wade through a lot of mumbo jumbo that can't be suppressed.
166 # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
167 # for that spot.
168
169 lint:
170         lint $(lintflags) $(defs) $(c) > a2p.fuzz
171
172 depend: ../makedepend
173         sh ../makedepend MAKE=$(MAKE)
174
175 clist:
176         echo $(c) | tr ' ' $(TRNL) >.clist
177
178 hlist:
179         echo $(h) | tr ' ' $(TRNL) >.hlist
180
181 shlist:
182         echo $(sh) | tr ' ' $(TRNL) >.shlist
183
184 $(plextract):
185         $(RUN) $(PERL) -I../lib $@.PL
186
187 find2perl: find2perl.PL ../config.sh
188
189 s2p: s2p.PL ../config.sh
190
191 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
192 $(obj):
193         @ echo "You haven't done a "'"make depend" yet!'; exit 1
194 makedepend: depend
195 !NO!SUBS!
196 $eunicefix Makefile
197 case `pwd` in
198 *SH)
199     $rm -f ../Makefile
200     $ln Makefile ../Makefile
201     ;;
202 esac
203 rm -f $firstmakefile