summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile29
-rw-r--r--README8
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
+