]> rtime.felk.cvut.cz Git - edu/xsl.git/commitdiff
Fixed several bugs
authorMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 5 Mar 2009 11:57:26 +0000 (12:57 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 5 Mar 2009 11:57:26 +0000 (12:57 +0100)
Makefile

index f614bf6669821838dd45e23f91c8bd60bb586627..d2cf2ea58883a222fca0551b2fb9ea329d71ff42 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,15 +10,14 @@ endif
 export BASEDIR
 
 # RELATIVEDIR: relative path from BASEDIR to the current directory
-RELATIVEDIR=$(patsubst $(BASEDIR)/%,%,$(shell pwd))
+RELATIVEDIR=$(patsubst /%,%,$(patsubst $(BASEDIR)%,%,$(shell pwd)))
 
 # BACK_TO_BASE: relative path from the current directory to BASEDIR
-BACK_TO_BASE:=$(shell echo $(RELATIVEDIR)|sed -e 's/[^/]*/../g')
+BACK_TO_BASE:=$(shell echo $(RELATIVEDIR)|sed -e 's/[^/]\+/../g')
 
-# Destination filename
-ifndef FNAME
-FNAME=index.html
-endif
+# $(info BASEDIR=$(BASEDIR))
+# $(info RELATIVEDIR=$(RELATIVEDIR))
+# $(info BACK_TO_BASE=$(BACK_TO_BASE))
 
 TARGETDIR:=$(BASEDIR)/www/$(RELATIVEDIR)
 
@@ -43,14 +42,18 @@ WWW_ROOT := $(WWW_ROOT:%/=%)
 ifndef XMLS
 XMLS := $(wildcard *.xml)
 endif
-htmls := $(XMLS:%.xml=%.html)
+htmls := $(if $(word 2,$(XMLS)),$(XMLS:%.xml=%.html),index.html)
 
 default: subdirs
 default: $(htmls:%=$(TARGETDIR)/%)
 
+ifeq ($(words $(XMLS)),1)
+$(TARGETDIR)/$(htmls): $(XMLS)
+else
 $(TARGETDIR)/%.html: %.xml
+endif
        $(Q)mkdir -p $(dir $@)
-       $(Q)echo "  XSLTPROC $(notdir $@)"
+       $(Q)echo "  XSLTPROC $(RELATIVEDIR:%=%/)$(notdir $@)"
        $(Q)xsltproc --stringparam www.root $(WWW_ROOT) $(XSLTPROCFLAGS) $(BASEDIR)/xsl/course.xsl $< > "$@"
        $(Q)$(MAKE) --no-print-directory copy-links XML=$<