This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove rules to delete *.loadmap and *.prelmap files, generated on VM/ESA
[perl5.git] / x2p / Makefile.SH
CommitLineData
1f00b0d6
S
1#!/bin/sh
2
d136e0b2 3case $PERL_CONFIG_SH in
8d063cd8 4'')
a0d0e21e
LW
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 ;;
8d063cd8 15esac
a0d0e21e
LW
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.
18case "$0" in
ff3fa5b4
NA
19*/Makefile.SH) cd `expr X$0 : 'X\(.*\)/'` ;;
20Makefile.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;;
a0d0e21e
LW
27esac
28
8d063cd8 29echo "Extracting x2p/Makefile (with variable substitutions)"
bf10efe7 30rm -f Makefile
939767c9
AD
31
32# The .PL extractions use the Cwd extension. For statically-built
33# perls, we need perl, not just miniperl.
34case "$usedl" in
35 define) perl="../miniperl" ;;
36 *) perl="../perl" ;;
37esac
38
8d063cd8 39cat >Makefile <<!GROK!THIS!
1aef788c 40# $RCSfile: Makefile.SH,v $$Revision: 4.1 $$Date: 92/08/07 18:29:07 $
8d063cd8
LW
41#
42# $Log: Makefile.SH,v $
8d063cd8
LW
43
44CC = $cc
9c8d0b29 45BYACC = $byacc
8d063cd8 46LDFLAGS = $ldflags
bf10efe7 47shellflags = $shellflags
8d063cd8 48
ae7ff215 49libs = $perllibs
cc72480d 50
1aef788c 51$make_set_make
52# grrr
53SHELL = $sh
54
dfe9444c 55# These variables may need to be manually set for non-Unix systems.
cc72480d 56AR = $ar
b0d7393a 57EXE_EXT = $_exe
dfe9444c
AD
58LIB_EXT = $_a
59OBJ_EXT = $_o
60PATH_SEP = $p_
cc72480d 61
62FIRSTMAKEFILE = $firstmakefile
63
28e8609d
JH
64# how to tr(anslate) newlines
65
66TRNL = '$trnl'
67
40fee945
RB
68OPTIMIZE = $optimize
69
cc72480d 70.SUFFIXES: .c \$(OBJ_EXT)
71
6d4b7d88 72RUN = $run
939767c9 73PERL = $perl
6d4b7d88 74
8d063cd8
LW
75!GROK!THIS!
76
77cat >>Makefile <<'!NO!SUBS!'
78
52cebf5e 79REALPERL = ../perl
c0d271fb 80CCCMD = `sh $(shellflags) ../cflags "optimize='$(OPTIMIZE)'" $@`
d48672a2 81
443a5b98 82public = a2p$(EXE_EXT) s2p find2perl
8d063cd8
LW
83
84private =
85
86manpages = a2p.man s2p.man
87
88util =
89
4633a7c4
LW
90pl = find2perl.PL s2p.PL
91plextract = find2perl s2p
52cebf5e
EP
92plexe = find2perl.exe s2p.exe
93plc = find2perl.c s2p.c
4633a7c4 94
6105164f 95addedbyconf = $(plextract)
16d20bd9 96
3b5ca523 97h = EXTERN.h INTERN.h ../config.h ../handy.h hash.h a2p.h str.h util.h
8d063cd8 98
c2e403ce 99c = hash.c str.c util.c walk.c
8d063cd8 100
c2e403ce 101obj = hash$(OBJ_EXT) str$(OBJ_EXT) util$(OBJ_EXT) walk$(OBJ_EXT)
8d063cd8
LW
102
103lintflags = -phbvxac
104
1aef788c 105
cc72480d 106.c$(OBJ_EXT):
1aef788c 107 $(CCCMD) -DPERL_FOR_X2P $*.c
8d063cd8
LW
108
109all: $(public) $(private) $(util)
30b346b1 110 @echo " "
8d063cd8 111
443a5b98 112a2p$(EXE_EXT): $(obj) a2p$(OBJ_EXT)
87563a30 113 $(CC) -o a2p $(LDFLAGS) $(obj) a2p$(OBJ_EXT) $(libs)
8d063cd8 114
9c8d0b29 115# I now supply a2p.c with the kits, so the following section is
56febc5e 116# used only if you force byacc to run by saying
4cec2b33
BD
117# make run_byacc
118# byacc 1.8.2 or 1.9 are recommended.
56febc5e 119
4cec2b33 120run_byacc: FORCE
56febc5e
AD
121 @ echo Expect many shift/reduce and reduce/reduce conflicts
122 $(BYACC) a2p.y
28e8609d 123 rm -f a2p.c
08e61bcc 124 sed -e 's/(yyn = yydefred\[yystate\])/((yyn = yydefred[yystate]))/' \
caf640e2 125 -e 's/(yys = getenv("YYDEBUG"))/((yys = getenv("YYDEBUG")))/' \
08e61bcc
JH
126 -e 's/^yyerrlab://' \
127 -e 's/^ goto yyerrlab;//' \
128 -e 's/^yynewerror://' \
129 -e 's/^ goto yynewerror;//' \
130 -e 's|^static char yysccsid\(.*\)|/* static char yysccsid\1 */|' \
aab39148
RB
131 -e 's/^\(char \*yyname\[\]\)/const \1/' \
132 -e 's/^\(char \*yyrule\[\]\)/const \1/' \
133 -e 's/^\( register\) \(char \*yys;\)/\1 const \2/' \
08e61bcc 134 < y.tab.c > a2p.c
56febc5e 135
2efaeb47
AD
136FORCE:
137
56febc5e
AD
138# We don't want to regenerate a2p.c, but it might appear out-of-date
139# after a patch is applied or a new distribution is made.
140a2p.c: a2p.y
30b346b1 141 -@sh -c true
8d063cd8 142
55497cff 143a2p$(OBJ_EXT): a2p.c a2py.c a2p.h EXTERN.h util.h INTERN.h \
144 ../handy.h ../config.h str.h hash.h
5869b1f1 145 $(CCCMD) a2p.c
8d063cd8 146
8d063cd8 147clean:
e1da83ea 148 rm -f a2p$(EXE_EXT) psed *$(OBJ_EXT) $(plexe) $(plc)
8d063cd8 149
95aef5ce
JV
150distclean: veryclean
151
b6ccd89c 152realclean: clean
882d9136 153 -rmdir .depending
c2e403ce 154 rm -f core $(addedbyconf) all
0eb4e931 155 rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old makefile.old
8d063cd8 156
2edbd6da
JH
157veryclean: realclean
158 rm -f *~ *.orig
159
8d063cd8
LW
160# The following lint has practically everything turned on. Unfortunately,
161# you have to wade through a lot of mumbo jumbo that can't be suppressed.
162# If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
163# for that spot.
164
165lint:
166 lint $(lintflags) $(defs) $(c) > a2p.fuzz
167
c2e403ce 168depend: ../makedepend
c0d271fb 169 sh ../makedepend MAKE=$(MAKE) ../cflags
8d063cd8
LW
170
171clist:
28e8609d 172 echo $(c) | tr ' ' $(TRNL) >.clist
8d063cd8
LW
173
174hlist:
28e8609d 175 echo $(h) | tr ' ' $(TRNL) >.hlist
8d063cd8 176
4633a7c4 177$(plextract):
939767c9 178 $(RUN) $(PERL) -I../lib $@.PL
4633a7c4 179
bdec6fb9 180find2perl: find2perl.PL ../config.sh
1b641bfc 181
bdec6fb9 182s2p: s2p.PL ../config.sh
1b641bfc 183
8d063cd8
LW
184# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
185$(obj):
186 @ echo "You haven't done a "'"make depend" yet!'; exit 1
a0d0e21e 187makedepend: depend
8d063cd8
LW
188!NO!SUBS!
189$eunicefix Makefile
cc72480d 190rm -f $firstmakefile