%(sh_comment template "header_gpl")

if FLYN
# For local development use only.
include /etc/fctk/config.mk
endif

AUTOMAKE_OPTIONS = gnu

man_MANS = %(PROJ_NAME:FIXME).1

EXTRA_DIST =  %(PROJ_NAME:FIXME).spec %(PROJ_NAME:FIXME).1

if FLYN
# For local development use only.
%(sh_delim after=".spec" PROJ_NAME:FIXME)
$(PACKAGE).spec: $(PACKAGE).xml
	xsltproc -o $(PACKAGE).spec --stringparam version $(VERSION) $(XSLT_DIR)/spec.xslt $(PACKAGE).xml

%(sh_delim after=".html" PROJ_NAME:FIXME)
$(PACKAGE).html: $(PACKAGE).xml
	xsltproc -o $(PACKAGE).html $(XSLT_DIR)/webpage.xslt $(PACKAGE).xml

%(sh_delim after="_summary.html" PROJ_NAME:FIXME)
$(PACKAGE)_summary.html: $(PACKAGE).xml
	xsltproc -o $(PACKAGE)_summary.html $(XSLT_DIR)/html_summary.xslt $(PACKAGE).xml
	
%(sh_delim after=".1" PROJ_NAME:FIXME)
%(PROJ_NAME:FIXME).1: ${srcdir}/%(PROJ_NAME:FIXME).xml
	xsltproc -o $(PACKAGE).1 $(XSLT_DIR)/manpage.xslt $(PACKAGE).xml

%(sh_delim "README")
README: $(PACKAGE).xml
	xsltproc -o README $(XSLT_DIR)/README.xslt $(PACKAGE).xml

%(sh_delim "control")
control: $(PACKAGE).xml
	xsltproc -o control $(XSLT_DIR)/control.xslt $(PACKAGE).xml

%(sh_delim before="usage_" after=".c" PROJ_NAME:FIXME)
usage_$(PACKAGE).c: $(PACKAGE).xml
	xsltproc -o usage_$(PACKAGE).c /usr/share/fctk/usage.xslt $(PACKAGE).xml

# ============================= maintainer-clean-local ========================
maintainer-clean-local:
	rm -f control
	rm -f new.html
	rm -f $(PACKAGE).spec
	rm -f $(PACKAGE)_summary.html
	rm -f pam_mount.8
	rm -f README
	rm -f usage_$(PACKAGE).c

# ============================= all =========================================== 
all: $(PACKAGE).spec README $(PACKAGE).html $(PACKAGE)_summary.html $(PACKAGE).spec control $(PACKAGE).1 usage_$(PACKAGE).c
	cp usage_$(PACKAGE).c ../src/
	cp README ..
	cp control ../debian

endif
