From a663db757fe3217bfa4a6b99aaa8bb0f67b20ba6 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 24 Nov 2011 11:45:44 +0100 Subject: build: install target --- Makefile | 29 ++++++++++++++++++++++++++++- README | 8 +++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 63987bb..3aa24c7 100644 --- a/Makefile +++ b/Makefile @@ -3,12 +3,29 @@ ABI_VERSION := 0 SONAME := libuniso.so.$(ABI_VERSION) -TARGETS := libuniso.a uniso +progs-y += uniso + +INCLUDES := uniso.h +TARGETS := libuniso.a $(progs-y) CFLAGS ?= -g -Wall -Werror CFLAGS += -fPIC CFLAGS += -I. + +prefix ?= /usr +libdir = $(prefix)/lib +bindir = $(prefix)/bin +includedir= $(prefix)/include + +INSTALLDIR := install -d +INSTALL := install + +install-progs-y := $(INSTALLDIR) $(DESTDIR)$(bindir) && \ + $(INSTALL) $(progs-y) $(DESTDIR)$(bindir) +install-libs-y := $(INSTALLDIR) $(DESTDIR)$(libdir) && \ + $(INSTALL) libuniso.a $(DESTDIR)$(libdir) + libuniso.a_OBJS = libuniso.o $(SONAME)_OBJS = $(libuniso.a_OBJS) @@ -21,6 +38,9 @@ all: $(TARGETS) ifneq ($(ENABLE_SHARED_LIB),) shlibs-y += $(SONAME) libuniso.so +install-shlibs-y := $(INSTALLDIR) $(DESTDIR)$(libdir) && \ + $(INSTALL) $(SONAME) $(DESTDIR)$(libdir) && \ + ln -sf $(SONAME) $(DESTDIR)$(libdir)/libuniso.so uniso_LIBS := -luniso else uniso_LIBS := libuniso.a @@ -49,3 +69,10 @@ clean: shared: $(SONAME) +install: $(TARGETS) $(INCLUDES) + $(INSTALLDIR) $(DESTDIR)$(includedir) + $(INSTALL) $(INCLUDES) $(DESTDIR)$(includedir) + $(install-progs-y) + $(install-libs-y) + $(install-shlibs-y) + diff --git a/README b/README index 2a39bce..ff18ac2 100644 --- a/README +++ b/README @@ -6,5 +6,11 @@ To build: To build with shared library: - make ENABLE_SHARED_LIB=yes + echo "ENABLE_SHARED_LIB=yes" > config.mk + make + +To install: + + make install + -- cgit v1.2.3