| 1 |
# Makefile for eigo |
| 2 |
# Documentation generation and CTAN preparation |
| 3 |
|
| 4 |
PACKAGE = eigo |
| 5 |
VERSION = 0.9 |
| 6 |
DATE = 2025-09-09 |
| 7 |
|
| 8 |
# Source files |
| 9 |
STYLE = $(PACKAGE).sty |
| 10 |
DOC = $(PACKAGE).tex |
| 11 |
README = README.md |
| 12 |
|
| 13 |
# Generated files |
| 14 |
PDF = $(PACKAGE).pdf |
| 15 |
INS = $(PACKAGE).ins |
| 16 |
DTX = $(PACKAGE).dtx |
| 17 |
|
| 18 |
# Distribution directory |
| 19 |
DISTDIR = $(PACKAGE)-$(VERSION) |
| 20 |
|
| 21 |
.PHONY: all doc clean dist ctan-zip test install ctan-archive |
| 22 |
|
| 23 |
all: doc |
| 24 |
|
| 25 |
# Documentation generation |
| 26 |
doc: $(PDF) |
| 27 |
|
| 28 |
$(PDF): $(DOC) $(STYLE) |
| 29 |
pdflatex $(DOC) |
| 30 |
pdflatex $(DOC) |
| 31 |
pdflatex $(DOC) |
| 32 |
|
| 33 |
# Compilation tests with different options |
| 34 |
test: $(STYLE) |
| 35 |
@echo "Testing basic compilation..." |
| 36 |
echo 'x' | pdflatex "\documentclass{article}\usepackage{$(PACKAGE)}\begin{document}\blackstones{d4}\showfullgoban\end{document}" || true |
| 37 |
@echo "Testing with frame option..." |
| 38 |
echo 'x' | pdflatex "\documentclass{article}\usepackage[frame]{$(PACKAGE)}\begin{document}\blackstones{d4}\showfullgoban\end{document}" || true |
| 39 |
@echo "Testing color mode..." |
| 40 |
echo 'x' | pdflatex "\documentclass{article}\usepackage[color]{$(PACKAGE)}\begin{document}\blackstones{d4}\showfullgoban\end{document}" || true |
| 41 |
@echo "Testing LuaLaTeX compatibility..." |
| 42 |
echo 'x' | lualatex "\documentclass{article}\usepackage{$(PACKAGE)}\begin{document}\blackstones{d4}\showfullgoban\end{document}" || true |
| 43 |
@echo "Tests completed (errors expected for inline tests)!" |
| 44 |
|
| 45 |
# Code quality validation |
| 46 |
validate: $(STYLE) |
| 47 |
@echo "Validating package structure..." |
| 48 |
@grep -q "NeedsTeXFormat{LaTeX2e}" $(STYLE) || (echo "Missing LaTeX2e requirement" && exit 1) |
| 49 |
@grep -q "ProvidesPackage{$(PACKAGE)}" $(STYLE) || (echo "Missing package declaration" && exit 1) |
| 50 |
@grep -q "LaTeX Project Public License" $(STYLE) || (echo "Missing license declaration" && exit 1) |
| 51 |
@echo "Package structure validation passed!" |
| 52 |
|
| 53 |
# Clean temporary files |
| 54 |
clean: |
| 55 |
rm -f *.aux *.log *.toc *.out *.fdb_latexmk *.fls *.synctex.gz |
| 56 |
rm -f texput.pdf texput.aux texput.log |
| 57 |
|
| 58 |
# Complete distribution |
| 59 |
dist: doc validate |
| 60 |
mkdir -p $(DISTDIR) |
| 61 |
cp $(STYLE) $(DISTDIR)/ |
| 62 |
cp $(DOC) $(DISTDIR)/ |
| 63 |
cp $(PDF) $(DISTDIR)/ |
| 64 |
cp $(README) $(DISTDIR)/ |
| 65 |
cp LICENSE.txt $(DISTDIR)/ |
| 66 |
cp Makefile $(DISTDIR)/ |
| 67 |
|
| 68 |
# CTAN-compliant archive creation |
| 69 |
ctan-archive: doc validate |
| 70 |
@echo "Creating CTAN-compliant archive..." |
| 71 |
mkdir -p $(DISTDIR) |
| 72 |
mkdir -p $(DISTDIR)/$(PACKAGE) |
| 73 |
cp $(STYLE) $(DISTDIR)/$(PACKAGE)/ |
| 74 |
cp $(DOC) $(DISTDIR)/$(PACKAGE)/ |
| 75 |
cp $(PDF) $(DISTDIR)/$(PACKAGE)/ |
| 76 |
cp $(README) $(DISTDIR)/$(PACKAGE)/ |
| 77 |
cp LICENSE.txt $(DISTDIR)/$(PACKAGE)/ |
| 78 |
cp Makefile $(DISTDIR)/$(PACKAGE)/ |
| 79 |
cd $(DISTDIR) && zip -r ../$(PACKAGE)-$(VERSION).zip $(PACKAGE)/ |
| 80 |
@echo "CTAN archive created: $(PACKAGE)-$(VERSION).zip" |
| 81 |
@echo "Archive size: $$(du -h $(PACKAGE)-$(VERSION).zip | cut -f1)" |
| 82 |
@echo "Archive structure:" |
| 83 |
@unzip -l $(PACKAGE)-$(VERSION).zip |
| 84 |
rm -rf $(DISTDIR) |
| 85 |
|
| 86 |
# Standard archive for CTAN |
| 87 |
ctan-zip: ctan-archive |
| 88 |
|
| 89 |
# Local installation |
| 90 |
install: $(STYLE) $(PDF) |
| 91 |
mkdir -p ~/texmf/tex/latex/$(PACKAGE) |
| 92 |
mkdir -p ~/texmf/doc/latex/$(PACKAGE) |
| 93 |
cp $(STYLE) ~/texmf/tex/latex/$(PACKAGE)/ |
| 94 |
cp $(PDF) ~/texmf/doc/latex/$(PACKAGE)/ |
| 95 |
cp $(README) ~/texmf/doc/latex/$(PACKAGE)/ |
| 96 |
texhash ~/texmf |