SHELL := /bin/bash

# The targets made here are individual code-level demos.
# Some produce LaTeX fragments.  All are being checked for the code being valid.
# None are being built from *.tex toward *.pdf.  Use the top-level makefile for that.


BuildBase = ../../build
Build = ${BuildBase}/string

CFA = ../../../../../../build/driver/cfa

DEMOS = ${addprefix $(Build)/, ${addsuffix -demo.tex, \
	sharing \
}}

EZDEMOS = ${addsuffix -ezdemo, \
	sharectx \
}


all: $(DEMOS) $(EZDEMOS)

%-ezdemo: %-ezdemo-runok | $(Build) 
	@echo target $@ made

%-ezdemo-runok: $(Build)/%-ezdemo | $(Build)
	$<

$(Build)/%-demo.tex: $(Build)/%-demo | $(Build)
	$< > $@

$(Build)/%-demo: %-demo.cfa
	$(CFA) $< -o $@

$(Build)/%-ezdemo: %-demo.cfa
	$(CFA) $< -o $@




${Build}:
	mkdir -p $@

.PHONY : all %-demo %-demo %-runok
.PRECIOUS : $(Build)/%-demo.tex $(Build)/%-demo.cfa $(Build)/%-demo
