X-Git-Url: http://rtime.felk.cvut.cz/gitweb/edu/xsl.git/blobdiff_plain/033e933487e3f44b04d792b16016010356b4d723..dcc98a739424a8af5193fd4c6ac663fcfe8a8982:/Makefile diff --git a/Makefile b/Makefile index f614bf6..d2cf2ea 100644 --- 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=$<