Edouard@2753: #! gmake
Edouard@2753: 
Edouard@2753: # Makefile to generate XSLT stylesheets from ysl2 files in the same directory
Edouard@2753: 
Edouard@2753: # This uses YML2. 
edouard@4088: #   git clone https://github.com/beremiz/yml2
Edouard@2753: 
edouard@4088: # It should be just fine if yml2 is cloned just aside beremiz
Edouard@2753: # otherwise, point yml2path to yml2 source directory
Edouard@2753: #   make yml2path=path/to/yml/dir
Edouard@2753: 
Edouard@2753: yml2path ?= $(abspath ../../yml2)
Edouard@2753: 
edouard@3235: ysl2files := gen_index_xhtml.ysl2 gen_dnd_widget_svg.ysl2 analyse_widget.ysl2
edouard@2884: ysl2includes := $(filter-out $(ysl2files), $(wildcard *.ysl2))
Edouard@2753: xsltfiles := $(patsubst %.ysl2, %.xslt, $(ysl2files))
Edouard@2753: 
Edouard@3484: jsfiles := svghmi.js sprintf.js pythonic.js
Edouard@3468: 
Edouard@2753: all:$(xsltfiles)
Edouard@2753: 
Edouard@3468: %.xslt: %.ysl2 $(ysl2includes) $(jsfiles) ../yslt_noindent.yml2
Edouard@2753: 	$(yml2path)/yml2c -I $(yml2path):../ $< -o $@.tmp
Edouard@2753: 	xmlstarlet fo $@.tmp > $@
Edouard@2753: 	rm $@.tmp
Edouard@2753: 	
Edouard@2753: clean:
Edouard@2753: 	rm -f $(xsltfiles)