aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit73aca81b50073109b137bba659d38af11d7194ac (patch)
treedb3b28024b3493b57e793eb072a69c9da331b8da /Makefile
parent9702d475f59435139db2b0794a26dd69937fab7c (diff)
downloadmandoc-73aca81b50073109b137bba659d38af11d7194ac.tar.gz
mandoc-73aca81b50073109b137bba659d38af11d7194ac.tar.zst
mandoc-73aca81b50073109b137bba659d38af11d7194ac.zip
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 \
+ ) > $@