#
# Makefile
#
# Transforms the potential field XML-files to potential field configuration files (pfc)
#
# @author Tim Laue
# 

# Special files
XSLT_FILE = ../../../../Tools/PotentialFields/pfc/transform-pfc.xsl
DTD_FILE = ../../../../Tools/PotentialFields/pfc/pfc.dtd
XSLT_PROC = xsltproc.exe
XML_VALIDATOR = xmllint.exe
COMMON_FILES = $(shell ls Common/*.xml)

# The directories
XML_FILES_DIR = .
PFC_OUTPUT_DIR = ../../../../../Config/Pfield/Bremen
PFC_FILES = $(shell ls $(XML_FILES_DIR)/*.xml | sed s/.xml/.pfc/ )
PFC_FILES_FULL =$(PFC_FILES:%.pfc=$(PFC_OUTPUT_DIR)/%.pfc)
EXPECTED_XML_FILES = $(shell mkdir -p $(PFC_OUTPUT_DIR); ls $(PFC_OUTPUT_DIR) | sed s/.pfc/.xml/ )
EXPECTED_XML_FILES_FULL =$(EXPECTED_XML_FILES:%.xml=$(XML_FILES_DIR)/%.xml)


# Main target
all: $(EXPECTED_XML_FILES_FULL) $(PFC_FILES_FULL)

# Clear pfc-files if no corresponding xml-file exists
$(XML_FILES_DIR)/%.xml:
	@echo '! $@ does not exist! Removing pfc files ...'
	rm -f $(PFC_OUTPUT_DIR)/*.pfc

# Rule for transforming and validating XML-files
$(PFC_OUTPUT_DIR)/%.pfc: $(XML_FILES_DIR)/%.xml $(DTD_FILE) $(XSLT_FILE) $(COMMON_FILES)
	@echo '! BremenByters: $< has changed. Recompiling ...'
	@$(XML_VALIDATOR) --noout --valid $<
	@$(XSLT_PROC) -o $@ $(XSLT_FILE) $< 

	
#
# $Log: Makefile,v $
# Revision 1.2  2004/03/09 08:50:26  dueffert
# new XIncludes namespace to avoid libxml warning
#
# Revision 1.1  2004/01/23 14:56:48  tim
# Added files for BremenByters potential field behavior
#
#