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

.PHONY: desktopguide browser-startpage

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

XUBUNTUCHUNKXSL=libs/xubuntu-html-chunk-cust.xsl
XUBUNTUSINGLEXSL=libs/xubuntu-html-single-cust.xsl
PDFSTYLE=../libs/ubuntu-pdf.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/

DESKTOPBASE=../build/xubuntu/desktopguide/

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

all: desktopguide

	# 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

# Desktop Guide

desktopguide:
	@echo "Building the Xubuntu Desktop Guide . . ."
	for dir in desktopguide/*; do \
	i=`basename $$dir`;\
	if [ ! -d $$dir ];then continue;fi;\
	mkdir -p $(DESKTOPBASE)$$i/; \
	xsltproc --xinclude --stringparam base.dir $(DESKTOPBASE)$$i/ $(XUBUNTUCHUNKXSL) $$dir/desktopguide.xml; \
	done

	@echo "Complete. Find outputs at" $(DESKTOPBASE)
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)

