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