summaryrefslogtreecommitdiff
path: root/support/splint/examples/ld/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'support/splint/examples/ld/Makefile')
-rw-r--r--support/splint/examples/ld/Makefile72
1 files changed, 49 insertions, 23 deletions
diff --git a/support/splint/examples/ld/Makefile b/support/splint/examples/ld/Makefile
index a23f191b9c..24bf4a7a9f 100644
--- a/support/splint/examples/ld/Makefile
+++ b/support/splint/examples/ld/Makefile
@@ -1,30 +1,44 @@
+# Copyright 2012-2020, Alexander Shibakov
+# This file is part of SPLinT
+#
+# SPLinT is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SPLinT is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SPLinT. If not, see <http://www.gnu.org/licenses/>.
+
# this Makefile uses a flat directory structure for demonstration
# purposes; the main directory (../..) contains a slightly more
# modular organization.
-SPLINT_ROOT = $(shell pwd)/../..
-
PARSER = ldp
LEXER = ldl
MANUAL = ldman
-LD_CORE_PREREQS = ${SPLINT_XTEXSTYLES} ${SPLINT_XPTABLES} ${SPLINT_XLTABLES} ${SPLINT_ROOT}/cweb/bo.tok
-LD_DOC_PREREQS = %.tex %.sty ${PARSER}.tok ldunion.sty ldint.sty ldfrontmatter.sty ${LD_CORE_PREREQS} ptab.tex ltab.tex ld_small_tab.tex
-LD_DOC_PREREQS += ld_small_dfa.tex ltokenset.sty lstokenset.sty
+LD_CORE_PREREQS = ${SPLINT_XTEXSTYLES} ${SPLINT_XPTABLES} ${SPLINT_XLTABLES} ${SPLINT_ROOT}cweb/bo.tok ${SPLINT_ROOT}cweb/fo.tok
+LD_DOC_PREREQS = %.tex %.sty ${PARSER}.tok ldunion.sty ldtexlex.sty ldint.sty ldfrontmatter.sty ${LD_CORE_PREREQS}
+LD_DOC_PREREQS += ptab.tex ltab.tex ld_small_tab.tex ld_small_dfa.tex ltokenset.sty lstokenset.sty
LD_DOC_PREREQS_XREF = ${LD_DOC_PREREQS} %.scn %.idx
-include ${SPLINT_ROOT}/makefile.inc
-include ${SPLINT_ROOT}/makefile.loc
+include ../../makefile.inc
+include ${SPLINT_ROOT}makefile.loc
# rules specific to this example
-ptabout: ${SPLINT_ROOT}/cweb/mkeparser.c ${PARSER}.c
- ${CC} -DPARSER_FILE=\"../examples/ld/$(lastword $^)\" -DYYPARSE_PARAMETERS= -o $@ $<
+ptabout: ${SPLINT_ROOT}cweb/mkeparser.c ${PARSER}.c
+ ${CC} ${BISON_STATE} -DPARSER_FILE=\"../examples/ld/$(lastword $^)\" -DYYPARSE_PARAMETERS= -o $@ $<
ptab.tex: ptabout
$< --optimize-actions --optimize-tables $@
-ltabout: ${SPLINT_ROOT}/cweb/mkscanner.c ldl_states.h ${LEXER}.c
+ltabout: ${SPLINT_ROOT}cweb/mkscanner.c ldl_states.h ${LEXER}.c
${CC} -DLEXER_FILE=\"../examples/ld/$(lastword $^)\" -o $@ $<
ltab.tex: ltabout
@@ -44,10 +58,10 @@ ${MANUAL}.stx: ${MANUAL}.x ldgram.x ldlex.x ldlexo.x ldgramo.x ldnp.x
# term name parser for ld grammar
-ldsmallp_out: ${SPLINT_ROOT}/cweb/mkeparser.c ld_small_parser.c
+ldsmallp_out: ${SPLINT_ROOT}cweb/mkeparser.c ld_small_parser.c
${CC} ${BISON_STATE} -DPARSER_FILE=\"../examples/ld/$(lastword $^)\" -DYYPARSE_PARAMETERS= -o $@ $<
-ldsmalll_out: ${SPLINT_ROOT}/cweb/mkscanner.c ld_small_lexer.c
+ldsmalll_out: ${SPLINT_ROOT}cweb/mkscanner.c ld_small_lexer.c
${CC} -DLEXER_FILE=\"../examples/ld/$(lastword $^)\" -o $@ $<
ld_small_tab.tex: ldsmallp_out
@@ -62,10 +76,10 @@ ld_small_lexer.ll: ldnp.x
# numeric parser for ld grammar
-ldnump_out: ${SPLINT_ROOT}/cweb/mkeparser.c ld_num_parser.c
+ldnump_out: ${SPLINT_ROOT}cweb/mkeparser.c ld_num_parser.c
${CC} ${BISON_STATE} -DPARSER_FILE=\"../examples/ld/$(lastword $^)\" -DYYPARSE_PARAMETERS= -o $@ $<
-ldnuml_out: ${SPLINT_ROOT}/cweb/mkscanner.c ld_num_lexer.c
+ldnuml_out: ${SPLINT_ROOT}cweb/mkscanner.c ld_num_lexer.c
${CC} -DLEXER_FILE=\"../examples/ld/$(lastword $^)\" -o $@ $<
ld_num_tab.tex: ldnump_out
@@ -78,8 +92,17 @@ ld_num_parser.yy \
ld_num_lexer.ll: ldnump.x
@${CTANGLE} $<
-${MANUAL}.tex: ${MANUAL}.x ldgram.x ldlex.x ldlexo.x ldgramo.x ldnp.x
- ${CWEAVE} $<
+ldexample_%.hx: ldexample.hw
+ echo $(patsubst ldexample_%.hx, "@G(%)", $@) >> $(patsubst %.hx, %.hy, $@)
+ cat $< >> $(patsubst %.hx, %.hy, $@)
+ echo "@g" >> $(patsubst %.hx, %.hy, $@)
+ ${BRACK} $(patsubst %.hx, %.hy, $@) $@
+
+alphas.hx:
+ ${MISCCW} --alpha-list --alpha-length=1 $@
+
+${MANUAL}.tex: ${MANUAL}.x ldgram.x ldlex.x ldlexo.x ldgramo.x ldnp.x ldexample_l.hx ldexample_b.hx alphas.hx
+ -${CWEAVE} $<
${MANUAL}.sty: ${MANUAL}.stx
${UNLINE} $< $@
@@ -88,12 +111,16 @@ ${MANUAL}.gdx: %.gdx: ${LD_DOC_PREREQS_XREF} ${PARSER}.tok
@echo "Making the bison and TeX indices ..."
${TEX} $*.tex
-${MANUAL}.pdf: %.pdf: ${LD_DOC_PREREQS_XREF} %.gdy
- ${PDFTEX} $< && touch $*.gdy && touch $*.pdf
+%.gdy: %.gdx
+
+${MANUAL}.gdy: %.gdy: %.gdx
+ ${BINDX} --fine $^ $@
-#${PARSER}.tok \
-#ldl_states.h: ${MANUAL}.tex ${MANUAL}.sty ${LD_CORE_PREREQS}
-# ${TEX} ${MODEBOOTSTRAP} \\input $<
+${MANUAL}.xxr: %.xxr: %.tex
+ ${PDFTEX} $*.tex
+
+${MANUAL}.pdf: %.pdf: ${LD_DOC_PREREQS_XREF} %.gdy %.xxr
+ ${PDFTEX} $< && touch $*.gdy && touch $*.pdf
${PARSER}.tok: ldgram.tex ${MANUAL}.sty ${LD_CORE_PREREQS}
${TEX} ${MODEBOOTSTRAP} \\input $<
@@ -103,7 +130,7 @@ ldl_states.h: ldlex.tex ${MANUAL}.sty ${LD_CORE_PREREQS}
ldgram.tex ldlex.tex: \
%.tex: %.x
- ${CWEAVE} -x $<
+ -${CWEAVE} -x $<
docs: ${MANUAL}.pdf
@@ -115,4 +142,3 @@ clean: clean_core
distclean: clean
cd ${SPLINT_ROOT} && ${MAKE} clean
-