summaryrefslogtreecommitdiff
path: root/doc/introduction/Makefile
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2005-08-15 15:15:05 +0000
committermichelou <michelou@epfl.ch>2005-08-15 15:15:05 +0000
commit163fd2284673c9bafb50918dc41166bf6c4b5d59 (patch)
tree9c87690b07e7968fb882d15139e3a53454e3cd6b /doc/introduction/Makefile
parentec4245fc4ef843d1775137fc36380a792f37c61e (diff)
downloadscala-163fd2284673c9bafb50918dc41166bf6c4b5d59.tar.gz
scala-163fd2284673c9bafb50918dc41166bf6c4b5d59.tar.bz2
scala-163fd2284673c9bafb50918dc41166bf6c4b5d59.zip
- ScalaIntro.pdf/.ps are now generated automati...
- ScalaIntro.pdf/.ps are now generated automatically from the XML sources of the Scala website.
Diffstat (limited to 'doc/introduction/Makefile')
-rw-r--r--doc/introduction/Makefile163
1 files changed, 163 insertions, 0 deletions
diff --git a/doc/introduction/Makefile b/doc/introduction/Makefile
new file mode 100644
index 0000000000..3bcb5d75cc
--- /dev/null
+++ b/doc/introduction/Makefile
@@ -0,0 +1,163 @@
+############################################################-*-Makefile-*-####
+# Scala Introduction
+##############################################################################
+# $Id$
+
+##############################################################################
+# Configuration
+
+ROOT = ../..
+
+include $(ROOT)/Makefile.import
+
+##############################################################################
+# Variables
+
+WEBSITE_PROJECT_ROOT ?= $(ROOT)/../scala-website
+WEBSITE_SOURCEDIR ?= $(WEBSITE_PROJECT_ROOT)/sources
+
+# project
+PROJECT_SOURCES += default.dtd
+PROJECT_SOURCES += $(XML_SOURCES)
+
+PROJECT_XSLFILE = ScalaIntro.xsl
+PROJECT_BUILDDATE = $(shell date "+%B %d, %Y")
+
+#XML_SOURCES += index.xml
+#XML_SOURCES += $(shell cd $(WEBSITE_SOURCEDIR); ls intro/*.xml)
+
+# We preserve section order of PDF document generated by Acrobat
+XML_FILES += index
+XML_FILES += intro/unifiedtypes
+XML_FILES += intro/classes
+XML_FILES += intro/traits
+XML_FILES += intro/subclassing
+XML_FILES += intro/mixin
+XML_FILES += intro/funsyntax
+XML_FILES += intro/hofuns
+XML_FILES += intro/funnesting
+XML_FILES += intro/currying
+XML_FILES += intro/caseclasses
+XML_FILES += intro/patmatch
+XML_FILES += intro/xml
+XML_FILES += intro/regexppat
+XML_FILES += intro/comprehensions
+XML_FILES += intro/generics
+XML_FILES += intro/variances
+XML_FILES += intro/upbounds
+XML_FILES += intro/lowbounds
+XML_FILES += intro/innerclasses
+XML_FILES += intro/abstracttypes
+XML_FILES += intro/compoundtypes
+XML_FILES += intro/selfrefs
+XML_FILES += intro/views
+XML_FILES += intro/polymethods
+XML_FILES += intro/inference
+XML_FILES += intro/operators
+XML_FILES += intro/targettyping
+XML_FILES += intro/coercions
+XML_SOURCES += $(XML_FILES:%=%.xml)
+
+PNG_FILES += images/classhierarchy
+PNG_FILES += images/colpoint2d
+PNG_FILES += images/colpoint3d
+PNG_FILES += images/scala_logo
+PNG_SOURCES += $(PNG_FILES:%=%.png)
+
+# latex
+LATEX_FORMATS += dvi
+LATEX_FORMATS += ps
+LATEX_FORMATS += pdf
+
+LATEX_TARGETS += $(LATEX_FORMATS:%=ScalaIntro.%)
+
+LATEX_SOURCES += MainPart.tex
+LATEX_SOURCES += ScalaIntro.tex
+
+# latex
+TEXINPUTS := $(PROJECT_SUPPORTDIR)/latex:$(TEXINPUTS):
+
+##############################################################################
+# Includes
+
+include $(PROJECT_SUPPORTDIR)/make/latex.mk
+
+AWK ?= awk
+CYGWIN ?= $(filter CYGWIN%,$(shell uname))
+
+##############################################################################
+# XSLT processor
+
+XSLTPROC ?= xsltproc
+XSLTPROC_FLAGS +=
+
+##############################################################################
+# convert
+
+CONVERT ?= convert
+CONVERT_FLAGS += -sharpen 0.1 -flatten -trim
+
+##############################################################################
+# PDF viewer
+
+ACROREAD_WIN32 ?= c:/Progra~1/Adobe/Acrobat\ 7.0/Reader/AcroRd32.exe
+ACROREAD_UNIX ?= acroread
+
+PDF_VIEWER ?= $(if $(CYGWIN),$(ACROREAD_WIN32),$(ACROREAD_UNIX))
+
+##############################################################################
+# PS viewer
+
+GSVIEW_WIN32 ?= gsview32
+GSVIEW_UNIX ?= gv
+
+PS_VIEWER ?= $(if $(CYGWIN),$(GSVIEW_WIN32),$(GSVIEW_UNIX))
+
+##############################################################################
+# Commands
+
+clean:
+ @$(RM) -r images intro MainPart.tex default.dtd index.xml ScalaIntro.out
+
+view: viewpdf
+
+viewpdf: ScalaIntro.pdf
+ $(PDF_VIEWER) $< &
+
+viewps: ScalaIntro.ps
+ $(PS_VIEWER) $< &
+
+.PHONY: clean
+.PHONY: view
+.PHONY: viewpdf
+.PHONY: viewps
+
+##############################################################################
+# Rules
+
+images :
+ @[ -d $@ ] || $(MKDIR) -p $@
+ for file in $(PNG_SOURCES); do \
+ $(CONVERT) $(CONVERT_FLAGS) \
+ PNG:$(WEBSITE_SOURCEDIR)/$$file EPS:images/`$(BASENAME) $$file .png`.eps; \
+ $(CONVERT) $(CONVERT_FLAGS) \
+ PNG:$(WEBSITE_SOURCEDIR)/$$file PDF:images/`$(BASENAME) $$file .png`.pdf; \
+ done
+
+intro :
+ @[ -d $@ ] || $(MKDIR) -p $@
+ @for file in $(PROJECT_SOURCES); do \
+ $(AWK) '/<src/{on=1};/<\/src>/{on=0};{if(on){gsub("{","\\{");gsub("}","\\}")};print $0}' \
+ $(WEBSITE_SOURCEDIR)/$$file > $$file; \
+ done
+
+MainPart.tex : images intro $(PROJECT_XSLFILE)
+ $(ECHO) "%% Generated file: $@" > $@
+ $(ECHO) "%% Build date : $(PROJECT_BUILDDATE)" >> $@
+ $(XSLTPROC) $(XSLTPROC_FLAGS) $(PROJECT_XSLFILE) $(XML_SOURCES) | \
+ $(SED) -e 's/% 2/\\% 2/g' | \
+ $(SED) -e 's/<%/<\\%/g' | \
+ $(SED) -e 's/#Node/\\#Node/g' | \
+ $(SED) -e 's/{_/{\\_/g' >> $@
+
+##############################################################################