1# blahtex: a TeX to MathML converter designed with MediaWiki in mind
2# blahtexml: an extension of blahtex with XML processing in mind
3# http://gva.noekeon.org/blahtexml
4#
5# Copyright (c) 2006, David Harvey
6# Copyright (c) 2010, Gilles Van Assche
7# All rights reserved.
8#
9# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
10#
11#     * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
12#     * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
13#     * Neither the names of the authors nor the names of their affiliation may be used to endorse or promote products derived from this software without specific prior written permission.
14#
15# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16
17.PHONY: help
18
19help:
20	@echo "Type 'make doc' to make the documentation"
21	@echo "Type 'make blahtex-linux' to make blahtex for Linux"
22	@echo "Type 'make blahtexml-linux' to make blahtexml for Linux"
23	@echo "Type 'make blahtex-mac' to make blahtex for Mac"
24	@echo "Type 'make blahtexml-mac' to make blahtexml for Mac"
25
26SOURCES = \
27	Source/main.cpp \
28	Source/mainPng.cpp \
29	Source/md5.c \
30	Source/md5Wrapper.cpp \
31	Source/Messages.cpp \
32	Source/UnicodeConverter.cpp \
33	Source/BlahtexCore/InputSymbolTranslation.cpp \
34	Source/BlahtexCore/Interface.cpp \
35	Source/BlahtexCore/LayoutTree.cpp \
36	Source/BlahtexCore/MacroProcessor.cpp \
37	Source/BlahtexCore/Manager.cpp \
38	Source/BlahtexCore/Parser.cpp \
39	Source/BlahtexCore/ParseTree1.cpp \
40	Source/BlahtexCore/ParseTree2.cpp \
41	Source/BlahtexCore/ParseTree3.cpp \
42	Source/BlahtexCore/MathmlNode.cpp \
43	Source/BlahtexCore/Token.cpp \
44	Source/BlahtexCore/XmlEncode.cpp
45
46SOURCES_XMLIN = $(SOURCES) \
47	Source/BlahtexXMLin/AttributesImpl.cpp \
48	Source/BlahtexXMLin/BlahtexFilter.cpp \
49	Source/BlahtexXMLin/SAX2Output.cpp \
50	Source/BlahtexXMLin/XercesString.cpp
51
52HEADERS = \
53	Source/mainPng.h \
54	Source/md5.h \
55	Source/md5Wrapper.h \
56	Source/UnicodeConverter.h \
57	Source/BlahtexCore/InputSymbolTranslation.h \
58	Source/BlahtexCore/Interface.h \
59	Source/BlahtexCore/LayoutTree.h \
60	Source/BlahtexCore/MacroProcessor.h \
61	Source/BlahtexCore/Manager.h \
62	Source/BlahtexCore/Misc.h \
63	Source/BlahtexCore/Parser.h \
64	Source/BlahtexCore/ParseTree.h \
65	Source/BlahtexCore/MathmlNode.h \
66	Source/BlahtexCore/Token.h \
67	Source/BlahtexCore/XmlEncode.h
68
69HEADERS_XMLIN = $(HEADERS) \
70	Source/BlahtexXMLin/AttributesImpl.h \
71	Source/BlahtexXMLin/BlahtexFilter.h \
72	Source/BlahtexXMLin/SAX2Output.h \
73	Source/BlahtexXMLin/XercesString.h
74
75BINDIR = bin-blahtex
76
77$(BINDIR):
78	mkdir -p $(BINDIR)
79
80BINDIR_XMLIN = bin-blahtexml
81
82$(BINDIR_XMLIN):
83	mkdir -p $(BINDIR_XMLIN)
84
85OBJECTS = $(addprefix $(BINDIR)/, $(notdir $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SOURCES)))))
86
87OBJECTS_XMLIN = $(addprefix $(BINDIR_XMLIN)/, $(notdir $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SOURCES_XMLIN)))))
88
89Source/BlahtexCore/InputSymbolTranslation.inc: Source/BlahtexCore/InputSymbolTranslation.xml
90	xsltproc -o $@ Source/BlahtexCore/ISTtoCpp.xslt $<
91
92Source/BlahtexCore/InputSymbolTranslation.cpp: Source/BlahtexCore/InputSymbolTranslation.inc
93
94$(BINDIR)/InputSymbolTranslation.o: InputSymbolTranslation.cpp InputSymbolTranslation.inc
95
96$(BINDIR_XMLIN)/InputSymbolTranslation.o: InputSymbolTranslation.cpp InputSymbolTranslation.inc
97
98CFLAGS = -O2
99
100VPATH = Source:Source/BlahtexCore:Source/BlahtexXMLin
101
102INCLUDES=-I. -ISource -ISource/BlahtexCore -ISource/BlahtexXMLin
103
104$(BINDIR)/%.o:%.cpp
105	$(CXX) $(INCLUDES) $(CFLAGS) -c $< -o $@
106
107$(BINDIR)/%.o:%.c
108	$(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
109
110$(BINDIR_XMLIN)/%.o:%.cpp
111	$(CXX) $(INCLUDES) $(CFLAGS) -DBLAHTEXML_USING_XERCES -c $< -o $@
112
113$(BINDIR_XMLIN)/%.o:%.c
114	$(CC) $(INCLUDES) $(CFLAGS) -DBLAHTEXML_USING_XERCES -c $< -o $@
115
116blahtex-linux:  $(BINDIR) $(OBJECTS)  $(HEADERS)
117	$(CXX) $(CFLAGS) -o blahtex $(OBJECTS)
118
119blahtex-mac: $(BINDIR) $(OBJECTS)  $(HEADERS)
120	$(CXX) $(CFLAGS) -o blahtex -liconv $(OBJECTS)
121
122blahtexml-linux:  $(BINDIR_XMLIN) $(OBJECTS_XMLIN)  $(HEADERS_XMLIN)
123	$(CXX) $(CFLAGS) $(LDFLAGS) -o blahtexml $(OBJECTS_XMLIN) -lxerces-c
124
125blahtexml-mac: $(BINDIR_XMLIN) $(OBJECTS_XMLIN)  $(HEADERS_XMLIN)
126	$(CXX) $(CFLAGS) -o blahtexml -liconv $(OBJECTS_XMLIN) -lxerces-c
127
128clean:
129	rm -f blahtex $(OBJECTS) blahtexml $(OBJECTS_XMLIN)
130
131# Documentation
132
133doc: Documentation/manual.pdf
134
135Documentation/manual.pdf: Documentation/manual.tex Documentation/InputSymbolTranslation.tex
136	cd Documentation ; pdflatex manual
137	cd Documentation ; pdflatex manual
138
139Documentation/InputSymbolTranslation.tex: Source/BlahtexCore/InputSymbolTranslation.xml
140	xsltproc -o $@ Documentation/ISTtoTeX.xslt $<
141
142########## end of file ##########
143