1
# Makefile - for tidy - HTML parser and pretty printer
6
# $Date: 2005/04/14 16:02:35 $
9
# Copyright (c) 1998-2005 World Wide Web Consortium
10
# (Massachusetts Institute of Technology, European Research
11
# Consortium for Informatics and Mathematics, Keio University).
12
# All Rights Reserved.
14
# Contributing Author(s):
16
# Dave Raggett <dsr@w3.org>
17
# Terry Teague <terry_teague@users.sourceforge.net>
18
# Pradeep Padala<ppadala@users.sourceforge.net>
20
# The contributing author(s) would like to thank all those who
21
# helped with testing, bug fixes, and patience. This wouldn't
22
# have been possible without all of you.
26
# This software and documentation is provided "as is," and
27
# the copyright holders and contributing author(s) make no
28
# representations or warranties, express or implied, including
29
# but not limited to, warranties of merchantability or fitness
30
# for any particular purpose or that the use of the software or
31
# documentation will not infringe any third party patents,
32
# copyrights, trademarks or other rights.
34
# The copyright holders and contributing author(s) will not be
35
# liable for any direct, indirect, special or consequential damages
36
# arising out of any use of the software or documentation, even if
37
# advised of the possibility of such damage.
39
# Permission is hereby granted to use, copy, modify, and distribute
40
# this source code, or portions hereof, documentation and executables,
41
# for any purpose, without fee, subject to the following restrictions:
43
# 1. The origin of this source code must not be misrepresented.
44
# 2. Altered versions must be plainly marked as such and must
45
# not be misrepresented as being the original source.
46
# 3. This Copyright notice may not be removed or altered from any
47
# source or altered source distribution.
49
# The copyright holders and contributing author(s) specifically
50
# permit, without fee, and encourage the use of this source code
51
# as a component for supporting the Hypertext Markup Language in
52
# commercial products. If you use this source code in a product,
53
# acknowledgment is not required but would be appreciated.
60
# Installation variables. Spaces OK, only dir create and file copy operations.
61
runinst_prefix=/usr/local
62
devinst_prefix=/usr/local
64
bininst = ${runinst_prefix}/bin
65
libinst = ${devinst_prefix}/lib
66
incinst = ${devinst_prefix}/include/$(PROJECT)
67
maninst = ${devinst_prefix}/man
69
# Internal variables. - No spaces allowed: libtool chokes on spaces in directory names.
71
INCDIR = ${TOPDIR}/include
72
APPDIR = ${TOPDIR}/console
73
SRCDIR = ${TOPDIR}/src
75
LIBDIR = ${TOPDIR}/lib
76
BINDIR = ${TOPDIR}/bin
77
DOCDIR = ${TOPDIR}/htmldoc
80
# For optimised builds, flags such as "-O2" should be added and -D_DEBUG=1
83
CFLAGS= -g -Wall -Wno-switch -Wno-parentheses -I $(INCDIR)
84
# flags only supported with gcc 3.x
85
# CFLAGS += -Wunused-parameter
88
OTHERCFLAGS+= -D_DEBUG=1
89
# OTHERCFLAGS+= -DSUPPORT_ACCESSIBILITY_CHECKS=1 -DSUPPORT_UTF16_ENCODINGS=1 -DSUPPORT_ASIAN_ENCODINGS=1
90
ifdef SUPPORT_UTF16_ENCODINGS
91
CFLAGS += -DSUPPORT_UTF16_ENCODINGS=$(SUPPORT_UTF16_ENCODINGS)
93
ifdef SUPPORT_ASIAN_ENCODINGS
94
CFLAGS += -DSUPPORT_ASIAN_ENCODINGS=$(SUPPORT_ASIAN_ENCODINGS)
96
ifdef SUPPORT_ACCESSIBILITY_CHECKS
97
CFLAGS += -DSUPPORT_ACCESSIBILITY_CHECKS=$(SUPPORT_ACCESSIBILITY_CHECKS)
102
DEBUGFLAGS += -DDMALLOC
108
# Tidy lib related variables
112
# This will come from autoconf again
117
LIBRARY = $(LIBDIR)/$(LIBPREFIX)$(PROJECT)$(LIBSUFFIX)
122
EXES = $(BINDIR)/$(PROJECT) $(BINDIR)/tab2space
124
DOCS = $(DOCDIR)/quickref.html $(DOCDIR)/tidy.1 $(DOCDIR)/tidy-config.7
126
CONFIGXML = $(DOCDIR)/tidy-config.xml
127
HELPXML = $(DOCDIR)/tidy-help.xml
130
$(OBJDIR)/access$(OBJSUF) $(OBJDIR)/attrs$(OBJSUF) $(OBJDIR)/istack$(OBJSUF) \
131
$(OBJDIR)/parser$(OBJSUF) $(OBJDIR)/tags$(OBJSUF) $(OBJDIR)/entities$(OBJSUF) \
132
$(OBJDIR)/lexer$(OBJSUF) $(OBJDIR)/pprint$(OBJSUF) $(OBJDIR)/clean$(OBJSUF) \
133
$(OBJDIR)/localize$(OBJSUF) $(OBJDIR)/config$(OBJSUF) $(OBJDIR)/alloc$(OBJSUF) \
134
$(OBJDIR)/attrask$(OBJSUF) $(OBJDIR)/attrdict$(OBJSUF) $(OBJDIR)/attrget$(OBJSUF) \
135
$(OBJDIR)/buffio$(OBJSUF) $(OBJDIR)/fileio$(OBJSUF) $(OBJDIR)/streamio$(OBJSUF) \
136
$(OBJDIR)/tagask$(OBJSUF) $(OBJDIR)/tmbstr$(OBJSUF) $(OBJDIR)/utf8$(OBJSUF) \
137
$(OBJDIR)/tidylib$(OBJSUF)
140
$(SRCDIR)/access.c $(SRCDIR)/attrs.c $(SRCDIR)/istack.c \
141
$(SRCDIR)/parser.c $(SRCDIR)/tags.c $(SRCDIR)/entities.c \
142
$(SRCDIR)/lexer.c $(SRCDIR)/pprint.c $(SRCDIR)/clean.c \
143
$(SRCDIR)/localize.c $(SRCDIR)/config.c $(SRCDIR)/alloc.c \
144
$(SRCDIR)/attrask.c $(SRCDIR)/attrdict.c $(SRCDIR)/attrget.c \
145
$(SRCDIR)/buffio.c $(SRCDIR)/fileio.c $(SRCDIR)/streamio.c \
146
$(SRCDIR)/tagask.c $(SRCDIR)/tmbstr.c $(SRCDIR)/utf8.c \
149
HFILES= $(INCDIR)/platform.h $(INCDIR)/tidy.h $(INCDIR)/tidyenum.h \
150
$(INCDIR)/fileio.h $(INCDIR)/buffio.h
153
$(SRCDIR)/access.h $(SRCDIR)/attrs.h $(SRCDIR)/attrdict.h \
154
$(SRCDIR)/clean.h $(SRCDIR)/config.h $(SRCDIR)/entities.h \
155
$(SRCDIR)/forward.h $(SRCDIR)/lexer.h $(SRCDIR)/message.h \
156
$(SRCDIR)/parser.h $(SRCDIR)/pprint.h $(SRCDIR)/streamio.h \
157
$(SRCDIR)/tags.h $(SRCDIR)/tmbstr.h $(SRCDIR)/utf8.h \
161
all: $(LIBRARY) $(EXES)
165
$(LIBRARY): $(OBJFILES)
166
if [ ! -d $(LIBDIR) ]; then mkdir $(LIBDIR); fi
172
$(OBJDIR)/%$(OBJSUF): $(SRCDIR)/%.c $(HFILES) $(LIBHFILES) Makefile
173
if [ ! -d $(OBJDIR) ]; then mkdir $(OBJDIR); fi
174
$(CC) $(CFLAGS) $(OTHERCFLAGS) -o $@ -c $<
176
$(BINDIR)/$(PROJECT): $(APPDIR)/tidy.c $(HFILES) $(LIBRARY)
177
if [ ! -d $(BINDIR) ]; then mkdir $(BINDIR); fi
178
$(CC) $(CFLAGS) $(OTHERCFLAGS) -o $@ $(APPDIR)/tidy.c -I$(INCDIR) -L$(LIBDIR) -l$(PROJECT)
180
$(BINDIR)/tab2space: $(APPDIR)/tab2space.c
181
if [ ! -d $(BINDIR) ]; then mkdir $(BINDIR); fi
182
$(CC) $(CFLAGS) $(OTHERCFLAGS) -o $@ $(APPDIR)/tab2space.c $(LIBS)
184
$(HELPXML): $(BINDIR)/$(PROJECT)
185
$(BINDIR)/$(PROJECT) -xml-help > $@
187
$(CONFIGXML): $(BINDIR)/$(PROJECT)
188
$(BINDIR)/$(PROJECT) -xml-config > $@
190
$(DOCDIR)/quickref.html: $(DOCDIR)/quickref-html.xsl $(CONFIGXML)
191
$(XSLTPROC) -o $@ $(DOCDIR)/quickref-html.xsl $(CONFIGXML)
193
$(DOCDIR)/tidy.1: $(DOCDIR)/tidy1.xsl $(HELPXML)
194
$(XSLTPROC) -o $@ $(DOCDIR)/tidy1.xsl $(HELPXML)
196
$(DOCDIR)/tidy-config.7: $(DOCDIR)/quickref-man.xsl $(CONFIGXML)
197
$(XSLTPROC) -o $@ $(DOCDIR)/quickref-man.xsl $(CONFIGXML)
200
@$(MAKE) CFLAGS='$(CFLAGS) $(DEBUGFLAGS)' LIBS='$(LIBS) $(DEBUGLIBS)' all
203
rm -f $(OBJFILES) $(EXES) $(LIBRARY) $(DOCS) $(HELPXML) $(CONFIGXML) $(OBJDIR)/*.lo
204
if [ -d $(OBJDIR)/.libs ]; then rmdir $(OBJDIR)/.libs; fi
205
if [ -d $(LIBDIR)/.libs ]; then rmdir $(LIBDIR)/.libs; fi
206
if [ "$(OBJDIR)" != "$(TOPDIR)" -a -d $(OBJDIR) ]; then rmdir $(OBJDIR); fi
207
if [ "$(LIBDIR)" != "$(TOPDIR)" -a -d $(LIBDIR) ]; then rmdir $(LIBDIR); fi
208
if [ "$(BINDIR)" != "$(TOPDIR)" -a -d $(BINDIR) ]; then rmdir $(BINDIR); fi
210
installhdrs: $(HFILES)
211
if [ ! -d "$(incinst)" ]; then mkdir -p "$(incinst)"; fi
212
cp -f $(HFILES) "$(incinst)/"
214
installib: $(LIBRARY)
215
if [ ! -d "$(libinst)" ]; then mkdir -p "$(libinst)"; fi
216
cp -f $(LIBRARY) "$(libinst)/"
219
if [ ! -d "$(bininst)" ]; then mkdir -p "$(bininst)"; fi
220
cp -f $(EXES) "$(bininst)/"
222
installmanpage: $(DOCDIR)/tidy.1 $(DOCDIR)/tidy-config.7
223
if [ ! -d "$(maninst)/man1" ]; then mkdir -p "$(maninst)/man1"; fi;
224
if [ ! -d "$(maninst)/man7" ]; then mkdir -p "$(maninst)/man7"; fi;
225
cp -f $(DOCDIR)/tidy.1 "$(maninst)/man1/tidy.1";
226
cp -f $(DOCDIR)/tidy-config.7 "$(maninst)/man7/tidy-config.7";
228
install: installhdrs installib installmanpage installexes