1########################################################################
2# $Id: Makefile 418 2010-06-16 15:26:51Z tpr $
3# Copyright 2009 Aplix Corporation. All rights reserved.
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#     http://www.apache.org/licenses/LICENSE-2.0
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13########################################################################
14
15UNAME = $(shell uname)
16VALIDTESTDIR = valid/idl
17VALIDTESTREFDIR = valid/xml
18VALIDTESTOBJDIR = valid/obj
19INVALIDTESTDIR = invalid/idl
20INVALIDTESTREFDIR = invalid/error
21INVALIDTESTOBJDIR = invalid/obj
22
23# The settings of SRCDIR (where to find the xsl style sheets), OBJDIR (where to
24# find widlproc and widlprocxml.dtd) and VALDTESTOBJDIR (where to put the
25# resulting XML files) reflect the directory
26# structure of the released widlproc.zip file when unzipped. ../Makefile calls
27# this Makefile with these settings overridden to reflect the directory
28# structure in svn.
29SRCDIR = ..
30OBJDIR = ..
31
32########################################################################
33# Linux configuration
34#
35ifneq (,$(filter Linux%, $(UNAME)))
36
37EXESUFFIX =
38
39else
40########################################################################
41# Darwin configuration
42#
43ifneq (,$(filter Darwin%, $(UNAME)))
44
45EXESUFFIX =
46
47else
48########################################################################
49# Windows (cygwin but using MS compiler) configuration
50#
51ifneq (,$(filter CYGWIN%, $(UNAME)))
52
53EXESUFFIX = .exe
54
55endif
56endif
57endif
58
59########################################################################
60# Common makefile
61#
62WIDLPROC = $(OBJDIR)/widlproc$(EXESUFFIX)
63DTD = $(OBJDIR)/widlprocxml.dtd
64
65VALID_WIDLS = $(patsubst $(VALIDTESTDIR)/%, %, $(wildcard $(VALIDTESTDIR)/*.widl))
66INVALID_WIDLS = $(patsubst $(INVALIDTESTDIR)/%, %, $(wildcard $(INVALIDTESTDIR)/*.widl))
67
68test : $(patsubst %.widl, $(VALIDTESTOBJDIR)/%.widlprocxml, $(VALID_WIDLS)) $(patsubst %.widl, $(INVALIDTESTOBJDIR)/%.txt, $(INVALID_WIDLS)) $(WIDLPROC)
69	@echo "$@ pass"
70
71#$(EXAMPLESOBJDIR)/%.html : $(EXAMPLESOBJDIR)/%.widlprocxml $(SRCDIR)/widlprocxmltohtml.xsl Makefile
72#	cp $(SRCDIR)/widlprocxmltohtml.xsl $(dir $@)/
73#	xsltproc $(dir $@)/widlprocxmltohtml.xsl $< >$@
74
75
76$(VALIDTESTOBJDIR)/%.widlprocxml : $(VALIDTESTDIR)/%.widl $(WIDLPROC) $(DTD) Makefile $(patsubst %.widl, $(VALIDTESTREFDIR)/%.widlprocxml, $(VALID_WIDLS))
77	mkdir -p $(dir $@)
78	$(WIDLPROC) $< >$@
79	cp $(OBJDIR)/widlprocxml.dtd $(dir $@)/
80	xmllint --noout --dtdvalid $(DTD) $@
81	diff $@ $(VALIDTESTREFDIR)/`basename $@`
82
83$(INVALIDTESTOBJDIR)/%.txt : $(INVALIDTESTDIR)/%.widl $(WIDLPROC) Makefile $(patsubst %.widl, $(INVALIDTESTREFDIR)/%.txt, $(INVALID_WIDLS))
84	mkdir -p $(dir $@)
85	-$(WIDLPROC) $<  >$@ 2>&1
86	diff $@ $(INVALIDTESTREFDIR)/`basename $@`
87
88
89
90.DELETE_ON_ERROR:
91
92