From 250d76180de0a35674e291d576af02f790eaef17 Mon Sep 17 00:00:00 2001 From: Rickard Green Date: Thu, 19 Oct 2017 15:02:16 +0200 Subject: [PATCH] Make it build --- .gitignore | 16 +++++++++ Makefile | 43 +++++++++++++++++++++++ {src => bin}/extract_grrules | 0 bin/fixpoint | 66 ++++++++++++++++++++++++++++++++++++ src/Makefile | 59 ++++++++++++++++++++++++-------- src/es.tex | 12 +++---- 6 files changed, 175 insertions(+), 21 deletions(-) create mode 100644 .gitignore create mode 100644 Makefile rename {src => bin}/extract_grrules (100%) create mode 100755 bin/fixpoint diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..20f39a5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +aux-files +TAGS +*-gram.tex +*.aux +*.bbl +*.dvi +*.idx +*.ind +*.log +*.toc +*.ilg +*.ps +*.pdf +*.blg +*.prev + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1613a48 --- /dev/null +++ b/Makefile @@ -0,0 +1,43 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2017. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# %CopyrightEnd% +# + +RM_F=/bin/rm -f +CP=/bin/cp + +.SECONDARY: + +.PHONY: src_ps src_pdf + +ps: src_ps erlang-spec.ps + +pdf: src_pdf erlang-spec.pdf + +src_ps: + (cd src && $(MAKE) es.ps) + +src_pdf: + (cd src && $(MAKE) es.pdf) + +erlang-spec.%: src/es.% + $(CP) $< $@ + +clean: + (cd src && $(MAKE) clean) + $(RM_F) erlang-spec.ps erlang-spec.pdf diff --git a/src/extract_grrules b/bin/extract_grrules similarity index 100% rename from src/extract_grrules rename to bin/extract_grrules diff --git a/bin/fixpoint b/bin/fixpoint new file mode 100755 index 0000000..7d989a8 --- /dev/null +++ b/bin/fixpoint @@ -0,0 +1,66 @@ +#!/bin/sh + +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2017. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# %CopyrightEnd% +# + +# +# Usage: +# fixpoint -- +# +# This script repeatedly runs until all +# stops changing between runs. This of course does not work well +# with any arbitrary command :-) +# + +files= + +while [ $# -gt 0 ]; do + if [ "$1" = "--" ]; then + shift + cmd=${1+"$@"} + break; + fi + files="$files $1" + shift +done + +if [ "$cmd" = "" ]; then + echo "$prog: Missing command" 1>&2 + exit 1 +fi + +changed=true + +echo $files + +while [ $changed = true ]; do + echo $cmd + eval $cmd 1>/dev/null 2>/dev/null + changed=false + for f in $files; do + [ -e "$f" ] || { echo "Missing $f" 1>&2; exit 1; } + if [ -e "$f.prev" ]; then + diff "$f" "$f.prev" 1>/dev/null 2>/dev/null || changed=true + else + changed=true + fi + cp "$f" "$f.prev" + done +done diff --git a/src/Makefile b/src/Makefile index 329f3dd..28039f9 100644 --- a/src/Makefile +++ b/src/Makefile @@ -19,15 +19,13 @@ # LATEX=latex -#LATEX=/opt/texmf/bin/latex DVIPS=dvips -r0 -#DVIPS=/opt/texmf/bin/dvips -r0 BIBTEX=bibtex -#BIBTEX=/opt/texmf/bin/bibtex MAKEINDEX=makeindex -TWOPAGE=${HOME}/Bin/2up -#EXTRACT=${HOME}/Bin/extract_grrules -EXTRACT=extract_grrules +TWOPAGE=2up +EXTRACT=../bin/extract_grrules +FIXPOINT=../bin/fixpoint +RM_F=/bin/rm -f SOURC1=es-lexical-structure.tex @@ -59,6 +57,13 @@ SOURC0=es-release-notes.tex \ SOURCE=es.tex $(SOURC0) $(SOURC1) $(SOURC2) $(SOURC3) +SOURCE_TEX=$(filter %.tex,$(SOURCE)) +GEN_GRAM_TEX=es-lex-gram.tex \ + es-main-gram.tex \ + es-preproc-gram.tex + +AUX_FILES=$(patsubst %.tex,%.aux,$(SOURCE_TEX)) es.idx + all: full TAGS full: es.ps @@ -67,6 +72,10 @@ full: es.ps TAGS: $(SOURCE) etags $(SOURCE) +aux-files: $(GEN_GRAM_TEX) + $(LATEX) es 1>/dev/null 2>/dev/null + touch aux-files + es.2up.ps: es.ps $(TWOPAGE) es.ps > es.2up.ps @@ -74,8 +83,11 @@ es.ps: es.dvi $(DVIPS) -o es.ps es chmod a+r es.ps -es.dvi: $(SOURCE) es-lex-gram.tex es-main-gram.tex es-preproc-gram.tex es.bbl es.ind - $(LATEX) es +es.dvi: $(SOURCE) aux-files $(GEN_GRAM_TEX) es.bbl es.ind + $(FIXPOINT) $(AUX_FILES) -- $(LATEX) es + +es.pdf: $(SOURCE) aux-files $(GEN_GRAM_TEX) es.bbl es.ind + $(FIXPOINT) $(AUX_FILES) -- pdflatex es old.2up.ps: old.ps $(TWOPAGE) old.ps > old.2up.ps @@ -84,7 +96,7 @@ old.ps: old.dvi $(DVIPS) -o old.ps old chmod a+r old.ps -old.dvi: $(SOURCE) es-lex-gram.tex es-main-gram.tex es-preproc-gram.tex old.bbl old.ind +old.dvi: $(SOURCE) $(GEN_GRAM_TEX) old.bbl old.ind $(LATEX) old std.2up.ps: std.ps @@ -94,7 +106,7 @@ std.ps: std.dvi $(DVIPS) -o std.ps std chmod a+r std.ps -std.dvi: $(SOURCE) es-lex-gram.tex es-main-gram.tex es-preproc-gram.tex std.bbl std.ind +std.dvi: $(SOURCE) $(GEN_GRAM_TEX) std.bbl std.ind $(LATEX) std es-lex-gram.tex: $(EXTRACT) $(SOURC1) @@ -106,13 +118,13 @@ es-main-gram.tex: $(EXTRACT) $(SOURC2) es-preproc-gram.tex: $(EXTRACT) $(SOURC3) $(EXTRACT) $(SOURC3) > es-preproc-gram.tex -es.bbl: es.bib $(SOURCE) +es.bbl: aux-files es.bib $(SOURCE) $(BIBTEX) es -es.ind: es.idx +es.ind: aux-files $(MAKEINDEX) es -es.idx: $(SOURCE) es-lex-gram.tex es-main-gram.tex es-preproc-gram.tex +es.idx: $(SOURCE) $(GEN_GRAM_TEX) old.bbl: es.bib $(SOURCE) $(BIBTEX) old @@ -120,7 +132,7 @@ old.bbl: es.bib $(SOURCE) old.ind: old.idx $(MAKEINDEX) old -old.idx: $(SOURCE) es-lex-gram.tex es-main-gram.tex es-preproc-gram.tex +old.idx: $(SOURCE) $(GEN_GRAM_TEX) std.bbl: es.bib $(SOURCE) $(BIBTEX) std @@ -128,7 +140,7 @@ std.bbl: es.bib $(SOURCE) std.ind: std.idx $(MAKEINDEX) std -std.idx: $(SOURCE) es-lex-gram.tex es-main-gram.tex es-preproc-gram.tex +std.idx: $(SOURCE) $(GEN_GRAM_TEX) es-separate-grammar.ps: es-separate-grammar.dvi $(DVIPS) -o es-separate-grammar.ps es-separate-grammar @@ -136,3 +148,20 @@ es-separate-grammar.ps: es-separate-grammar.dvi es-separate-grammar.dvi: es-separate-grammar.tex $(LATEX) es-separate-grammar.tex + +clean: + $(RM_F) aux-files + $(RM_F) TAGS + $(RM_F) *-gram.tex + $(RM_F) *.aux + $(RM_F) *.prev + $(RM_F) *.bbl + $(RM_F) *.dvi + $(RM_F) *.idx + $(RM_F) *.ind + $(RM_F) *.log + $(RM_F) *.toc + $(RM_F) *.ilg + $(RM_F) *.ps + $(RM_F) *.pdf + $(RM_F) *.blg diff --git a/src/es.tex b/src/es.tex index db42136..8dc1f5a 100644 --- a/src/es.tex +++ b/src/es.tex @@ -20,7 +20,7 @@ % Choose one of the following %\newcommand{\STYLE}{0} % For \OldErlang -%\newcommand{\STYLE}{1} % For \StdErlang +\newcommand{\STYLE}{1} % For \StdErlang %Choose draft until we're almost there. \newif\ifdraft @@ -60,10 +60,10 @@ % Not yet available! %\usepackage{pict2e} % Better pictures. \usepackage{grammar} % Grammar rules. -\ifdraft -\usepackage{draftstamp} % Print ``Draft'' shaded on pages. -\usepackage{drafthead} % Print ``Draft'' etc as page header. -\fi +%\ifdraft +%\usepackage{draftstamp} % Print ``Draft'' shaded on pages. +%\usepackage{drafthead} % Print ``Draft'' etc as page header. +%\fi %\usepackage{calc} \usepackage{ifthen} \usepackage{makeidx} @@ -72,7 +72,7 @@ \ifdraft \newcommand{\draftvsn}{0.7} \newcommand{\Draft}[1]{\textsc{Draft}~#1} -\renewcommand{\draftheadnote}{\Draft{\draftvsn}} +%\renewcommand{\draftheadnote}{\Draft{\draftvsn}} \fi \newif\ifOld \if1\STYLE\Oldfalse\else\Oldtrue\fi