summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authoryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>2014-03-12 14:51:59 (GMT)
committeryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>2014-03-12 14:51:59 (GMT)
commita9d8640c1f3898cd47eb1faf22db013e8b9911db (patch)
treebf8993759a1f9685751dec833f206aee2e811348 /Makefile
parent69dc85b8abe78246bea91a5ba1205e4c07b96a97 (diff)
downloadlz4-a9d8640c1f3898cd47eb1faf22db013e8b9911db.zip
lz4-a9d8640c1f3898cd47eb1faf22db013e8b9911db.tar.gz
lz4-a9d8640c1f3898cd47eb1faf22db013e8b9911db.tar.bz2
Makefile : library correctly compiled with -O3 switch (issue 114)
Makefile : library compilation compatible with clang Makefile : library is versioned and linked (issue 119) lz4.h : no more static inline prototypes (issue 116) man : improved header/footer (issue 111) Makefile : Use system default $(CC) & $(MAKE) variables (issue 112) xxhash : updated to r34 git-svn-id: https://lz4.googlecode.com/svn/trunk@114 650e7d94-2a16-8b24-b05c-7c0b3f6821cd
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile29
1 files changed, 20 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index a24e503..380e1fe 100644
--- a/Makefile
+++ b/Makefile
@@ -30,11 +30,16 @@
# - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
# ################################################################
-RELEASE=r113
+export RELEASE=r114
+LIBVER_MAJOR=1
+LIBVER_MINOR=0
+LIBVER_PATCH=0
+LIBVER=$(LIBVER_MAJOR).$(LIBVER_MINOR).$(LIBVER_PATCH)
+
DESTDIR=
PREFIX=/usr
-CC=gcc
-CFLAGS+= -I. -std=c99 -Wall -W -Wundef -DLZ4_VERSION=\"$(RELEASE)\"
+CC:=$(CC)
+CFLAGS+= -I. -std=c99 -O3 -Wall -W -Wundef -DLZ4_VERSION=\"$(RELEASE)\"
LIBDIR=$(PREFIX)/lib
INCLUDEDIR=$(PREFIX)/include
@@ -62,34 +67,38 @@ SOURCES = $(TEXT) $(NONTEXT)
default: liblz4
- @cd $(PRGDIR); make
+ @cd $(PRGDIR); $(MAKE) -e
all: liblz4 lz4programs
liblz4: liblz4.a liblz4.so
lz4programs: lz4.c lz4hc.c
- @cd $(PRGDIR); make all
+ @cd $(PRGDIR); $(MAKE) -e all
liblz4.a: lz4.c lz4hc.c
- $(CC) -O3 -c $(CFLAGS) $^
+ $(CC) $(CFLAGS) -c $^
ar rcs liblz4.a lz4.o lz4hc.o
liblz4.so: lz4.c lz4hc.c
- $(CC) -shared -fPIC -Wl,--soname=liblz4.so.1 $(CFLAGS) $^ -o $@
+ $(CC) $(CFLAGS) -shared $^ -fPIC -Wl,-soname=liblz4.so.$(LIBVER_MAJOR) -o $@.$(LIBVER)
+ @ln -s $@.$(LIBVER) $@.$(LIBVER_MAJOR)
+ @ln -s $@.$(LIBVER) $@
clean:
- @rm -f core *.o *.a *.so $(DISTRIBNAME)
+ @rm -f core *.o *.a *.so *.so.* $(DISTRIBNAME)
@cd $(PRGDIR); make clean
@echo Cleaning completed
-#ifeq ($(shell uname),Linux)
+#make install option is reserved to Linux & OSX targets
ifneq (,$(filter $(shell uname),Linux Darwin))
install: liblz4
@install -d -m 755 $(DESTDIR)$(LIBDIR)/ $(DESTDIR)$(INCLUDEDIR)/
@install -m 755 liblz4.a $(DESTDIR)$(LIBDIR)/liblz4.a
+ @install -m 755 liblz4.so.$(LIBVER) $(DESTDIR)$(LIBDIR)/liblz4.so.$(LIBVER)
+ @install -m 755 liblz4.so.$(LIBVER_MAJOR) $(DESTDIR)$(LIBDIR)/liblz4.so.$(LIBVER_MAJOR)
@install -m 755 liblz4.so $(DESTDIR)$(LIBDIR)/liblz4.so
@install -m 755 lz4.h $(DESTDIR)$(INCLUDEDIR)/lz4.h
@install -m 755 lz4hc.h $(DESTDIR)$(INCLUDEDIR)/lz4hc.h
@@ -98,6 +107,8 @@ install: liblz4
uninstall:
[ -x $(DESTDIR)$(LIBDIR)/liblz4.a ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.a
+ [ -x $(DESTDIR)$(LIBDIR)/liblz4.so.$(LIBVER) ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.so.$(LIBVER)
+ [ -x $(DESTDIR)$(LIBDIR)/liblz4.so.$(LIBVER_MAJOR) ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.so.$(LIBVER_MAJOR)
[ -x $(DESTDIR)$(LIBDIR)/liblz4.so ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.so
[ -f $(DESTDIR)$(INCLUDEDIR)/lz4.h ] && rm -f $(DESTDIR)$(INCLUDEDIR)/lz4.h
[ -f $(DESTDIR)$(INCLUDEDIR)/lz4hc.h ] && rm -f $(DESTDIR)$(INCLUDEDIR)/lz4hc.h