add a flag to disable static libs

This commit is contained in:
Mike Frysinger 2016-09-22 23:59:02 -04:00
parent 1ca408105d
commit 43b631223b

View File

@ -40,6 +40,7 @@ LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT))
LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT)) LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT))
LIBVER := $(shell echo $(LIBVER_SCRIPT)) LIBVER := $(shell echo $(LIBVER_SCRIPT))
BUILD_STATIC:= yes
DESTDIR?= DESTDIR?=
PREFIX ?= /usr/local PREFIX ?= /usr/local
@ -71,9 +72,11 @@ default: liblz4
all: liblz4 all: liblz4
liblz4: *.c liblz4: *.c
ifeq ($(BUILD_STATIC),yes)
@echo compiling static library @echo compiling static library
@$(CC) $(FLAGS) -c $^ @$(CC) $(FLAGS) -c $^
@$(AR) rcs $@.a *.o @$(AR) rcs $@.a *.o
endif
@echo compiling dynamic library $(LIBVER) @echo compiling dynamic library $(LIBVER)
@$(CC) $(FLAGS) -shared $^ -fPIC $(SONAME_FLAGS) -o $@.$(SHARED_EXT_VER) @$(CC) $(FLAGS) -shared $^ -fPIC $(SONAME_FLAGS) -o $@.$(SHARED_EXT_VER)
@echo creating versioned links @echo creating versioned links
@ -104,7 +107,9 @@ install: liblz4 liblz4.pc
@ln -sf liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT_MAJOR) @ln -sf liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT_MAJOR)
@ln -sf liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT) @ln -sf liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT)
@install -m 644 liblz4.pc $(DESTDIR)$(LIBDIR)/pkgconfig/ @install -m 644 liblz4.pc $(DESTDIR)$(LIBDIR)/pkgconfig/
ifeq ($(BUILD_STATIC),yes)
@install -m 644 liblz4.a $(DESTDIR)$(LIBDIR)/liblz4.a @install -m 644 liblz4.a $(DESTDIR)$(LIBDIR)/liblz4.a
endif
@install -m 644 lz4.h $(DESTDIR)$(INCLUDEDIR)/lz4.h @install -m 644 lz4.h $(DESTDIR)$(INCLUDEDIR)/lz4.h
@install -m 644 lz4hc.h $(DESTDIR)$(INCLUDEDIR)/lz4hc.h @install -m 644 lz4hc.h $(DESTDIR)$(INCLUDEDIR)/lz4hc.h
@install -m 644 lz4frame.h $(DESTDIR)$(INCLUDEDIR)/lz4frame.h @install -m 644 lz4frame.h $(DESTDIR)$(INCLUDEDIR)/lz4frame.h