Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Commit

Permalink
makefile: add un/install targets
Browse files Browse the repository at this point in the history
Add install, install-strip and uninstall targets, make DESTDIR usable.

PR-URL: #228
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
Umorrian authored and indutny committed Mar 16, 2015
1 parent d547f3b commit 5d414fc
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ CFLAGS_LIB = $(CFLAGS_FAST) -fPIC

LDFLAGS_LIB = $(LDFLAGS) -shared

INSTALL ?= install
PREFIX ?= $(DESTDIR)/usr/local
LIBDIR = $(PREFIX)/lib
INCLUDEDIR = $(PREFIX)/include

ifneq (darwin,$(PLATFORM))
# TODO(bnoordhuis) The native SunOS linker expects -h rather than -soname...
LDFLAGS_LIB += -Wl,-soname=$(SONAME)
Expand Down Expand Up @@ -105,6 +110,21 @@ parsertrace_g: http_parser_g.o contrib/parsertrace.c
tags: http_parser.c http_parser.h test.c
ctags $^

install: library
$(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h
$(INSTALL) -D $(SONAME) $(LIBDIR)/$(SONAME)
ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.so

install-strip: library
$(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h
$(INSTALL) -D -s $(SONAME) $(LIBDIR)/$(SONAME)
ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.so

uninstall:
rm $(INCLUDEDIR)/http_parser.h
rm $(LIBDIR)/$(SONAME)
rm $(LIBDIR)/libhttp_parser.so

clean:
rm -f *.o *.a tags test test_fast test_g \
http_parser.tar libhttp_parser.so.* \
Expand All @@ -113,4 +133,4 @@ clean:
contrib/url_parser.c: http_parser.h
contrib/parsertrace.c: http_parser.h

.PHONY: clean package test-run test-run-timed test-valgrind
.PHONY: clean package test-run test-run-timed test-valgrind install install-strip uninstall

0 comments on commit 5d414fc

Please sign in to comment.