summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-01-01 17:14:26 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-01-01 17:14:26 +0000
commit92f665747e9d9aecac7c203e53d4eb175e662fc8 (patch)
tree343b938cade639d1cbcc09a9a00911f2789ee947 /Makefile
parent21ddc0a002b54301ac9de5f6dd73928ed0d73a94 (diff)
downloadmandoc-92f665747e9d9aecac7c203e53d4eb175e662fc8.tar.gz
Big check-in of compatibility layer. This should work on most major architectures. Thanks to Joerg Sonnenberger.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 25 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 1ee8b325..09602188 100644
--- a/Makefile
+++ b/Makefile
@@ -13,9 +13,9 @@ INSTALL_MAN = $(INSTALL_DATA)
VERSION = 1.9.14
VDATE = 16 November 2009
-VFLAGS = -DVERSION="\"$(VERSION)\""
-CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings -g
-CFLAGS += $(VFLAGS)
+VFLAGS = -DVERSION="\"$(VERSION)\"" -DHAVE_CONFIG_H
+WFLAGS = -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
+CFLAGS += -g $(VFLAGS) $(WFLAGS)
#CFLAGS += -DOSNAME="\"OpenBSD 4.5\""
LINTFLAGS += $(VFLAGS)
@@ -74,11 +74,13 @@ TARGZS = mdocml-$(VERSION).tar.gz
MANS = mandoc.1 mdoc.3 mdoc.7 manuals.7 mandoc_char.7 \
man.7 man.3
BINS = mandoc
+TESTS = test-strlcat.c test-strlcpy.c
+CONFIGS = config.h.pre config.h.post
CLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) \
$(TARGZS) tags $(MD5S) $(XMLS) $(TEXTS) $(GSGMLS) \
- $(GHTMLS)
+ $(GHTMLS) config.h config.log
INSTALL = $(SRCS) $(HEADS) Makefile $(MANS) $(SGMLS) $(STATICS) \
- $(DATAS) $(XSLS) $(EXAMPLES)
+ $(DATAS) $(XSLS) $(EXAMPLES) $(TESTS) $(CONFIGS)
all: $(BINS)
@@ -123,6 +125,8 @@ uninstall:
rm -f $(MANDIR)/man7/man.7
rm -f $(EXAMPLEDIR)/example.style.css
+$(OBJS): config.h
+
man_macro.ln: man_macro.c libman.h
man_macro.o: man_macro.c libman.h
@@ -254,3 +258,19 @@ mandoc: $(MAINOBJS) libmdoc.a libman.a
.tar.gz.md5:
md5 $< > $@
+
+config.h: config.h.pre config.h.post
+ rm -f config.log
+ ( cat config.h.pre; \
+ echo; \
+ if $(CC) $(CFLAGS) -c test-strlcat.c >> config.log 2>&1; then \
+ echo '#define HAVE_STRLCAT'; \
+ rm test-strlcat.o; \
+ fi; \
+ if $(CC) $(CFLAGS) -c test-strlcpy.c >> config.log 2>&1; then \
+ echo '#define HAVE_STRLCPY'; \
+ rm test-strlcpy.o; \
+ fi; \
+ echo; \
+ cat config.h.post \
+ ) > $@