ROOT =../..

DESDIR=$(DOCDIR)/design

DES = \
 front_des.html \
 01_system.html \
 02_data.html \
 03_drawing.html \
 04_attrib.html \
 05_netlist.html \
 06_hierarchy.html \
 07_devmap.html \
 08_ripple.html

IMP = \
 front_imp.html \
 01_system_imp.html \
 02_data_imp.html \
 03_drawing_imp.html \
 04_attrib_imp.html \
 06_hierarchy_imp.html \
 07_devmap_imp.html \
 08_ripple_imp.html

pdf: des.pdf imp.pdf

.images.stamp: src/*
	cd src && make
	echo "done" > .images.stamp

des.pdf: des.ps
	ps2pdf des.ps

des.ps: $(DES) .images.stamp
	(for n in $(DES); do echo "<!--NewPage-->"; cat $$n; done) | sed "s/\.svg/.png/g" | html2ps --colour > des.ps

imp.pdf: imp.ps
	ps2pdf imp.ps

imp.ps: $(IMP) .images.stamp
	(for n in $(IMP); do echo "<!--NewPage-->"; cat $$n; done) | sed "s/\.svg/.png/g" | html2ps --colour > imp.ps


install_all:
	$(SCCBOX) mkdir -p "$(DESDIR)"
	$(SCCBOX) $(HOW) -d $(DES) "$(DESDIR)"
	$(SCCBOX) $(HOW) -d $(IMP) "$(DESDIR)"

install:
	$(MAKE) install_all HOW="install -f"

linstall:
	$(MAKE) install_all HOW="linstall -f"

uninstall:
	$(MAKE) install_all HOW="uninstall"

include $(ROOT)/Makefile.conf
