This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
typo fix for IPC::Open3
[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 pl = find2perl.PL s2p.PL
83 plextract = find2perl s2p
84
85 h = EXTERN.h INTERN.h ../config.h ../handy.h hash.h a2p.h str.h util.h
86
87 c = hash.c str.c util.c walk.c
88
89 obj = hash$(OBJ_EXT) str$(OBJ_EXT) util$(OBJ_EXT) walk$(OBJ_EXT)
90
91 lintflags = -phbvxac
92
93
94 .c$(OBJ_EXT):
95         $(CCCMD) -DPERL_FOR_X2P $*.c
96
97 all: a2p$(EXE_EXT) s2p find2perl
98         @echo " "
99
100 a2p$(EXE_EXT): $(obj) a2p$(OBJ_EXT)
101         $(CC) -o a2p $(LDFLAGS) $(obj) a2p$(OBJ_EXT) $(libs)
102
103 # I now supply a2p.c with the kits, so the following section is
104 # used only if you force byacc to run by saying
105 #    make run_byacc
106 # byacc 1.8.2 or 1.9 are recommended.
107
108 run_byacc:      FORCE
109         @ echo Expect many shift/reduce and reduce/reduce conflicts
110         $(BYACC) a2p.y
111         rm -f a2p.c
112         sed -e 's/(yyn = yydefred\[yystate\])/((yyn = yydefred[yystate]))/' \
113             -e 's/(yys = getenv("YYDEBUG"))/((yys = getenv("YYDEBUG")))/' \
114             -e 's/^yyerrlab://' \
115             -e 's/^    goto yyerrlab;//' \
116             -e 's/^yynewerror://' \
117             -e 's/^    goto yynewerror;//' \
118             -e 's|^static char yysccsid\(.*\)|/* static char yysccsid\1 */|' \
119             -e 's/^\(char \*yyname\[\]\)/const \1/' \
120             -e 's/^\(char \*yyrule\[\]\)/const \1/' \
121             -e 's/^\(    register\) \(char \*yys;\)/\1 const \2/' \
122             < y.tab.c > a2p.c
123
124 FORCE:
125
126 # We don't want to regenerate a2p.c, but it might appear out-of-date
127 # after a patch is applied or a new distribution is made.
128 a2p.c: a2p.y
129         -@sh -c true
130
131 a2p$(OBJ_EXT): a2p.c a2py.c a2p.h EXTERN.h util.h INTERN.h \
132                 ../handy.h ../config.h str.h hash.h
133         $(CCCMD) a2p.c
134
135 clean:
136         rm -f a2p$(EXE_EXT) psed *$(OBJ_EXT) $(plexe) $(plc)
137
138 distclean: veryclean
139
140 realclean: clean
141         -rmdir .depending
142         rm -f core $(plextract) all
143         rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old makefile.old
144
145 veryclean: realclean
146         rm -f *~ *.orig
147
148 # The following lint has practically everything turned on.  Unfortunately,
149 # you have to wade through a lot of mumbo jumbo that can't be suppressed.
150 # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
151 # for that spot.
152
153 lint:
154         lint $(lintflags) $(defs) $(c) > a2p.fuzz
155
156 depend: ../makedepend
157         sh ../makedepend MAKE=$(MAKE) ../cflags
158
159 clist:
160         echo $(c) | tr ' ' $(TRNL) >.clist
161
162 hlist:
163         echo $(h) | tr ' ' $(TRNL) >.hlist
164
165 $(plextract):
166         $(RUN) $(PERL) -I../lib $@.PL
167
168 find2perl: find2perl.PL ../config.sh
169
170 s2p: s2p.PL ../config.sh
171
172 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
173 $(obj):
174         @ echo "You haven't done a "'"make depend" yet!'; exit 1
175 makedepend: depend
176 !NO!SUBS!
177 $eunicefix Makefile
178 rm -f $firstmakefile