Permalink
Browse files

Included a Makefile containing the magic incantations for links to wo…

…rk in

the release zip.

git-svn-id: http://widl.webvm.net/svn/widlproc/trunk@346 b2e84630-a466-403e-8074-5faad0055f28
  • Loading branch information...
1 parent 5bb03f7 commit 0ed9315a10694c32c83e28add620e6bc8d41f646 tpr committed Jul 15, 2009
Showing with 136 additions and 28 deletions.
  1. +4 −28 Makefile
  2. +91 −0 examples/Makefile
  3. +41 −0 examples/README
View
@@ -134,41 +134,17 @@ SVNBRANCH = $(shell test -d .svn && svn info . | sed -n 's|^URL:.*/\([^/]*\)$$|\
SVNREV = $(shell test -d .svn && svn info -R . | sed -n 's/^Last Changed Rev: \([0-9][0-9]*\)$$/\1/p' | sort -g | tail -1)
zip : $(OBJDIR)/widlproc-$(SVNBRANCH)$(SVNREV).zip
-$(OBJDIR)/widlproc-$(SVNBRANCH)$(SVNREV).zip : $(WIDLPROC) $(DTD) $(DOCDIR)/widlproc.html $(SRCDIR)/widlprocxmltohtml.xsl Makefile
+$(OBJDIR)/widlproc-$(SVNBRANCH)$(SVNREV).zip : $(WIDLPROC) $(DTD) $(DOCDIR)/widlproc.html $(SRCDIR)/widlprocxmltohtml.xsl $(SRCDIR)/widlprocxmlfqids.xsl Makefile
rm -f $@
zip -j $@ $^ -x Makefile
- zip $@ examples/*.widl examples/*.css
+ zip $@ examples/*.widl examples/*.css examples/Makefile examples/README
srczip : widlproc-src-$(SVNBRANCH)$(SVNREV).zip
widlproc-src-%.zip : $(SVNFILES)
zip $@ $^
-WIDLS = $(patsubst $(EXAMPLESDIR)/%, %, $(wildcard $(EXAMPLESDIR)/*.widl))
-
-test : $(patsubst %.widl, $(OBJDIR)/$(EXAMPLESDIR)/%.html, $(WIDLS))
- @echo "$@ pass"
-
-$(OBJDIR)/$(EXAMPLESDIR)/%.html : $(OBJDIR)/$(EXAMPLESDIR)/%.widlprocxml2 $(SRCDIR)/widlprocxmltohtml.xsl Makefile
- cp $(SRCDIR)/widlprocxmltohtml.xsl $(dir $@)/
- xsltproc $(dir $@)/widlprocxmltohtml.xsl $< >$@
-
-$(OBJDIR)/$(EXAMPLESDIR)/%.widlprocxml2 : $(OBJDIR)/$(EXAMPLESDIR)/fqids.sed $(OBJDIR)/$(EXAMPLESDIR)/%.widlprocxml
- sed -f $^ >$@
- cp $@ $@.keep
-
-$(OBJDIR)/$(EXAMPLESDIR)/fqids.sed : $(patsubst %.widl, $(OBJDIR)/$(EXAMPLESDIR)/%.widlprocxml, $(WIDLS)) $(SRCDIR)/widlprocxmlfqids.xsl Makefile
- # Create the list of fqids (from fqid attributes).
- for i in $(filter %.widlprocxml, $^); do xsltproc $(SRCDIR)/widlprocxmlfqids.xsl $$i || exit 1; done >$@.tmp
- # Turn that into a sed script that turns a ref to the last element of
- # an fqid into an <a href> to the fqid in the right file (where the
- # first element of the fqid gives the filename).
- sed -n 's/^\([^:]*\).*:\([^:]*\)$$/s\/<ref>\2<\\\/ref>\/<ref ref="\1.html#&">\2<\\\/ref>\/g;s\/<ScopedName *identifier="\2"\/<ScopedName identifier="\2" ref="\1.html#&"\/g/p' $@.tmp >$@
-
-$(OBJDIR)/$(EXAMPLESDIR)/%.widlprocxml : $(EXAMPLESDIR)/%.widl $(WIDLPROC) $(DTD) Makefile
- mkdir -p $(dir $@)
- $(WIDLPROC) $< >$@
- cp $(OBJDIR)/widlprocxml.dtd $(dir $@)/
- xmllint --noout --dtdvalid $(DTD) $@
+test :
+ $(MAKE) -C examples SRCDIR=../src OBJDIR=../obj EXAMPLESOBJDIR=../obj/examples
.DELETE_ON_ERROR:
View
@@ -0,0 +1,91 @@
+########################################################################
+# $Id$
+# Copyright 2009 Aplix Corporation. All rights reserved.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+########################################################################
+
+UNAME = $(shell uname)
+EXAMPLESDIR = .
+# The settings of SRCDIR (where to find the xsl style sheets), OBJDIR (where to
+# find widlproc and widlprocxml.dtd) and EXAMPLESOBJDIR (where to put the
+# resulting html files and any intermediate files) reflect the directory
+# structure of the released widlproc.zip file when unzipped. ../Makefile calls
+# this Makefile with these settings overridden to reflect the directory
+# structure in svn.
+SRCDIR = ..
+OBJDIR = ..
+EXAMPLESOBJDIR = obj
+
+########################################################################
+# Linux configuration
+#
+ifneq (,$(filter Linux%, $(UNAME)))
+
+EXESUFFIX =
+
+else
+########################################################################
+# Darwin configuration
+#
+ifneq (,$(filter Darwin%, $(UNAME)))
+
+EXESUFFIX =
+
+else
+########################################################################
+# Windows (cygwin but using MS compiler) configuration
+#
+ifneq (,$(filter CYGWIN%, $(UNAME)))
+
+EXESUFFIX = .exe
+
+endif
+endif
+endif
+
+########################################################################
+# Common makefile
+#
+WIDLPROC = $(OBJDIR)/widlproc$(EXESUFFIX)
+DTD = $(OBJDIR)/widlprocxml.dtd
+
+WIDLS = $(patsubst $(EXAMPLESDIR)/%, %, $(wildcard $(EXAMPLESDIR)/*.widl))
+
+test : $(patsubst %.widl, $(EXAMPLESOBJDIR)/%.html, $(WIDLS))
+ @echo "$@ pass"
+
+$(EXAMPLESOBJDIR)/%.html : $(EXAMPLESOBJDIR)/%.widlprocxml2 $(SRCDIR)/widlprocxmltohtml.xsl Makefile
+ cp $(SRCDIR)/widlprocxmltohtml.xsl $(dir $@)/
+ xsltproc $(dir $@)/widlprocxmltohtml.xsl $< >$@
+
+$(EXAMPLESOBJDIR)/%.widlprocxml2 : $(EXAMPLESOBJDIR)/fqids.sed $(EXAMPLESOBJDIR)/%.widlprocxml
+ sed -f $^ >$@
+ cp $@ $@.keep
+
+# Note in the following commands a double $$ in a shell command in a makefile
+# represents a single $ in the shell command actually executed.
+
+$(EXAMPLESOBJDIR)/fqids.sed : $(patsubst %.widl, $(EXAMPLESOBJDIR)/%.widlprocxml, $(WIDLS)) $(SRCDIR)/widlprocxmlfqids.xsl Makefile
+ # Create the list of fqids (from fqid attributes).
+ for i in $(filter %.widlprocxml, $^); do xsltproc $(SRCDIR)/widlprocxmlfqids.xsl $$i || exit 1; done >$@.tmp
+ # Turn that into a sed script that turns a ref to the last part of
+ # an fqid into a <ref ref=".."> to the fqid in the right file (where the
+ # first part of the fqid gives the filename).
+ sed -n 's/^\([^:]*\).*:\([^:]*\)$$/s\/<ref>\2<\\\/ref>\/<ref ref="\1.html#&">\2<\\\/ref>\/g;s\/<ScopedName *identifier="\2"\/<ScopedName identifier="\2" ref="\1.html#&"\/g/p' $@.tmp >$@
+
+$(EXAMPLESOBJDIR)/%.widlprocxml : $(EXAMPLESDIR)/%.widl $(WIDLPROC) $(DTD) Makefile
+ mkdir -p $(dir $@)
+ $(WIDLPROC) $< >$@
+ cp $(OBJDIR)/widlprocxml.dtd $(dir $@)/
+ xmllint --noout --dtdvalid $(DTD) $@
+
+.DELETE_ON_ERROR:
+
View
@@ -0,0 +1,41 @@
+########################################################################
+# $Id$
+# Copyright 2009 Aplix Corporation. All rights reserved.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+########################################################################
+
+This examples directory contains two of the BONDI .widl files, a Makefile
+that processes them to generate html, and a .css file that the resulting
+html uses.
+
+The Makefile processes the .widl files as follows:
+
+ 1. For each .widl, generate the .widlprocxml file (an XML representation
+ of the information in the .widl) using widlproc.
+
+ 2. Validate (using xmllint) each .widlprocxml against the DTD.
+
+ 3. We want any reference in the resulting html to a type elsewhere in the
+ API to be a link. This is where we achieve this. First generate a
+ list of fqids (fully qualified identifiers) from fqid attributes in
+ the XML by running all .widlprocxml files through the style sheet
+ widlprocxmlfqids.xsl.
+
+ 4. Turn that list of fqids into a sed script that turns a <ref> to an
+ fqid into a <ref ref=".."> to the fqid in the right .html file.
+
+ 5. For each .widlprocxml file, generate a .widlprocxml2 file by running
+ it through the sed script generated above.
+
+ 6. For each .widlprocxml2 file, generate a .html file by running it through
+ the widlprocxmltohtml.xsl style sheet.
+
+See the Makefile for details.

0 comments on commit 0ed9315

Please sign in to comment.