# Makefile for the GNOME ubuntu Documentation
# Ubuntu Documentation Project <ubuntu-doc@lists.ubuntu.com>

.PHONY: desktopguide browser-startpage index

MAKECMD=make

# XSL Processors
XSLTPROC=/usr/bin/xsltproc

current_distro=$(shell test -e /etc/debian_version && echo "debian")

# NWalsh Docbook XSL's
ifeq ($(current_distro), debian)
# Ubuntu
NWDBXSL=/usr/share/xml/docbook/stylesheet/nwalsh/html/docbook.xsl

# Debian and Ubuntu also need an explicit location for the XML catalog files
#export XML_CATALOG_FILES = /usr/share/xml/docbook/schema/dtd/4.1.2/catalog.xml
#else
# SuSE
#NWDBXSL=/usr/share/xml/docbook/stylesheet/nwalsh/current/html/docbook.xsl
endif

# Ubuntu Docbook Customization Layer

#XUBUNTUXSL=libs/ubuntu-banner.xsl
XUBUNTUXSL=libs/xubuntu-html-chunk-cust.xsl
#XUBUNTUWEBXSL=libs/ubuntu-banner-web.xsl
PDFSTYLE=../libs/pdf/ubuntu-pdf.xsl
LULUSTYLE=../libs/pdf/ubuntu-pdf-lulu.xsl

# Makes an Image list text file
MKIMGLST=../libs/imagelist.xsl

# Collected and Write Status
wOS=../libs/writeOwnerStatus.xsl

# Base directories for output from processor
BASE=../build/xubuntu/
PDFBASE=../build/pdf/xubuntu/
DESKTOPBASE=../build/xubuntu/desktopguide/
LULUBASE=../build/lulu/xubuntu/

# IMAGES=../build/xubuntu/images/
DGBASE=../build/xubuntu/desktopguide/

all: clean style index index-lang

style:
	# copy images to build directory
	#mkdir -p $(DESKTOPBASE)images/C
	#cp images/C/*.* $(DESKTOPBASE)images/C

	# copy logos
	mkdir -p $(BASE)common/images
	cp libs/images/*png $(BASE)common/images/

	# cp CSS Files to build directory
	cp libs/*.css $(BASE)common/

	# cp navigation / admon / .. images to build directory
	mkdir -p $(BASE)common/images/admon
	cp -r xubuntu-admon/*.* $(BASE)common/images/admon # need to keep these separately, because the default ones have a white bground
	
	# mkdir -p $(IMAGES)callouts
	# cp -r ../common/callouts/*.* $(IMAGES)callouts
	
	mkdir -p $(BASE)common/images/navig
	cp -r ../common/navig/*.* $(BASE)common/images/navig

index-lang:

	for i in index/po/*.po ; do j=$$(basename $$i .po) ; xsltproc --stringparam html.stylesheet "../common/xubuntu-book.css" --xinclude -o $(BASE)$$j/index.html $(XUBUNTUXSL) index-$$j.xml ; done

index:

	xsltproc --xinclude -o $(BASE)index.html $(XUBUNTUXSL) index.xml

browser-startpage:
	mkdir -p $(BASE)about
	cp about/*.html $(BASE)about
	cp about/*.css $(BASE)about

src-tarball:
	# exclude archive, backup, and svn files
	tar cvfz xubuntu-doc.tar.gz  --exclude="*.tar.gz" --exclude="*~" --exclude "*.svn*" *

clean:
	rm -rf $(BASE)


