Skip to content

Commit 385a6dd

Browse files
committed
resolves htacg#1 update Makefile to work with upstream (5.1.36)
- update file lists to reflect renames and additions - set tidy version when invoking compiler (read from ../../version.txt) - disable debug symbols - disable localizations - coerce options passed to API to a string (to prevent Tidy from failing) - use relative path to ../src/language.h in console/tidy.c
1 parent e9815ec commit 385a6dd

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

build/emscripten/Makefile

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ LIBDIR = ${TOPDIR}/lib
7171
BINDIR = ${TOPDIR}/bin
7272
DOCDIR = ${TOPDIR}/htmldoc
7373

74+
TIDY_VERSION = $(shell head -n 1 ../../version.txt)
75+
7476
# Note about shared library and exported symbols:
7577
# With gcc, one can control the exported symbols by either using
7678
# "-fvisibility=hidden -DTIDY_EXPORT='__attribute__((visibility("default")))'"
@@ -85,13 +87,13 @@ DOCDIR = ${TOPDIR}/htmldoc
8587
# CFLAGS etc..
8688
# For optimised builds, flags such as "-O2" should be added and -D_DEBUG=1
8789
# disabled.
88-
CC= emcc
89-
CFLAGS= -Oz -pedantic -Wall -I $(INCDIR)
90+
CC=emcc
91+
CFLAGS=-Oz -DNDEBUG -DLIBTIDY_VERSION=\"$(TIDY_VERSION)\" -DSUPPORT_LOCALIZATIONS=0 -pedantic -Wall -I $(INCDIR)
9092
# flags only supported with gcc 3.x
9193
CFLAGS += -Wunused-parameter
9294

9395
# Flags used for the generation of the js file
94-
EMFLAGS= -O3 --memory-init-file 0 --pre-js wrapper.js
96+
EMFLAGS=-O3 --memory-init-file 0 --pre-js wrapper.js
9597

9698
OTHERCFLAGS=
9799
# OTHERCFLAGS+= -fvisibility=hidden -DTIDY_EXPORT='__attribute__((visibility("default")))'
@@ -136,24 +138,26 @@ OBJFILES=\
136138
$(OBJDIR)/access$(OBJSUF) $(OBJDIR)/attrs$(OBJSUF) $(OBJDIR)/istack$(OBJSUF) \
137139
$(OBJDIR)/parser$(OBJSUF) $(OBJDIR)/tags$(OBJSUF) $(OBJDIR)/entities$(OBJSUF) \
138140
$(OBJDIR)/lexer$(OBJSUF) $(OBJDIR)/pprint$(OBJSUF) $(OBJDIR)/clean$(OBJSUF) \
139-
$(OBJDIR)/localize$(OBJSUF) $(OBJDIR)/config$(OBJSUF) $(OBJDIR)/alloc$(OBJSUF) \
141+
$(OBJDIR)/message$(OBJSUF) $(OBJDIR)/config$(OBJSUF) $(OBJDIR)/alloc$(OBJSUF) \
140142
$(OBJDIR)/attrask$(OBJSUF) $(OBJDIR)/attrdict$(OBJSUF) $(OBJDIR)/attrget$(OBJSUF) \
141143
$(OBJDIR)/buffio$(OBJSUF) $(OBJDIR)/fileio$(OBJSUF) $(OBJDIR)/streamio$(OBJSUF) \
142144
$(OBJDIR)/tagask$(OBJSUF) $(OBJDIR)/tmbstr$(OBJSUF) $(OBJDIR)/utf8$(OBJSUF) \
143-
$(OBJDIR)/tidylib$(OBJSUF) $(OBJDIR)/mappedio$(OBJSUF) $(OBJDIR)/gdoc$(OBJSUF)
145+
$(OBJDIR)/tidylib$(OBJSUF) $(OBJDIR)/mappedio$(OBJSUF) $(OBJDIR)/gdoc$(OBJSUF) \
146+
$(OBJDIR)/language$(OBJSUF)
144147

145148
CFILES= \
146149
$(SRCDIR)/access.c $(SRCDIR)/attrs.c $(SRCDIR)/istack.c \
147150
$(SRCDIR)/parser.c $(SRCDIR)/tags.c $(SRCDIR)/entities.c \
148151
$(SRCDIR)/lexer.c $(SRCDIR)/pprint.c $(SRCDIR)/clean.c \
149-
$(SRCDIR)/localize.c $(SRCDIR)/config.c $(SRCDIR)/alloc.c \
152+
$(SRCDIR)/message.c $(SRCDIR)/config.c $(SRCDIR)/alloc.c \
150153
$(SRCDIR)/attrask.c $(SRCDIR)/attrdict.c $(SRCDIR)/attrget.c \
151154
$(SRCDIR)/buffio.c $(SRCDIR)/fileio.c $(SRCDIR)/streamio.c \
152155
$(SRCDIR)/tagask.c $(SRCDIR)/tmbstr.c $(SRCDIR)/utf8.c \
153-
$(SRCDIR)/tidylib.c $(SRCDIR)/mappedio.c $(SRCDIR)/gdoc.c
156+
$(SRCDIR)/tidylib.c $(SRCDIR)/mappedio.c $(SRCDIR)/gdoc.c \
157+
$(SRCDIR)/language.c
154158

155-
HFILES= $(INCDIR)/platform.h $(INCDIR)/tidy.h $(INCDIR)/tidyenum.h \
156-
$(INCDIR)/buffio.h
159+
HFILES= $(INCDIR)/tidyplatform.h $(INCDIR)/tidy.h $(INCDIR)/tidyenum.h \
160+
$(INCDIR)/tidybuffio.h
157161

158162
LIBHFILES= \
159163
$(SRCDIR)/access.h $(SRCDIR)/attrs.h $(SRCDIR)/attrdict.h \
@@ -162,7 +166,7 @@ LIBHFILES= \
162166
$(SRCDIR)/mappedio.h $(SRCDIR)/message.h $(SRCDIR)/parser.h \
163167
$(SRCDIR)/pprint.h $(SRCDIR)/streamio.h $(SRCDIR)/tags.h \
164168
$(SRCDIR)/tmbstr.h $(SRCDIR)/utf8.h $(SRCDIR)/tidy-int.h \
165-
$(SRCDIR)/gdoc.h $(SRCDIR)/version.h
169+
$(SRCDIR)/gdoc.h $(SRCDIR)/version.h $(SRCDIR)/language.h
166170

167171

168172

build/emscripten/wrapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var tidy_html5 = function tidy_html5(text, config) {
22
FS.writeFile("input.html", text);
33
var cmdlineOptions = [];
4-
if (config) for (var i in config) cmdlineOptions.push("--"+i, config[i]);
4+
if (config) for (var i in config) cmdlineOptions.push("--"+i, String(config[i]));
55
cmdlineOptions.push("-m", "input.html");
66
Module.callMain(cmdlineOptions);
77
return FS.readFile("input.html", {encoding:"utf8"});

console/tidy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010

1111
#include "tidy.h"
12-
#include "language.h"
12+
#include "../src/language.h"
1313
#include "locale.h"
1414
#if defined(_WIN32)
1515
#include <windows.h> /* Force console to UTF8. */

0 commit comments

Comments
 (0)