2024-05-05 18:37:24 +02:00
|
|
|
CONVERTER = python converter.py
|
|
|
|
VALIDATE = xmllint --schema
|
2024-05-05 20:17:21 +02:00
|
|
|
SAXON = java -jar $(firstword $(wildcard saxon*.jar))
|
2024-05-05 18:37:24 +02:00
|
|
|
RM = rm
|
2024-05-05 19:02:19 +02:00
|
|
|
ECHO = echo -e
|
2024-05-05 19:19:41 +02:00
|
|
|
CURL = curl --location
|
|
|
|
UNZIP = unzip
|
2024-05-05 18:37:24 +02:00
|
|
|
|
|
|
|
SYSTEMS = l-systems
|
|
|
|
TORTUE = tortue
|
|
|
|
TRACEUR = traceur
|
|
|
|
SVG = svg
|
|
|
|
|
|
|
|
EXPORT = image
|
|
|
|
|
|
|
|
all: generation tortue traceur svg
|
|
|
|
|
2024-05-05 19:19:15 +02:00
|
|
|
# Generation du fichier XML des L-systèmes
|
2024-05-05 18:37:24 +02:00
|
|
|
generation:
|
|
|
|
$(CONVERTER) $(SYSTEMS).csv -o $(SYSTEMS).xml
|
|
|
|
$(VALIDATE) $(SYSTEMS).xsd $(SYSTEMS).xml 1>/dev/null
|
|
|
|
|
2024-05-05 19:19:15 +02:00
|
|
|
# Génération du fichier XML de la tortue + vérification
|
2024-05-05 18:37:24 +02:00
|
|
|
tortue:
|
2024-05-05 19:02:19 +02:00
|
|
|
ifeq ($(and $(nom),$(n)),)
|
|
|
|
@$(ECHO) "Il manque des arguments, par exemple :\n" \
|
|
|
|
" make $(MAKECMDGOALS) nom=snow n=3"
|
|
|
|
@false
|
|
|
|
endif
|
|
|
|
$(SAXON) -s:$(SYSTEMS).xml -xsl:$(TORTUE).xsl -o:$(TORTUE).xml nom=$(nom) n=$(n)
|
2024-05-05 18:37:24 +02:00
|
|
|
$(VALIDATE) $(TORTUE).xsd $(TORTUE).xml 1>/dev/null
|
|
|
|
|
2024-05-05 19:19:15 +02:00
|
|
|
# Génération du fichier XML du traceur + vérification
|
2024-05-05 18:37:24 +02:00
|
|
|
traceur:
|
|
|
|
$(SAXON) -s:$(TORTUE).xml -xsl:$(TRACEUR).xsl -o:$(TRACEUR).xml
|
|
|
|
$(VALIDATE) $(TRACEUR).xsd $(TRACEUR).xml 1>/dev/null
|
|
|
|
|
2024-05-05 19:19:15 +02:00
|
|
|
# Génération du fichier SVG
|
2024-05-05 18:37:24 +02:00
|
|
|
svg:
|
|
|
|
$(SAXON) -s:$(TRACEUR).xml -xsl:$(SVG).xsl -o:$(EXPORT).svg
|
|
|
|
|
2024-05-05 19:19:15 +02:00
|
|
|
# Supprime les fichiers générés
|
2024-05-05 18:37:24 +02:00
|
|
|
clean:
|
|
|
|
-$(RM) $(SYSTEMS).xml $(TORTUE).xml $(TRACEUR).xml $(EXPORT).svg
|
2024-05-05 19:19:41 +02:00
|
|
|
|
|
|
|
# Télécharge Saxon
|
2024-05-05 19:25:01 +02:00
|
|
|
SAXON_VER = 10.3
|
2024-05-05 19:19:41 +02:00
|
|
|
saxon:
|
2024-05-05 19:25:01 +02:00
|
|
|
$(eval _version = $(subst .,-,$(SAXON_VER)))
|
2024-05-05 20:19:33 +02:00
|
|
|
$(eval _major = $(firstword $(subst ., ,$(SAXON_VER))))
|
2024-05-05 19:25:01 +02:00
|
|
|
$(eval _zipfile = saxon.zip)
|
|
|
|
$(CURL) https://github.com/Saxonica/Saxon-HE/raw/main/$(_major)/Java/SaxonHE$(_version)J.zip \
|
|
|
|
> $(_zipfile)
|
|
|
|
$(UNZIP) -j $(_zipfile) saxon-he-$(SAXON_VER).jar
|
|
|
|
$(RM) $(_zipfile)
|