1
0
forked from GitHub/gf-rgl

doc/Makefile: incremental and parallel rebuild of the synopsis

Enough dependencies have been added so that

* If nothing has changed, MkSynopsis.hs will not be run, so synopisis.html
  will not be needlessly regenerated.
* You can use 'make -j' to build examples for different languages in parallel.

Hopefully 'make synopsis' produces the exact same result as before, but if
it turns out that some dependencies are missing and something is not
rebuilt despite of changes, 'make clean' can be used to force a full rebuild.
This commit is contained in:
Thomas Hallgren
2018-10-22 23:38:56 +02:00
parent d951fec14d
commit 881753ce3e
3 changed files with 40 additions and 47 deletions

View File

@@ -1,56 +1,49 @@
.PHONY: abstract synopsis .PHONY: abstract synopsis index status
all: exx synopsis all: synopsis
GF_alltenses=$(GF_LIB_PATH)/alltenses GF_alltenses=$(GF_LIB_PATH)/alltenses
GF=gf
GFDOC=gfdoc
index: index:
txt2tags -thtml index.txt txt2tags -thtml index.txt
status: status:
txt2tags -thtml status.txt txt2tags -thtml status.txt
synopsis:
runghc MkSynopsis.hs synopsis: synopsis.html
S=../src
# List of languages extracted from MkSynopsis.hs
LANGS=Afr Bul Cat Chi Dan Dut Eng Est Eus Fin Fre Ger Gre Hin Ice Ita Jpn Lav Mlt Mon Nep Nor Nno Pes Pnb Pol Ron Rus Snd Spa Swe Tha Urd
# This list was constructed by observing what files MkSynopsis.hs reads
SRC_FILES=$S/abstract/Common.gf $S/abstract/Cat.gf $S/api/Constructors.gf $S/abstract/Structural.gf $(patsubst %,$S/*/Paradigms%.gf,$(LANGS))
EXAMPLES_OUT=$(patsubst %,api-examples-%.txt,$(LANGS))
synopsis.html: $(EXAMPLES_OUT) $(SRC_FILES)
runghc MkSynopsis.hs >out
categories-imagemap.html: categories.dot categories-imagemap.html: categories.dot
dot -Tcmapx $^ > $@ dot -Tcmapx $^ > $@
abstract: abstract:
gfdoc -txthtml ../src/abstract/*.gf $(GFDOC) -txthtml $S/abstract/*.gf
mv ../src/abstract/*.html abstract mv $S/abstract/*.html abstract
exx-script:
runghc MkExx.hs <api-examples.txt >api-examples.gfs api-examples.gfs: api-examples.txt
exx: exx-script runghc MkExx.hs < $< > $@
gf -retain -s $(GF_alltenses)/TryAfr.gfo <api-examples.gfs >api-examples-Afr.txt
gf -retain -s $(GF_alltenses)/TryBul.gfo <api-examples.gfs >api-examples-Bul.txt
gf -retain -s $(GF_alltenses)/TryCat.gfo <api-examples.gfs >api-examples-Cat.txt # Since .gfo files aren't self-contained, the dependencies given here are
gf -retain -s $(GF_alltenses)/TryChi.gfo <api-examples.gfs >api-examples-Chi.txt # incomplete. But I am thinking that the Try%.gfo file will always be newer
gf -retain -s $(GF_alltenses)/TryDan.gfo <api-examples.gfs >api-examples-Dan.txt # than any other files it depends on, so the rule will trigger when
gf -retain -s $(GF_alltenses)/TryDut.gfo <api-examples.gfs >api-examples-Dut.txt # needed anyway. //TH 2018-10-22
gf -retain -s $(GF_alltenses)/TryEng.gfo <api-examples.gfs >api-examples-Eng.txt api-examples-%.txt: $(GF_alltenses)/Try%.gfo api-examples.gfs
gf -retain -s $(GF_alltenses)/TryEst.gfo <api-examples.gfs >api-examples-Est.txt GF_LIB_PATH=$(GF_LIB_PATH) $(GF) -retain -s $< <api-examples.gfs >$@
gf -retain -s $(GF_alltenses)/TryEus.gfo <api-examples.gfs >api-examples-Eus.txt
gf -retain -s $(GF_alltenses)/TryFin.gfo <api-examples.gfs >api-examples-Fin.txt clean:
gf -retain -s $(GF_alltenses)/TryFre.gfo <api-examples.gfs >api-examples-Fre.txt rm -rf out synopsis.txt api-examples.gfs $(EXAMPLES_OUT)
gf -retain -s $(GF_alltenses)/TryGer.gfo <api-examples.gfs >api-examples-Ger.txt
gf -retain -s $(GF_alltenses)/TryGre.gfo <api-examples.gfs >api-examples-Gre.txt
gf -retain -s $(GF_alltenses)/TryHin.gfo <api-examples.gfs >api-examples-Hin.txt
gf -retain -s $(GF_alltenses)/TryIce.gfo <api-examples.gfs >api-examples-Ice.txt
gf -retain -s $(GF_alltenses)/TryIta.gfo <api-examples.gfs >api-examples-Ita.txt
gf -retain -s $(GF_alltenses)/TryJpn.gfo <api-examples.gfs >api-examples-Jpn.txt
gf -retain -s $(GF_alltenses)/TryLav.gfo <api-examples.gfs >api-examples-Lav.txt
gf -retain -s $(GF_alltenses)/TryMlt.gfo <api-examples.gfs >api-examples-Mlt.txt
gf -retain -s $(GF_alltenses)/TryMon.gfo <api-examples.gfs >api-examples-Mon.txt
gf -retain -s $(GF_alltenses)/TryNep.gfo <api-examples.gfs >api-examples-Nep.txt
gf -retain -s $(GF_alltenses)/TryNor.gfo <api-examples.gfs >api-examples-Nor.txt
gf -retain -s $(GF_alltenses)/TryNno.gfo <api-examples.gfs >api-examples-Nno.txt
gf -retain -s $(GF_alltenses)/TryPes.gfo <api-examples.gfs >api-examples-Pes.txt
gf -retain -s $(GF_alltenses)/TryPnb.gfo <api-examples.gfs >api-examples-Pnb.txt
gf -retain -s $(GF_alltenses)/TryPol.gfo <api-examples.gfs >api-examples-Pol.txt
gf -retain -s $(GF_alltenses)/TryRon.gfo <api-examples.gfs >api-examples-Ron.txt
gf -retain -s $(GF_alltenses)/TryRus.gfo <api-examples.gfs >api-examples-Rus.txt
gf -retain -s $(GF_alltenses)/TrySnd.gfo <api-examples.gfs >api-examples-Snd.txt
gf -retain -s $(GF_alltenses)/TrySpa.gfo <api-examples.gfs >api-examples-Spa.txt
gf -retain -s $(GF_alltenses)/TrySwe.gfo <api-examples.gfs >api-examples-Swe.txt
gf -retain -s $(GF_alltenses)/TryTha.gfo <api-examples.gfs >api-examples-Tha.txt
gf -retain -s $(GF_alltenses)/TryUrd.gfo <api-examples.gfs >api-examples-Urd.txt

View File

@@ -1,7 +1,7 @@
module MkExxTable (getApiExx, ApiExx, prApiEx, mkEx) where module MkExxTable (getApiExx, ApiExx, prApiEx, mkEx) where
import System.Cmd --import System.Cmd
import System.Environment import System.Environment(getArgs)
import qualified Data.Map as M import qualified Data.Map as M
import Data.Char import Data.Char

View File

@@ -1,6 +1,6 @@
import MkExxTable import MkExxTable
import System.Cmd import System.Process(system)
import System.Environment import System.Environment(getArgs)
import Data.Char import Data.Char
import Data.List import Data.List
import qualified Data.ByteString.Char8 as BS import qualified Data.ByteString.Char8 as BS
@@ -16,7 +16,7 @@ synopsis = "synopsis.txt"
-- the language in which revealed examples are shown -- the language in which revealed examples are shown
revealedLang = "Eng" revealedLang = "Eng"
-- all languages shown -- all languages shown (a copy of this list appears in Makefile)
apiExxFiles = ["api-examples-" ++ lang ++ ".txt" | lang <- words apiExxFiles = ["api-examples-" ++ lang ++ ".txt" | lang <- words
-- "Eng Chi" -- "Eng Chi"
"Afr Bul Cat Chi Dan Dut Eng Est Eus Fin Fre Ger Gre Hin Ice Ita Jpn Lav Mlt Mon Nep Nor Nno Pes Pnb Pol Ron Rus Snd Spa Swe Tha Urd" "Afr Bul Cat Chi Dan Dut Eng Est Eus Fin Fre Ger Gre Hin Ice Ita Jpn Lav Mlt Mon Nep Nor Nno Pes Pnb Pol Ron Rus Snd Spa Swe Tha Urd"