############################################# # Build the Comprehensive LaTeX Symbol List # # By Scott Pakin # ############################################# # Define TARGETS as a list of all of the files we intend to generate # and provide to the end user. TARGETS = \ symbols-letter.pdf \ symbols-a4.pdf \ rawtables-letter.pdf \ rawtables-a4.pdf \ SYMLIST \ README # Define TEXSOURCES as the LaTeX source files that comprise the symbol list. TEXSOURCES = \ symbols.tex \ sym-intro.tex \ sym-body.tex \ sym-math.tex \ sym-sci.tex \ sym-ding.tex \ sym-lang.tex \ sym-music.tex \ sym-game.tex \ sym-geog.tex \ sym-logos.tex \ sym-other.tex \ sym-minsup.tex \ sym-addl.tex # Define PRUNETOML as the list of TOML files that are provided as # input to prune-idx. PRUNETOML = \ prune-idx-delete.toml \ prune-idx-accents.toml \ prune-idx-arrows.toml \ prune-idx-brands.toml \ prune-idx-circles.toml \ prune-idx-cup-cap.toml \ prune-idx-equals.toml \ prune-idx-flags.toml \ prune-idx-hands.toml \ prune-idx-harpoons.toml \ prune-idx-ineqs.toml \ prune-idx-integrals.toml \ prune-idx-keys.toml \ prune-idx-letters.toml \ prune-idx-math-maps.toml \ prune-idx-music.toml \ prune-idx-prec-succ.toml \ prune-idx-rhombuses.toml \ prune-idx-sets.toml \ prune-idx-similar.toml \ prune-idx-squares.toml \ prune-idx-stars.toml \ prune-idx-triangles.toml \ prune-idx-turnstiles.toml \ prune-idx-wedges-vees.toml \ prune-idx-rewrite.toml \ prune-idx-see.toml \ prune-idx-merge.toml # Define MAKEFAKES as the list of all makefake* scripts that generate # replacement .sty files for compatibility or speed. MAKEFAKES = \ makefakeasapsym \ makefakeboisik \ makefakecmupint \ makefakefdsymbol \ makefakefigchild \ makefakejunicode \ makefakelilyglyphs \ makefakelualatex \ makefakelucide \ makefakeMnSymbol \ makefakenewcm \ makefakepgfornament \ makefakestarfont \ makefakestix \ makefaketwemojis \ makefakeutfsym \ makefakevscodeicons \ makefakeworldflags # Define SOURCEDIST as the set of source files to be included in a # distribution of the symbol list. SOURCEDIST = \ $(TEXSOURCES) \ $(PRUNETOML) \ $(MAKEFAKES) \ lightbulb10.mf lightbulb.mf \ symbols.ist fakego.sty unicode2eps.pe fakeold-arrows.sty \ teubner-subset.sty fakemusixtex.sty \ albatross.ninja albatross.tex \ fakearevmath.sty fakedozenal.sty fakelatexsym.sty \ fakearcs.sty fakeallrunes.sty renamed-overarrows.sty \ fakemathdesign.sty patch-idx prune-idx sorting.lua \ makerawtables makenonlatex maketitlepage makeREADME \ rawtables.lua generate-symlist unicode.txt Makefile \ clsl.ninja common-deps.ninja fake-sty.ninja \ fast-symbols-index.ninja fast-symbols.ninja lightbulb.ninja \ rawtables.ninja text-files.ninja build.ninja # Define all Ninja files needed to build the Comprehensive LaTeX Symbol List. NINJA_ALL = \ albatross.ninja \ build.ninja \ clsl.ninja \ common-deps.ninja \ definitions.ninja \ fake-sty.ninja \ fast-symbols-index.ninja \ fast-symbols.ninja \ figchild.ninja \ junicode.ninja \ lightbulb.ninja \ lilyglyphs.ninja \ lucide-icons.ninja \ nonlatex.ninja \ pgfornament.ninja \ rawtables.ninja \ text-files.ninja \ twemojis.ninja \ utfsym.ninja \ vscodeicons.ninja \ worldflags.ninja # common-deps.ninja is invoked if any of the following files changes. COMMONDEPS_SOURCES = \ $(NINJA_ALL) \ $(TEXSOURCES) \ $(MAKEFAKES) \ lightbulb10.mf lightbulb.mf unicode2eps.pe # All builds of the symbol list depend upon the following files. # common-deps.stamp is touched after all of them have been created, # either manually for sources or programmatically for targets. COMMONDEPS = \ $(TEXSOURCES) \ $(PRUNETOML) \ symbols.ist fakeMnSymbol.sty teubner-subset.sty \ fakemusixtex.sty fakeknitting.sty fakefdsymbol.sty \ fakeboisik.sty fakestix.sty fakearcs.sty fakeold-arrows.sty \ fakearevmath.sty fakedozenal.sty fakelatexsym.sty \ fakestarfont.sty versatim.tex faketwemojis.sty \ fakeallrunes.sty fakecmupint.sty fakeworldflags.sty \ faketypicons.sty renamed-overarrows.sty fakewasysym.sty \ fakeasapsym.sty fakefontmfizz.sty fakehamnosys.sty \ fakefigchild.sty fakeutfsym.sty fakelogix.sty fakevscodeicons.sty \ fakesymbats3.sty fakecasiofont.sty fakemathdesign.sty \ fakenewcomputermodern.sty fakelucide-icons.sty \ lightbulb.pdf lightbulb.eps lightbulb10.pfb lightbulb.map \ patch-idx prune-idx sorting.lua # The following non-LaTeX files will be copied to the current # directory if they exist so LaTeX can find them. NONLATEX = hands.mf greenpoint.mf nkarta.mf astrosym.mf WebOMintsGD.pfb \ moonphase.mf dancers.mf smfpr10.mf umranda.mf umrandb.mf \ cryst.mf dice3d.mf magic.mf fselch10.mf msym10.tfm \ knot1.mf knot2.mf knot3.mf knot4.mf knot5.mf knot6.mf knot7.mf \ bskms10.mf endofproofwd.pdf cmrj.tfm Junicode-Regular.otf # The document builds properly only with pdflatex or lualatex. (I # haven't tested xelatex, but that might work, too.) LATEX = pdflatex ########################################################################### # Build all specified formats in all specified paper sizes. all: check_version $(NINJA_ALL) ninja # Ensure the version comment and hyperxmp's pdfversionid match in symbols.tex. check_version: symbols.tex comment_ver=$$(perl -ne '/^\%\%\%\s+version\s+=\s+\"(\S+)\"/ && print "$$1\n"' symbols.tex) \ pdf_ver=$$(perl -ne '/pdfversionid\s*=\s*\{(\S+)\}/ && print "$$1\n"' symbols.tex) ; \ test "$$comment_ver" = "$$pdf_ver" ########################################################################### # ---------------------------- # Build dependencies common to # multiple document versions. # ---------------------------- # Pass definitions from Make to Ninja. definitions.ninja: Makefile echo "# This is a generated file. DO NOT EDIT." > definitions.ninja echo "# Edit `readlink -f Makefile` instead." >> definitions.ninja echo "" >> definitions.ninja echo "LATEX = $(LATEX)" >> definitions.ninja echo "" >> definitions.ninja echo "PRUNETOML = $(PRUNETOML)" >> definitions.ninja echo "" >> definitions.ninja echo "build COMMONDEPS : phony $(COMMONDEPS)" >> definitions.ninja # If we have figchild.sty, generate a faked version that requires fewer TeX # resources. figchild.ninja: makefakefigchild ./makefakefigchild # If we have Junicode-Regular.otf, extract the versicle and response # characters as graphical images. This enables the font to work in # any TeX engine and without any helper .tfm or .enc files. junicode.ninja: makefakejunicode ./makefakejunicode # If we have the Emmentaler music fonts, convert each glyph to a # graphical image, which we place in our lilyglyphs subdirectory. # With a few command redefinitions, this enables us to use lilyglyphs # without requiring XeLaTeX or LuaLaTeX. lilyglyphs.ninja: makefakelilyglyphs ./makefakelilyglyphs # If we have lucide-icons.sty, generate a faked version that renders # faster. lucide-icons.ninja: makefakelucide ./makefakelucide # Symlink certain files locally so the LaTeX file can check if they # exist. Then, generate TFM and PK fonts from Metafont sources. nonlatex.ninja: makenonlatex Makefile ./makenonlatex $(NONLATEX) # If we have pgfornament.sty, generate a faked version that renders faster. pgfornament.ninja: makefakepgfornament ./makefakepgfornament # If we have twemojis.sty, generate a faked version that renders # faster. twemojis.ninja: makefaketwemojis ./makefaketwemojis # If we have utfsym.sty, generate a faked version that renders faster. utfsym.ninja: makefakeutfsym ./makefakeutfsym # If we have vscodeicons.sty, generate a faked version that renders # faster. vscodeicons.ninja: makefakevscodeicons ./makefakevscodeicons # If we have worldflags.sty, generate a faked version that renders faster. worldflags.ninja: makefakeworldflags ./makefakeworldflags # Avoid rebuilding common dependencies unnecessarily. The reason for # the touch is that common-deps.stamp may be newer than one of the # rule's dependencies yet no work is needed to rebuild # common-deps.stamp. In this case, the rule will trigger once but not # on subsequent builds. common-deps.stamp: $(COMMONDEPS_SOURCES) ninja common-deps.stamp touch common-deps.stamp ########################################################################### # ---------------------------------- # Define specific rules for building # with different paper sizes. # ---------------------------------- # The reason for the touch after each symbols-*.pdf rule is that # common-deps.stamp may be newer than symbols-*.pdf yet no work is # needed to rebuild either one. In this case, the rule will trigger # once but not on subsequent builds. symbols-a4.pdf: $(COMMONDEPS_SOURCES) mkdir -p build-a4 if [ "$(FAST)" = 2 ] ; then \ ninja -f fast-symbols-index.ninja symbols-a4.pdf ; \ elif [ "$(FAST)" = 1 ] ; then \ ninja -f fast-symbols.ninja symbols-a4.pdf ; \ else \ ninja a4 ; \ fi touch symbols-a4.pdf symbols-letter.pdf: $(COMMONDEPS_SOURCES) mkdir -p build-letter if [ "$(FAST)" = 2 ] ; then \ ninja -f fast-symbols-index.ninja symbols-letter.pdf ; \ elif [ "$(FAST)" = 1 ] ; then \ ninja -f fast-symbols.ninja symbols-letter.pdf ; \ else \ ninja letter ; \ fi touch symbols-letter.pdf rawtables-letter.pdf: common-deps.stamp rawtables.ninja build.ninja ninja rawtables-letter.pdf rawtables-a4.pdf: common-deps.stamp rawtables.ninja build.ninja ninja rawtables-a4.pdf ########################################################################### # Prepare to timestamp the distributed symbols.tex file. TODAY = $(shell date +'%d %B %Y') NOW = $(shell date +'%T %Z') # Create a .tar.gz file. comprehensive.tar.gz: check_version $(NINJA_ALL) $(SOURCEDIST) ninja $(RM) -r comprehensive mkdir comprehensive mkdir comprehensive/source install -m 664 $(TARGETS) comprehensive install -m 664 $(SOURCEDIST) comprehensive/source cat symbols.tex | \ perl -ne 's/(date\s*=\s*)\"[^\"]*\"/$$1\"$(TODAY)\"/; print' | \ perl -ne 's/(time\s*=\s*)\"[^\"]*\"/$$1\"$(NOW)\"/; print' | \ checksum > comprehensive/source/symbols.tex for script in comprehensive/source/make* ; do \ chmod 755 "$$script" ; \ done chmod 755 comprehensive/source/patch-idx chmod 755 comprehensive/source/prune-idx chmod 755 comprehensive/source/generate-symlist chmod 664 comprehensive/source/symbols.tex tar -czf comprehensive.tar.gz comprehensive $(RM) -r comprehensive dist: comprehensive.tar.gz distcheck: comprehensive.tar.gz $(RM) -r comprehensive tar -xzvf comprehensive.tar.gz cd comprehensive/source && $(MAKE) LATEX=$(LATEX) dist $(RM) -r comprehensive # Clean up our mess. We take the unusual step of first building all # Ninja files, which we do so we can invoke Ninja's "clean" tool and # remove all top-level files created by Ninja builds. clean: mostlyclean $(NINJA_ALL) ninja -t clean $(RM) -r build-a4 build-letter build-rawtables $(RM) definitions.ninja junicode.ninja lilyglyphs.ninja $(RM) lucide-icons.ninja pgfornament.ninja twemojis.ninja $(RM) vscodeicons.ninja $(RM) nonlatex.ninja figchild.ninja utfsym.ninja worldflags.ninja $(RM) -r figchild junicode lilyglyphs lucide-icons twemojis $(RM) -r utfsym vscodeicons worldflags $(RM) .ninja_log common-deps.stamp $(RM) nkarta.*pk magic.*pk moonphase.*pk $(RM) newcm*.tfm newcm*.enc NewCM*-Book.pfb $(RM) lightbulb10.*pk lightbulb10.tfm # Remove primarily the document itself in preparation for a subsequent # build. Howeve, we also remove definitions.ninja because this caches the # value of LATEX, which the user may change from build to build; and # newcmsans.dd, which depends on the value of LATEX. mostlyclean: $(RM) $(TARGETS) $(RM) comprehensive.tar.gz $(RM) -r comprehensive $(RM) build-letter/step-*.stamp build-a4/step-*.stamp $(RM) definitions.ninja newcmsans.dd .PHONY: all check_version dist distcheck clean mostlyclean