diff --git a/Makefile b/Makefile
index d4d536b..d6fc20e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
 VERSION = 1.1.0
-CFLAGS += -g -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
+override CFLAGS += $(shell pkg-config --cflags libbsd-overlay)
+override LDFLAGS += $(shell pkg-config --libs libbsd-overlay)
 WWWPREFIX = /var/www/vhosts/mdocml.bsd.lv/htdocs/docbook2mdoc
 PREFIX = /usr/local
 
@@ -11,7 +12,7 @@ DISTFILES = Makefile NEWS docbook2mdoc.1
 all: docbook2mdoc
 
 docbook2mdoc: $(OBJS)
-	$(CC) -g -o $@ $(OBJS)
+	$(CC) -g -o $@ $(OBJS) $(LDFLAGS)
 
 statistics: statistics.o xmalloc.o
 	$(CC) -g -o $@ statistics.o xmalloc.o
@@ -20,9 +21,9 @@ www: docbook2mdoc.1.html docbook2mdoc-$(VERSION).tgz README.txt
 
 install: all
 	mkdir -p $(DESTDIR)$(PREFIX)/bin
-	mkdir -p $(DESTDIR)$(PREFIX)/man/man1
+	mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1
 	install -m 0755 docbook2mdoc $(DESTDIR)$(PREFIX)/bin
-	install -m 0444 docbook2mdoc.1 $(DESTDIR)$(PREFIX)/man/man1
+	install -m 0444 docbook2mdoc.1 $(DESTDIR)$(PREFIX)/share/man/man1
 
 installwww: www
 	mkdir -p $(WWWPREFIX)/snapshots
