[BACK]Return to Makefile CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / docbook2mdoc

File: [cvsweb.bsd.lv] / docbook2mdoc / Makefile (download)

Revision 1.21, Thu Mar 28 12:21:10 2019 UTC (5 years ago) by schwarze
Branch: MAIN
Changes since 1.20: +1 -1 lines

The expat library aborts parsing as soon as it encounters invalid
input, and the basic design of the library practically precludes
fixing it.  However, whether the input is well-formed XML or not
is totally irrelevant, and in fact, i have seen real-world documents
from X.org that expat rejects as not well-formed.  Kristaps reports
the same from OpenGL.

We really want to parse *ANYTHING* whatsoever without ever throwing
a fatal error - after all, the point is to convert legacy documents
to a better format, and nitpicking about the syntax merely alienates
users (including myself).

Consequently, ditch expat and write a parser from scratch, optimized
for robustness on invalid input.

Oh, and by the way, it only requires 200 lines of code,
compared to 15,000 lines in expat - an economy of 98.5%
at the sime time as being much more useful in practice.

VERSION = 0.0.9
CFLAGS += -g -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
WWWPREFIX = /usr/vhosts/mdocml.bsd.lv/www/htdocs/docbook2mdoc
PREFIX = /usr/local

HEADS =	node.h parse.h macro.h format.h
SRCS =	node.c parse.c macro.c docbook2mdoc.c main.c
OBJS =	node.o parse.o macro.o docbook2mdoc.o main.o

all: docbook2mdoc

docbook2mdoc: $(OBJS)
	$(CC) -o $@ $(OBJS)

www: index.html docbook2mdoc.1.html docbook2mdoc-$(VERSION).tgz README.txt

install: all
	mkdir -p $(DESTDIR)$(PREFIX)/bin
	mkdir -p $(DESTDIR)$(PREFIX)/man/man1
	install -m 0755 docbook2mdoc $(DESTDIR)$(PREFIX)/bin
	install -m 0444 docbook2mdoc.1 $(DESTDIR)$(PREFIX)/man/man1

installwww: www
	mkdir -p $(WWWPREFIX)/snapshots
	install -m 0444 index.html docbook2mdoc.1.html README.txt $(WWWPREFIX)
	install -m 0444 docbook2mdoc-$(VERSION).tgz $(WWWPREFIX)/snapshots
	install -m 0444 docbook2mdoc-$(VERSION).tgz $(WWWPREFIX)/snapshots/docbook2mdoc.tgz

dist: docbook2mdoc-$(VERSION).tgz

docbook2mdoc-$(VERSION).tgz:
	mkdir -p .dist/docbook2mdoc-$(VERSION)
	install -m 0444 $(HEADS) $(SRCS) Makefile docbook2mdoc.1 \
	    .dist/docbook2mdoc-$(VERSION)
	(cd .dist && tar zcf ../$@ docbook2mdoc-$(VERSION))
	rm -rf .dist

node.o: node.h
parse.o: node.h parse.h
macro.o: node.h macro.h
docbook2mdoc.o: node.h macro.h format.h
main.o: node.h parse.h format.h

index.html: index.xml
	sed "s!@VERSION@!$(VERSION)!g" index.xml >$@

docbook2mdoc.1.html: docbook2mdoc.1
	mandoc -Thtml docbook2mdoc.1 >$@

README.txt: README
	cp README $@

clean:
	rm -f docbook2mdoc $(OBJS) docbook2mdoc.core
	rm -rf docbook2mdoc.dSYM
	rm -f index.html docbook2mdoc.1.html README.txt
	rm -f docbook2mdoc-$(VERSION).tgz