Do not use -Werror because new compilers may include new warnings that the
developer may not have anticipated.

Use -dynamiclib on macOS instead of -shared.

Fix the library target so that it only rebuilds the library if needed.

Do not use install's -D option which is a GNU extension not supported on macOS.

Mark the library target as phony.
--- Makefile.orig	2018-03-31 01:07:55.000000000 -0500
+++ Makefile	2018-10-04 12:34:00.000000000 -0500
@@ -52,13 +52,17 @@
 CPPFLAGS_FAST += $(CPPFLAGS_FAST_EXTRA)
 CPPFLAGS_BENCH = $(CPPFLAGS_FAST)
 
-CFLAGS += -Wall -Wextra -Werror
+CFLAGS += -Wall -Wextra
 CFLAGS_DEBUG = $(CFLAGS) -O0 -g $(CFLAGS_DEBUG_EXTRA)
 CFLAGS_FAST = $(CFLAGS) -O3 $(CFLAGS_FAST_EXTRA)
 CFLAGS_BENCH = $(CFLAGS_FAST) -Wno-unused-parameter
 CFLAGS_LIB = $(CFLAGS_FAST) -fPIC
 
+ifeq (darwin,$(PLATFORM))
+LDFLAGS_LIB = $(LDFLAGS) -dynamiclib
+else
 LDFLAGS_LIB = $(LDFLAGS) -shared
+endif
 
 INSTALL ?= install
 PREFIX ?= /usr/local
@@ -109,8 +113,9 @@
 libhttp_parser.o: http_parser.c http_parser.h Makefile
 	$(CC) $(CPPFLAGS_FAST) $(CFLAGS_LIB) -c http_parser.c -o libhttp_parser.o
 
-library: libhttp_parser.o
-	$(CC) $(LDFLAGS_LIB) -o $(LIBNAME) $<
+library: $(LIBNAME)
+$(LIBNAME): libhttp_parser.o
+	$(CC) $(LDFLAGS_LIB) -o $@ $<
 
 package: http_parser.o
 	$(AR) rcs libhttp_parser.a http_parser.o
@@ -131,14 +136,14 @@
 	ctags $^
 
 install: library
-	$(INSTALL) -D  http_parser.h $(DESTDIR)$(INCLUDEDIR)/http_parser.h
-	$(INSTALL) -D $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME)
+	$(INSTALL) -c  http_parser.h $(DESTDIR)$(INCLUDEDIR)/http_parser.h
+	$(INSTALL) -c $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME)
 	ln -s $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SONAME)
 	ln -s $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SOLIBNAME).$(SOEXT)
 
 install-strip: library
-	$(INSTALL) -D  http_parser.h $(DESTDIR)$(INCLUDEDIR)/http_parser.h
-	$(INSTALL) -D -s $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME)
+	$(INSTALL) -c  http_parser.h $(DESTDIR)$(INCLUDEDIR)/http_parser.h
+	$(INSTALL) -c -s $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME)
 	ln -s $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SONAME)
 	ln -s $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SOLIBNAME).$(SOEXT)
 
@@ -157,4 +162,4 @@
 contrib/url_parser.c:	http_parser.h
 contrib/parsertrace.c:	http_parser.h
 
-.PHONY: clean package test-run test-run-timed test-valgrind install install-strip uninstall
+.PHONY: clean library package test-run test-run-timed test-valgrind install install-strip uninstall