Commit | Line | Data |
---|---|---|
1f00b0d6 S |
1 | #!/bin/sh |
2 | ||
d136e0b2 | 3 | case $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 | 15 | esac |
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. | |
18 | case "$0" in | |
ff3fa5b4 NA |
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;; | |
a0d0e21e LW |
27 | esac |
28 | ||
8d063cd8 | 29 | echo "Extracting x2p/Makefile (with variable substitutions)" |
bf10efe7 | 30 | rm -f Makefile |
939767c9 AD |
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 | ||
8d063cd8 | 39 | cat >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 | |
44 | CC = $cc | |
9c8d0b29 | 45 | BYACC = $byacc |
8d063cd8 | 46 | LDFLAGS = $ldflags |
bf10efe7 | 47 | shellflags = $shellflags |
8d063cd8 | 48 | |
ae7ff215 | 49 | libs = $perllibs |
cc72480d | 50 | |
1aef788c | 51 | $make_set_make |
52 | # grrr | |
53 | SHELL = $sh | |
54 | ||
dfe9444c | 55 | # These variables may need to be manually set for non-Unix systems. |
cc72480d | 56 | AR = $ar |
b0d7393a | 57 | EXE_EXT = $_exe |
dfe9444c AD |
58 | LIB_EXT = $_a |
59 | OBJ_EXT = $_o | |
60 | PATH_SEP = $p_ | |
cc72480d | 61 | |
62 | FIRSTMAKEFILE = $firstmakefile | |
63 | ||
28e8609d JH |
64 | # how to tr(anslate) newlines |
65 | ||
66 | TRNL = '$trnl' | |
67 | ||
40fee945 RB |
68 | OPTIMIZE = $optimize |
69 | ||
cc72480d | 70 | .SUFFIXES: .c \$(OBJ_EXT) |
71 | ||
6d4b7d88 | 72 | RUN = $run |
939767c9 | 73 | PERL = $perl |
6d4b7d88 | 74 | |
8d063cd8 LW |
75 | !GROK!THIS! |
76 | ||
77 | cat >>Makefile <<'!NO!SUBS!' | |
78 | ||
52cebf5e | 79 | REALPERL = ../perl |
40fee945 | 80 | CCCMD = `sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $@` |
d48672a2 | 81 | |
443a5b98 | 82 | public = a2p$(EXE_EXT) s2p find2perl |
8d063cd8 LW |
83 | |
84 | private = | |
85 | ||
86 | manpages = a2p.man s2p.man | |
87 | ||
88 | util = | |
89 | ||
4633a7c4 LW |
90 | sh = Makefile.SH cflags.SH |
91 | shextract = Makefile cflags | |
8d063cd8 | 92 | |
4633a7c4 LW |
93 | pl = find2perl.PL s2p.PL |
94 | plextract = find2perl s2p | |
52cebf5e EP |
95 | plexe = find2perl.exe s2p.exe |
96 | plc = find2perl.c s2p.c | |
1cfa4ec7 | 97 | plm = a2p.loadmap |
4633a7c4 LW |
98 | |
99 | addedbyconf = $(shextract) $(plextract) | |
16d20bd9 | 100 | |
3b5ca523 | 101 | h = EXTERN.h INTERN.h ../config.h ../handy.h hash.h a2p.h str.h util.h |
8d063cd8 | 102 | |
c2e403ce | 103 | c = hash.c str.c util.c walk.c |
8d063cd8 | 104 | |
c2e403ce | 105 | obj = hash$(OBJ_EXT) str$(OBJ_EXT) util$(OBJ_EXT) walk$(OBJ_EXT) |
8d063cd8 LW |
106 | |
107 | lintflags = -phbvxac | |
108 | ||
1aef788c | 109 | |
cc72480d | 110 | .c$(OBJ_EXT): |
1aef788c | 111 | $(CCCMD) -DPERL_FOR_X2P $*.c |
8d063cd8 LW |
112 | |
113 | all: $(public) $(private) $(util) | |
30b346b1 | 114 | @echo " " |
8d063cd8 | 115 | |
443a5b98 | 116 | a2p$(EXE_EXT): $(obj) a2p$(OBJ_EXT) |
87563a30 | 117 | $(CC) -o a2p $(LDFLAGS) $(obj) a2p$(OBJ_EXT) $(libs) |
8d063cd8 | 118 | |
9c8d0b29 | 119 | # I now supply a2p.c with the kits, so the following section is |
56febc5e | 120 | # used only if you force byacc to run by saying |
4cec2b33 BD |
121 | # make run_byacc |
122 | # byacc 1.8.2 or 1.9 are recommended. | |
56febc5e | 123 | |
4cec2b33 | 124 | run_byacc: FORCE |
56febc5e AD |
125 | @ echo Expect many shift/reduce and reduce/reduce conflicts |
126 | $(BYACC) a2p.y | |
28e8609d | 127 | rm -f a2p.c |
08e61bcc | 128 | sed -e 's/(yyn = yydefred\[yystate\])/((yyn = yydefred[yystate]))/' \ |
caf640e2 | 129 | -e 's/(yys = getenv("YYDEBUG"))/((yys = getenv("YYDEBUG")))/' \ |
08e61bcc JH |
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 */|' \ | |
aab39148 RB |
135 | -e 's/^\(char \*yyname\[\]\)/const \1/' \ |
136 | -e 's/^\(char \*yyrule\[\]\)/const \1/' \ | |
137 | -e 's/^\( register\) \(char \*yys;\)/\1 const \2/' \ | |
08e61bcc | 138 | < y.tab.c > a2p.c |
56febc5e | 139 | |
2efaeb47 AD |
140 | FORCE: |
141 | ||
56febc5e AD |
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 | |
30b346b1 | 145 | -@sh -c true |
8d063cd8 | 146 | |
55497cff | 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 | |
5869b1f1 | 149 | $(CCCMD) a2p.c |
8d063cd8 | 150 | |
8d063cd8 | 151 | clean: |
6189dba1 | 152 | rm -f a2p$(EXE_EXT) psed *$(OBJ_EXT) $(plexe) $(plc) $(plm) |
8d063cd8 | 153 | |
95aef5ce JV |
154 | distclean: veryclean |
155 | ||
b6ccd89c | 156 | realclean: clean |
882d9136 | 157 | -rmdir .depending |
c2e403ce | 158 | rm -f core $(addedbyconf) all |
0eb4e931 | 159 | rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old makefile.old |
8d063cd8 | 160 | |
2edbd6da JH |
161 | veryclean: realclean |
162 | rm -f *~ *.orig | |
163 | ||
8d063cd8 LW |
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 | ||
c2e403ce | 172 | depend: ../makedepend |
3b5ca523 | 173 | sh ../makedepend MAKE=$(MAKE) |
8d063cd8 LW |
174 | |
175 | clist: | |
28e8609d | 176 | echo $(c) | tr ' ' $(TRNL) >.clist |
8d063cd8 LW |
177 | |
178 | hlist: | |
28e8609d | 179 | echo $(h) | tr ' ' $(TRNL) >.hlist |
8d063cd8 LW |
180 | |
181 | shlist: | |
28e8609d | 182 | echo $(sh) | tr ' ' $(TRNL) >.shlist |
8d063cd8 | 183 | |
4633a7c4 | 184 | $(plextract): |
939767c9 | 185 | $(RUN) $(PERL) -I../lib $@.PL |
4633a7c4 | 186 | |
bdec6fb9 | 187 | find2perl: find2perl.PL ../config.sh |
1b641bfc | 188 | |
bdec6fb9 | 189 | s2p: s2p.PL ../config.sh |
1b641bfc | 190 | |
8d063cd8 LW |
191 | # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE |
192 | $(obj): | |
193 | @ echo "You haven't done a "'"make depend" yet!'; exit 1 | |
a0d0e21e | 194 | makedepend: depend |
8d063cd8 LW |
195 | !NO!SUBS! |
196 | $eunicefix Makefile | |
197 | case `pwd` in | |
198 | *SH) | |
199 | $rm -f ../Makefile | |
cc72480d | 200 | $ln Makefile ../Makefile |
8d063cd8 LW |
201 | ;; |
202 | esac | |
cc72480d | 203 | rm -f $firstmakefile |