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
19CC = i686-w64-mingw32-gcc
20CXX = i686-w64-mingw32-g++
21STRIP = i686-w64-mingw32-strip
22
23help:
24	@echo "Type 'make doc' to make the documentation"
25	@echo "Type 'make blahtex-mingw' to make blahtex for Linux"
26	@echo "Type 'make blahtexml-mingw' to make blahtexml for Linux"
27
28SOURCES = \
29	Source/main.cpp \
30	Source/mainPng.cpp \
31	Source/md5.c \
32	Source/md5Wrapper.cpp \
33	Source/Messages.cpp \
34	Source/UnicodeConverter.cpp \
35	Source/BlahtexCore/InputSymbolTranslation.cpp \
36	Source/BlahtexCore/Interface.cpp \
37	Source/BlahtexCore/LayoutTree.cpp \
38	Source/BlahtexCore/MacroProcessor.cpp \
39	Source/BlahtexCore/Manager.cpp \
40	Source/BlahtexCore/Parser.cpp \
41	Source/BlahtexCore/ParseTree1.cpp \
42	Source/BlahtexCore/ParseTree2.cpp \
43	Source/BlahtexCore/ParseTree3.cpp \
44	Source/BlahtexCore/MathmlNode.cpp \
45	Source/BlahtexCore/Token.cpp \
46	Source/BlahtexCore/XmlEncode.cpp
47
48SOURCES_XMLIN = $(SOURCES) \
49	Source/BlahtexXMLin/AttributesImpl.cpp \
50	Source/BlahtexXMLin/BlahtexFilter.cpp \
51	Source/BlahtexXMLin/SAX2Output.cpp \
52	Source/BlahtexXMLin/XercesString.cpp
53
54HEADERS = \
55	Source/mainPng.h \
56	Source/md5.h \
57	Source/md5Wrapper.h \
58	Source/UnicodeConverter.h \
59	Source/BlahtexCore/InputSymbolTranslation.h \
60	Source/BlahtexCore/Interface.h \
61	Source/BlahtexCore/LayoutTree.h \
62	Source/BlahtexCore/MacroProcessor.h \
63	Source/BlahtexCore/Manager.h \
64	Source/BlahtexCore/Misc.h \
65	Source/BlahtexCore/Parser.h \
66	Source/BlahtexCore/ParseTree.h \
67	Source/BlahtexCore/MathmlNode.h \
68	Source/BlahtexCore/Token.h \
69	Source/BlahtexCore/XmlEncode.h
70
71HEADERS_XMLIN = $(HEADERS) \
72	Source/BlahtexXMLin/AttributesImpl.h \
73	Source/BlahtexXMLin/BlahtexFilter.h \
74	Source/BlahtexXMLin/SAX2Output.h \
75	Source/BlahtexXMLin/XercesString.h
76
77BINDIR = bin-blahtex
78
79$(BINDIR):
80	mkdir -p $(BINDIR)
81
82BINDIR_XMLIN = bin-blahtexml
83
84$(BINDIR_XMLIN):
85	mkdir -p $(BINDIR_XMLIN)
86
87OBJECTS = $(addprefix $(BINDIR)/, $(notdir $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SOURCES)))))
88
89OBJECTS_XMLIN = $(addprefix $(BINDIR_XMLIN)/, $(notdir $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SOURCES_XMLIN)))))
90
91Source/BlahtexCore/InputSymbolTranslation.inc: Source/BlahtexCore/InputSymbolTranslation.xml
92	xsltproc -o $@ Source/BlahtexCore/ISTtoCpp.xslt $<
93
94Source/BlahtexCore/InputSymbolTranslation.cpp: Source/BlahtexCore/InputSymbolTranslation.inc
95
96$(BINDIR)/InputSymbolTranslation.o: InputSymbolTranslation.cpp InputSymbolTranslation.inc
97
98$(BINDIR_XMLIN)/InputSymbolTranslation.o: InputSymbolTranslation.cpp InputSymbolTranslation.inc
99
100CFLAGS = -O2 -DWCHAR_T_IS_16BIT -DWIN32_CODECONV -Wno-deprecated-declarations
101
102VPATH = Source:Source/BlahtexCore:Source/BlahtexXMLin
103
104INCLUDES=-I. -ISource -ISource/BlahtexCore -ISource/BlahtexXMLin
105
106$(BINDIR)/%.o:%.cpp
107	$(CXX) $(INCLUDES) $(CFLAGS) -c $< -o $@
108
109$(BINDIR)/%.o:%.c
110	$(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
111
112$(BINDIR_XMLIN)/%.o:%.cpp
113	$(CXX) $(INCLUDES) $(CFLAGS) -DBLAHTEXML_USING_XERCES -c $< -o $@
114
115$(BINDIR_XMLIN)/%.o:%.c
116	$(CC) $(INCLUDES) $(CFLAGS) -DBLAHTEXML_USING_XERCES -c $< -o $@
117
118blahtex-mingw:  $(BINDIR) $(OBJECTS)  $(HEADERS)
119	$(CXX) $(CFLAGS) -o blahtex.exe $(OBJECTS)
120	$(STRIP) -g blahtex.exe
121
122blahtexml-mingw:  $(BINDIR_XMLIN) $(OBJECTS_XMLIN)  $(HEADERS_XMLIN)
123	$(CXX) $(CFLAGS) -o blahtexml.exe $(OBJECTS_XMLIN) -lxerces-c
124	$(STRIP) -g blahtexml.exe
125
126clean:
127	rm -f blahtex $(OBJECTS) blahtexml $(OBJECTS_XMLIN)
128
129# Documentation
130
131doc: Documentation/manual.pdf
132
133Documentation/manual.pdf: Documentation/manual.tex Documentation/InputSymbolTranslation.tex
134	cd Documentation ; pdflatex manual
135	cd Documentation ; pdflatex manual
136
137Documentation/InputSymbolTranslation.tex: Source/BlahtexCore/InputSymbolTranslation.xml
138	xsltproc -o $@ Documentation/ISTtoTeX.xslt $<
139
140########## end of file ##########
141