refactor Makefile
remove usage of include Makefile.inc in too Makefile as it seems to somehow unexport CFLAGS ...
This commit is contained in:
parent
87a80acbe7
commit
e585a438c7
62
Makefile
62
Makefile
@ -36,11 +36,25 @@ TESTDIR = tests
|
||||
EXDIR = examples
|
||||
FUZZDIR = ossfuzz
|
||||
|
||||
include Makefile.inc
|
||||
#include Makefile.inc
|
||||
#determine if dev/nul based on host environment
|
||||
ifneq (,$(filter MINGW% MSYS% CYGWIN%,$(shell uname)))
|
||||
VOID := /dev/null
|
||||
else
|
||||
ifneq (,$(filter Windows%,$(OS)))
|
||||
VOID := nul
|
||||
else
|
||||
VOID := /dev/null
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
.PHONY: default
|
||||
default: lib-release lz4-release
|
||||
|
||||
# silent mode by default; verbose can be triggered by V=1 or VERBOSE=1
|
||||
$(V)$(VERBOSE).SILENT:
|
||||
|
||||
.PHONY: all
|
||||
all: allmost examples manuals build_tests
|
||||
|
||||
@ -50,14 +64,14 @@ allmost: lib lz4
|
||||
.PHONY: lib lib-release liblz4.a
|
||||
lib: liblz4.a
|
||||
lib lib-release liblz4.a:
|
||||
@$(MAKE) -C $(LZ4DIR) $@
|
||||
$(MAKE) -C $(LZ4DIR) $@
|
||||
|
||||
.PHONY: lz4 lz4-release
|
||||
lz4 : liblz4.a
|
||||
lz4-release : lib-release
|
||||
lz4 lz4-release :
|
||||
@$(MAKE) -C $(PRGDIR) $@
|
||||
@cp $(PRGDIR)/lz4$(EXT) .
|
||||
$(MAKE) -C $(PRGDIR) $@
|
||||
cp $(PRGDIR)/lz4$(EXT) .
|
||||
|
||||
.PHONY: examples
|
||||
examples: liblz4.a
|
||||
@ -65,21 +79,21 @@ examples: liblz4.a
|
||||
|
||||
.PHONY: manuals
|
||||
manuals:
|
||||
@$(MAKE) -C contrib/gen_manual $@
|
||||
$(MAKE) -C contrib/gen_manual $@
|
||||
|
||||
.PHONY: build_tests
|
||||
build_tests:
|
||||
@$(MAKE) -C $(TESTDIR) all
|
||||
$(MAKE) -C $(TESTDIR) all
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@$(MAKE) -C $(LZ4DIR) $@ > $(VOID)
|
||||
@$(MAKE) -C $(PRGDIR) $@ > $(VOID)
|
||||
@$(MAKE) -C $(TESTDIR) $@ > $(VOID)
|
||||
@$(MAKE) -C $(EXDIR) $@ > $(VOID)
|
||||
@$(MAKE) -C $(FUZZDIR) $@ > $(VOID)
|
||||
@$(MAKE) -C contrib/gen_manual $@ > $(VOID)
|
||||
@$(RM) lz4$(EXT)
|
||||
$(MAKE) -C $(LZ4DIR) $@ > $(VOID)
|
||||
$(MAKE) -C $(PRGDIR) $@ > $(VOID)
|
||||
$(MAKE) -C $(TESTDIR) $@ > $(VOID)
|
||||
$(MAKE) -C $(EXDIR) $@ > $(VOID)
|
||||
$(MAKE) -C $(FUZZDIR) $@ > $(VOID)
|
||||
$(MAKE) -C contrib/gen_manual $@ > $(VOID)
|
||||
$(RM) lz4$(EXT)
|
||||
@echo Cleaning completed
|
||||
|
||||
|
||||
@ -91,14 +105,14 @@ HOST_OS = POSIX
|
||||
|
||||
.PHONY: install uninstall
|
||||
install uninstall:
|
||||
@$(MAKE) -C $(LZ4DIR) $@
|
||||
@$(MAKE) -C $(PRGDIR) $@
|
||||
$(MAKE) -C $(LZ4DIR) $@
|
||||
$(MAKE) -C $(PRGDIR) $@
|
||||
|
||||
travis-install:
|
||||
$(MAKE) -j1 install DESTDIR=~/install_test_dir
|
||||
|
||||
cmake:
|
||||
@cd build/cmake; cmake $(CMAKE_PARAMS) CMakeLists.txt; $(MAKE)
|
||||
cd build/cmake; cmake $(CMAKE_PARAMS) CMakeLists.txt; $(MAKE)
|
||||
|
||||
endif
|
||||
|
||||
@ -116,7 +130,7 @@ ifneq (,$(filter $(HOST_OS),MSYS POSIX))
|
||||
|
||||
.PHONY: list
|
||||
list:
|
||||
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs
|
||||
$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs
|
||||
|
||||
.PHONY: check
|
||||
check:
|
||||
@ -132,15 +146,15 @@ clangtest: CFLAGS += -Werror -Wconversion -Wno-sign-conversion
|
||||
clangtest: CC = clang
|
||||
clangtest: clean
|
||||
$(CC) -v
|
||||
@CFLAGS="$(CFLAGS)" $(MAKE) -C $(LZ4DIR) all CC=$(CC)
|
||||
@CFLAGS="$(CFLAGS)" $(MAKE) -C $(PRGDIR) all CC=$(CC)
|
||||
@CFLAGS="$(CFLAGS)" $(MAKE) -C $(TESTDIR) all CC=$(CC)
|
||||
CFLAGS="$(CFLAGS)" $(MAKE) -C $(LZ4DIR) all CC=$(CC)
|
||||
CFLAGS="$(CFLAGS)" $(MAKE) -C $(PRGDIR) all CC=$(CC)
|
||||
CFLAGS="$(CFLAGS)" $(MAKE) -C $(TESTDIR) all CC=$(CC)
|
||||
|
||||
clangtest-native: clean
|
||||
clang -v
|
||||
@CFLAGS="-O3 -Werror -Wconversion -Wno-sign-conversion" $(MAKE) -C $(LZ4DIR) all CC=clang
|
||||
@CFLAGS="-O3 -Werror -Wconversion -Wno-sign-conversion" $(MAKE) -C $(PRGDIR) native CC=clang
|
||||
@CFLAGS="-O3 -Werror -Wconversion -Wno-sign-conversion" $(MAKE) -C $(TESTDIR) native CC=clang
|
||||
CFLAGS="-O3 -Werror -Wconversion -Wno-sign-conversion" $(MAKE) -C $(LZ4DIR) all CC=clang
|
||||
CFLAGS="-O3 -Werror -Wconversion -Wno-sign-conversion" $(MAKE) -C $(PRGDIR) native CC=clang
|
||||
CFLAGS="-O3 -Werror -Wconversion -Wno-sign-conversion" $(MAKE) -C $(TESTDIR) native CC=clang
|
||||
|
||||
usan: CC = clang
|
||||
usan: CFLAGS = -O3 -g -fsanitize=undefined -fno-sanitize-recover=undefined -fsanitize-recover=pointer-overflow
|
||||
@ -163,7 +177,7 @@ cppcheck:
|
||||
|
||||
platformTest: clean
|
||||
@echo "\n ---- test lz4 with $(CC) compiler ----"
|
||||
@$(CC) -v
|
||||
$(CC) -v
|
||||
CFLAGS="-O3 -Werror" $(MAKE) -C $(LZ4DIR) all
|
||||
CFLAGS="-O3 -Werror -static" $(MAKE) -C $(PRGDIR) all
|
||||
CFLAGS="-O3 -Werror -static" $(MAKE) -C $(TESTDIR) all
|
||||
|
36
Makefile.inc
36
Makefile.inc
@ -1,8 +1,34 @@
|
||||
ifeq ($(V), 1)
|
||||
Q =
|
||||
else
|
||||
Q = @
|
||||
endif
|
||||
# ################################################################
|
||||
# LZ4 - Makefile common definitions
|
||||
# Copyright (C) Yann Collet 2020
|
||||
# All rights reserved.
|
||||
#
|
||||
# BSD license
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this
|
||||
# list of conditions and the following disclaimer in the documentation and/or
|
||||
# other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# You can contact the author at :
|
||||
# - LZ4 source repository : https://github.com/lz4/lz4
|
||||
# - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
|
||||
# ################################################################
|
||||
|
||||
TARGET_OS ?= $(shell uname)
|
||||
ifeq ($(TARGET_OS),)
|
||||
|
103
lib/Makefile
103
lib/Makefile
@ -31,11 +31,12 @@
|
||||
# - LZ4 source repository : https://github.com/lz4/lz4
|
||||
# - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
|
||||
# ################################################################
|
||||
SED = sed
|
||||
|
||||
# Version numbers
|
||||
LIBVER_MAJOR_SCRIPT:=`sed -n '/define LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./lz4.h`
|
||||
LIBVER_MINOR_SCRIPT:=`sed -n '/define LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./lz4.h`
|
||||
LIBVER_PATCH_SCRIPT:=`sed -n '/define LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./lz4.h`
|
||||
LIBVER_MAJOR_SCRIPT:=`$(SED) -n '/define LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./lz4.h`
|
||||
LIBVER_MINOR_SCRIPT:=`$(SED) -n '/define LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./lz4.h`
|
||||
LIBVER_PATCH_SCRIPT:=`$(SED) -n '/define LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./lz4.h`
|
||||
LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT)
|
||||
LIBVER_MAJOR := $(shell echo $(LIBVER_MAJOR_SCRIPT))
|
||||
LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT))
|
||||
@ -46,12 +47,13 @@ BUILD_SHARED:=yes
|
||||
BUILD_STATIC:=yes
|
||||
|
||||
CPPFLAGS+= -DXXH_NAMESPACE=LZ4_
|
||||
CPPFLAGS+= $(MOREFLAGS)
|
||||
CFLAGS ?= -O3
|
||||
DEBUGFLAGS:= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
||||
-Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes \
|
||||
-Wundef -Wpointer-arith -Wstrict-aliasing=1
|
||||
CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
|
||||
FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
|
||||
CFLAGS += $(DEBUGFLAGS)
|
||||
FLAGS = $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
|
||||
|
||||
SRCFILES := $(sort $(wildcard *.c))
|
||||
|
||||
@ -74,27 +76,33 @@ endif
|
||||
.PHONY: default
|
||||
default: lib-release
|
||||
|
||||
# silent mode by default; verbose can be triggered by V=1 or VERBOSE=1
|
||||
$(V)$(VERBOSE).SILENT:
|
||||
|
||||
lib-release: DEBUGFLAGS :=
|
||||
lib-release: lib
|
||||
|
||||
.PHONY: lib
|
||||
lib: liblz4.a liblz4
|
||||
|
||||
.PHONY: all
|
||||
all: lib
|
||||
|
||||
.PHONY: all32
|
||||
all32: CFLAGS+=-m32
|
||||
all32: all
|
||||
|
||||
liblz4.a: $(SRCFILES)
|
||||
ifeq ($(BUILD_STATIC),yes) # can be disabled on command line
|
||||
@echo compiling static library
|
||||
$(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -c $^
|
||||
$(Q)$(AR) rcs $@ *.o
|
||||
$(COMPILE.c) $^
|
||||
$(AR) rcs $@ *.o
|
||||
endif
|
||||
|
||||
ifeq ($(WINBASED),yes)
|
||||
liblz4-dll.rc: liblz4-dll.rc.in
|
||||
@echo creating library resource
|
||||
$(Q)sed -e 's|@LIBLZ4@|$(LIBLZ4)|' \
|
||||
$(SED) -e 's|@LIBLZ4@|$(LIBLZ4)|' \
|
||||
-e 's|@LIBVER_MAJOR@|$(LIBVER_MAJOR)|g' \
|
||||
-e 's|@LIBVER_MINOR@|$(LIBVER_MINOR)|g' \
|
||||
-e 's|@LIBVER_PATCH@|$(LIBVER_PATCH)|g' \
|
||||
@ -104,31 +112,30 @@ liblz4-dll.o: liblz4-dll.rc
|
||||
$(WINDRES) -i liblz4-dll.rc -o liblz4-dll.o
|
||||
|
||||
$(LIBLZ4): $(SRCFILES) liblz4-dll.o
|
||||
else
|
||||
$(LIBLZ4): $(SRCFILES)
|
||||
endif
|
||||
ifeq ($(BUILD_SHARED),yes) # can be disabled on command line
|
||||
@echo compiling dynamic library $(LIBVER)
|
||||
ifeq ($(WINBASED),yes)
|
||||
$(Q)$(CC) $(FLAGS) -DLZ4_DLL_EXPORT=1 -shared $^ -o dll/$@.dll -Wl,--out-implib,dll/$(LIBLZ4_EXP)
|
||||
else
|
||||
$(Q)$(CC) $(FLAGS) -shared $^ -fPIC -fvisibility=hidden $(SONAME_FLAGS) -o $@
|
||||
$(CC) $(FLAGS) -DLZ4_DLL_EXPORT=1 -shared $^ -o dll/$@.dll -Wl,--out-implib,dll/$(LIBLZ4_EXP)
|
||||
|
||||
else # not windows
|
||||
|
||||
$(LIBLZ4): $(SRCFILES)
|
||||
@echo compiling dynamic library $(LIBVER)
|
||||
$(CC) $(FLAGS) -shared $^ -fPIC -fvisibility=hidden $(SONAME_FLAGS) -o $@
|
||||
@echo creating versioned links
|
||||
$(Q)$(LN_SF) $@ liblz4.$(SHARED_EXT_MAJOR)
|
||||
$(Q)$(LN_SF) $@ liblz4.$(SHARED_EXT)
|
||||
endif
|
||||
$(LN_SF) $@ liblz4.$(SHARED_EXT_MAJOR)
|
||||
$(LN_SF) $@ liblz4.$(SHARED_EXT)
|
||||
|
||||
endif
|
||||
|
||||
ifeq (,$(filter MINGW%,$(TARGET_OS)))
|
||||
.PHONY: liblz4
|
||||
liblz4: $(LIBLZ4)
|
||||
endif
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
ifeq ($(WINBASED),yes)
|
||||
$(Q)$(RM) *.rc
|
||||
$(RM) *.rc
|
||||
endif
|
||||
$(Q)$(RM) core *.o liblz4.pc dll/$(LIBLZ4).dll dll/$(LIBLZ4_EXP)
|
||||
$(Q)$(RM) *.a *.$(SHARED_EXT) *.$(SHARED_EXT_MAJOR) *.$(SHARED_EXT_VER)
|
||||
$(RM) core *.o liblz4.pc dll/$(LIBLZ4).dll dll/$(LIBLZ4_EXP)
|
||||
$(RM) *.a *.$(SHARED_EXT) *.$(SHARED_EXT_MAJOR) *.$(SHARED_EXT_VER)
|
||||
@echo Cleaning library completed
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@ -164,54 +171,54 @@ pkgconfigdir ?= $(PKGCONFIGDIR)
|
||||
|
||||
liblz4.pc: liblz4.pc.in Makefile
|
||||
@echo creating pkgconfig
|
||||
$(Q)sed -e 's|@PREFIX@|$(prefix)|' \
|
||||
$(SED) -e 's|@PREFIX@|$(prefix)|' \
|
||||
-e 's|@LIBDIR@|$(libdir)|' \
|
||||
-e 's|@INCLUDEDIR@|$(includedir)|' \
|
||||
-e 's|@VERSION@|$(LIBVER)|' \
|
||||
$< >$@
|
||||
|
||||
install: lib liblz4.pc
|
||||
$(Q)$(INSTALL_DIR) $(DESTDIR)$(pkgconfigdir)/ $(DESTDIR)$(includedir)/ $(DESTDIR)$(libdir)/ $(DESTDIR)$(bindir)/
|
||||
$(Q)$(INSTALL_DATA) liblz4.pc $(DESTDIR)$(pkgconfigdir)/
|
||||
$(INSTALL_DIR) $(DESTDIR)$(pkgconfigdir)/ $(DESTDIR)$(includedir)/ $(DESTDIR)$(libdir)/ $(DESTDIR)$(bindir)/
|
||||
$(INSTALL_DATA) liblz4.pc $(DESTDIR)$(pkgconfigdir)/
|
||||
@echo Installing libraries
|
||||
ifeq ($(BUILD_STATIC),yes)
|
||||
$(Q)$(INSTALL_DATA) liblz4.a $(DESTDIR)$(libdir)/liblz4.a
|
||||
$(Q)$(INSTALL_DATA) lz4frame_static.h $(DESTDIR)$(includedir)/lz4frame_static.h
|
||||
$(INSTALL_DATA) liblz4.a $(DESTDIR)$(libdir)/liblz4.a
|
||||
$(INSTALL_DATA) lz4frame_static.h $(DESTDIR)$(includedir)/lz4frame_static.h
|
||||
endif
|
||||
ifeq ($(BUILD_SHARED),yes)
|
||||
# Traditionnally, one installs the DLLs in the bin directory as programs
|
||||
# search them first in their directory. This allows to not pollute system
|
||||
# directories (like c:/windows/system32), nor modify the PATH variable.
|
||||
ifeq ($(WINBASED),yes)
|
||||
$(Q)$(INSTALL_PROGRAM) dll/$(LIBLZ4).dll $(DESTDIR)$(bindir)
|
||||
$(Q)$(INSTALL_PROGRAM) dll/$(LIBLZ4_EXP) $(DESTDIR)$(libdir)
|
||||
$(INSTALL_PROGRAM) dll/$(LIBLZ4).dll $(DESTDIR)$(bindir)
|
||||
$(INSTALL_PROGRAM) dll/$(LIBLZ4_EXP) $(DESTDIR)$(libdir)
|
||||
else
|
||||
$(Q)$(INSTALL_PROGRAM) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(libdir)
|
||||
$(Q)$(LN_SF) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT_MAJOR)
|
||||
$(Q)$(LN_SF) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT)
|
||||
$(INSTALL_PROGRAM) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(libdir)
|
||||
$(LN_SF) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT_MAJOR)
|
||||
$(LN_SF) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT)
|
||||
endif
|
||||
endif
|
||||
@echo Installing headers in $(includedir)
|
||||
$(Q)$(INSTALL_DATA) lz4.h $(DESTDIR)$(includedir)/lz4.h
|
||||
$(Q)$(INSTALL_DATA) lz4hc.h $(DESTDIR)$(includedir)/lz4hc.h
|
||||
$(Q)$(INSTALL_DATA) lz4frame.h $(DESTDIR)$(includedir)/lz4frame.h
|
||||
$(INSTALL_DATA) lz4.h $(DESTDIR)$(includedir)/lz4.h
|
||||
$(INSTALL_DATA) lz4hc.h $(DESTDIR)$(includedir)/lz4hc.h
|
||||
$(INSTALL_DATA) lz4frame.h $(DESTDIR)$(includedir)/lz4frame.h
|
||||
@echo lz4 libraries installed
|
||||
|
||||
uninstall:
|
||||
$(Q)$(RM) $(DESTDIR)$(pkgconfigdir)/liblz4.pc
|
||||
$(RM) $(DESTDIR)$(pkgconfigdir)/liblz4.pc
|
||||
ifeq (WINBASED,1)
|
||||
$(Q)$(RM) $(DESTDIR)$(bindir)/$(LIBLZ4).dll
|
||||
$(Q)$(RM) $(DESTDIR)$(libdir)/$(LIBLZ4_EXP)
|
||||
$(RM) $(DESTDIR)$(bindir)/$(LIBLZ4).dll
|
||||
$(RM) $(DESTDIR)$(libdir)/$(LIBLZ4_EXP)
|
||||
else
|
||||
$(Q)$(RM) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT)
|
||||
$(Q)$(RM) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT_MAJOR)
|
||||
$(Q)$(RM) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT_VER)
|
||||
$(RM) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT)
|
||||
$(RM) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT_MAJOR)
|
||||
$(RM) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT_VER)
|
||||
endif
|
||||
$(Q)$(RM) $(DESTDIR)$(libdir)/liblz4.a
|
||||
$(Q)$(RM) $(DESTDIR)$(includedir)/lz4.h
|
||||
$(Q)$(RM) $(DESTDIR)$(includedir)/lz4hc.h
|
||||
$(Q)$(RM) $(DESTDIR)$(includedir)/lz4frame.h
|
||||
$(Q)$(RM) $(DESTDIR)$(includedir)/lz4frame_static.h
|
||||
$(RM) $(DESTDIR)$(libdir)/liblz4.a
|
||||
$(RM) $(DESTDIR)$(includedir)/lz4.h
|
||||
$(RM) $(DESTDIR)$(includedir)/lz4hc.h
|
||||
$(RM) $(DESTDIR)$(includedir)/lz4frame.h
|
||||
$(RM) $(DESTDIR)$(includedir)/lz4frame_static.h
|
||||
@echo lz4 libraries successfully uninstalled
|
||||
|
||||
endif
|
||||
|
@ -28,13 +28,14 @@
|
||||
# lz4c : CLU, supporting also legacy lz4demo arguments
|
||||
# lz4c32: Same as lz4c, but forced to compile in 32-bits mode
|
||||
# ##########################################################################
|
||||
SED = sed
|
||||
|
||||
# Version numbers
|
||||
LZ4DIR := ../lib
|
||||
LIBVER_SRC := $(LZ4DIR)/lz4.h
|
||||
LIBVER_MAJOR_SCRIPT:=`sed -n '/define LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
|
||||
LIBVER_MINOR_SCRIPT:=`sed -n '/define LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
|
||||
LIBVER_PATCH_SCRIPT:=`sed -n '/define LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
|
||||
LIBVER_MAJOR_SCRIPT:=`$(SED) -n '/define LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
|
||||
LIBVER_MINOR_SCRIPT:=`$(SED) -n '/define LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
|
||||
LIBVER_PATCH_SCRIPT:=`$(SED) -n '/define LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
|
||||
LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT)
|
||||
LIBVER_MAJOR := $(shell echo $(LIBVER_MAJOR_SCRIPT))
|
||||
LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT))
|
||||
@ -61,6 +62,9 @@ include ../Makefile.inc
|
||||
|
||||
default: lz4-release
|
||||
|
||||
# silent mode by default; verbose can be triggered by V=1 or VERBOSE=1
|
||||
$(V)$(VERBOSE).SILENT:
|
||||
|
||||
all: lz4 lz4c
|
||||
|
||||
all32: CFLAGS+=-m32
|
||||
@ -69,7 +73,7 @@ all32: all
|
||||
ifeq ($(WINBASED),yes)
|
||||
lz4-exe.rc: lz4-exe.rc.in
|
||||
@echo creating executable resource
|
||||
$(Q)sed -e 's|@PROGNAME@|lz4|' \
|
||||
$(SED) -e 's|@PROGNAME@|lz4|' \
|
||||
-e 's|@LIBVER_MAJOR@|$(LIBVER_MAJOR)|g' \
|
||||
-e 's|@LIBVER_MINOR@|$(LIBVER_MINOR)|g' \
|
||||
-e 's|@LIBVER_PATCH@|$(LIBVER_PATCH)|g' \
|
||||
@ -110,7 +114,7 @@ lz4c32 : $(SRCFILES)
|
||||
$(CC) $(FLAGS) $^ -o $@$(EXT)
|
||||
|
||||
lz4.1: lz4.1.md $(LIBVER_SRC)
|
||||
cat $< | $(MD2ROFF) $(MD2ROFF_FLAGS) | sed -n '/^\.\\\".*/!p' > $@
|
||||
cat $< | $(MD2ROFF) $(MD2ROFF_FLAGS) | $(SED) -n '/^\.\\\".*/!p' > $@
|
||||
|
||||
man: lz4.1
|
||||
|
||||
@ -122,10 +126,10 @@ preview-man: clean-man man
|
||||
|
||||
clean:
|
||||
ifeq ($(WINBASED),yes)
|
||||
$(Q)$(RM) *.rc
|
||||
$(RM) *.rc
|
||||
endif
|
||||
@$(MAKE) -C $(LZ4DIR) $@ > $(VOID)
|
||||
@$(RM) core *.o *.test tmp* \
|
||||
$(MAKE) -C $(LZ4DIR) $@ > $(VOID)
|
||||
$(RM) core *.o *.test tmp* \
|
||||
lz4$(EXT) lz4c$(EXT) lz4c32$(EXT) lz4-wlib$(EXT) \
|
||||
unlz4$(EXT) lz4cat$(EXT)
|
||||
@echo Cleaning completed
|
||||
@ -161,27 +165,27 @@ man1dir ?= $(MAN1DIR)
|
||||
|
||||
install: lz4
|
||||
@echo Installing binaries
|
||||
@$(INSTALL_DIR) $(DESTDIR)$(bindir)/ $(DESTDIR)$(man1dir)/
|
||||
@$(INSTALL_PROGRAM) lz4$(EXT) $(DESTDIR)$(bindir)/lz4$(EXT)
|
||||
@$(LN_S) lz4$(EXT) $(DESTDIR)$(bindir)/lz4c$(EXT)
|
||||
@$(LN_S) lz4$(EXT) $(DESTDIR)$(bindir)/lz4cat$(EXT)
|
||||
@$(LN_S) lz4$(EXT) $(DESTDIR)$(bindir)/unlz4$(EXT)
|
||||
$(INSTALL_DIR) $(DESTDIR)$(bindir)/ $(DESTDIR)$(man1dir)/
|
||||
$(INSTALL_PROGRAM) lz4$(EXT) $(DESTDIR)$(bindir)/lz4$(EXT)
|
||||
$(LN_S) lz4$(EXT) $(DESTDIR)$(bindir)/lz4c$(EXT)
|
||||
$(LN_S) lz4$(EXT) $(DESTDIR)$(bindir)/lz4cat$(EXT)
|
||||
$(LN_S) lz4$(EXT) $(DESTDIR)$(bindir)/unlz4$(EXT)
|
||||
@echo Installing man pages
|
||||
@$(INSTALL_DATA) lz4.1 $(DESTDIR)$(man1dir)/lz4.1
|
||||
@$(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4c.1
|
||||
@$(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4cat.1
|
||||
@$(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/unlz4.1
|
||||
$(INSTALL_DATA) lz4.1 $(DESTDIR)$(man1dir)/lz4.1
|
||||
$(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4c.1
|
||||
$(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4cat.1
|
||||
$(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/unlz4.1
|
||||
@echo lz4 installation completed
|
||||
|
||||
uninstall:
|
||||
@$(RM) $(DESTDIR)$(bindir)/lz4cat$(EXT)
|
||||
@$(RM) $(DESTDIR)$(bindir)/unlz4$(EXT)
|
||||
@$(RM) $(DESTDIR)$(bindir)/lz4$(EXT)
|
||||
@$(RM) $(DESTDIR)$(bindir)/lz4c$(EXT)
|
||||
@$(RM) $(DESTDIR)$(man1dir)/lz4.1
|
||||
@$(RM) $(DESTDIR)$(man1dir)/lz4c.1
|
||||
@$(RM) $(DESTDIR)$(man1dir)/lz4cat.1
|
||||
@$(RM) $(DESTDIR)$(man1dir)/unlz4.1
|
||||
$(RM) $(DESTDIR)$(bindir)/lz4cat$(EXT)
|
||||
$(RM) $(DESTDIR)$(bindir)/unlz4$(EXT)
|
||||
$(RM) $(DESTDIR)$(bindir)/lz4$(EXT)
|
||||
$(RM) $(DESTDIR)$(bindir)/lz4c$(EXT)
|
||||
$(RM) $(DESTDIR)$(man1dir)/lz4.1
|
||||
$(RM) $(DESTDIR)$(man1dir)/lz4c.1
|
||||
$(RM) $(DESTDIR)$(man1dir)/lz4cat.1
|
||||
$(RM) $(DESTDIR)$(man1dir)/unlz4.1
|
||||
@echo lz4 programs successfully uninstalled
|
||||
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user