From 773b66547f84792fd4143e605ca27f31c2989945 Mon Sep 17 00:00:00 2001 From: JPeterMugaas Date: Mon, 22 Apr 2019 13:48:59 -0400 Subject: Initial commits from diff I submitted earlier --- Makefile | 53 +++++++++++++++++++++++++++++++++++++---- examples/Makefile | 47 ++++++++++++++++++++++++++++++++---- lib/Makefile | 42 +++++++++++++++++++++++--------- programs/Makefile | 41 ++++++++++++++++++++++++++++---- tests/Makefile | 71 +++++++++++++++++++++++++++++++++++++++++++++++++------ 5 files changed, 221 insertions(+), 33 deletions(-) diff --git a/Makefile b/Makefile index f3c6ce2..51b4216 100644 --- a/Makefile +++ b/Makefile @@ -36,15 +36,50 @@ TESTDIR = tests EXDIR = examples -# Define nul output -ifneq (,$(filter Windows%,$(OS))) +# Define *.exe as extension for targetting Windows systems +TARGET_OS ?= $(shell uname) +ifeq ($(TARGET_OS),) + TARGET_OS ?= $(OS) +endif + +ifneq (,$(filter Windows%,$(TARGET_OS))) +LIBLZ4 = liblz4-$(LIBVER_MAJOR) +EXT = .exe +else +EXT = .exe +ifneq (,$(filter MINGW%,$(TARGET_OS))) +EXT = .exe +else +ifneq (,$(filter MSYS%,$(TARGET_OS))) +EXT = .exe +else +ifneq (,$(filter CYGWIN%,$(TARGET_OS))) EXT = .exe -VOID = nul else EXT = -VOID = /dev/null +endif +endif +endif endif +#determine if dev/nul based on host environment +ifneq (,$(filter MINGW%,$(shell uname))) +VOID := /dev/null +else +ifneq (,$(filter MSYS%,$(shell uname))) +VOID := /dev/null +else +ifneq (,$(filter CYGWIN%,$(shell uname))) +VOID := /dev/null +else +ifneq (,$(filter Windows%,$(OS))) +VOID := nul +else +VOID := /dev/null +endif +endif +endif +endif .PHONY: default default: lib-release lz4-release @@ -93,7 +128,7 @@ clean: #----------------------------------------------------------------------------- # make install is validated only for Linux, OSX, BSD, Hurd and Solaris targets #----------------------------------------------------------------------------- -ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW32_NT-6.1 MINGW64_NT-6.1 MINGW32_NT-10.0 MINGW64_NT-10.0)) +ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW32% MINGW64% CYGWIN% MSYS%,$(shell uname))) HOST_OS = POSIX .PHONY: install uninstall @@ -181,6 +216,14 @@ gpptest gpptest32: clean CC=$(CC) $(MAKE) -C $(PRGDIR) all CFLAGS="$(CFLAGS)" CC=$(CC) $(MAKE) -C $(TESTDIR) all CFLAGS="$(CFLAGS)" +cxx17build : CC = "$(CXX) -Wno-deprecated" +cxx17build : CFLAGS = -std=c++17 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror -pedantic +cxx17build : clean + $(CXX) -v + CC=$(CC) $(MAKE) -C $(LZ4DIR) all CFLAGS="$(CFLAGS)" + CC=$(CC) $(MAKE) -C $(PRGDIR) all CFLAGS="$(CFLAGS)" + CC=$(CC) $(MAKE) -C $(TESTDIR) all CFLAGS="$(CFLAGS)" + ctocpptest: LIBCC="$(CC)" ctocpptest: TESTCC="$(CXX)" ctocpptest: CFLAGS="" diff --git a/examples/Makefile b/examples/Makefile index 103e7ec..26aaafd 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -38,14 +38,51 @@ LZ4 = ../programs/lz4 # Define *.exe as extension for Windows systems -ifneq (,$(filter Windows%,$(OS))) -EXT =.exe -VOID = nul + +# Define *.exe as extension for targetting Windows systems +TARGET_OS ?= $(shell uname) +ifeq ($(TARGET_OS),) + TARGET_OS ?= $(OS) +endif + +ifneq (,$(filter Windows%,$(TARGET_OS))) +LIBLZ4 = liblz4-$(LIBVER_MAJOR) +EXT = .exe +else +EXT = .exe +ifneq (,$(filter MINGW%,$(TARGET_OS))) +EXT = .exe else -EXT = -VOID = /dev/null +ifneq (,$(filter MSYS%,$(TARGET_OS))) +EXT = .exe +else +ifneq (,$(filter CYGWIN%,$(TARGET_OS))) +EXT = .exe +else +EXT = +endif +endif +endif endif +#determine if dev/nul based on host environment +ifneq (,$(filter MINGW%,$(shell uname))) +VOID := /dev/null +else +ifneq (,$(filter MSYS%,$(shell uname))) +VOID := /dev/null +else +ifneq (,$(filter CYGWIN%,$(shell uname))) +VOID := /dev/null +else +ifneq (,$(filter Windows%,$(OS))) +VOID := nul +else +VOID := /dev/null +endif +endif +endif +endif default: all diff --git a/lib/Makefile b/lib/Makefile index cb1571c..4e96b57 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -45,7 +45,10 @@ LIBVER := $(shell echo $(LIBVER_SCRIPT)) BUILD_SHARED:=yes BUILD_STATIC:=yes -OS ?= $(shell uname) +TARGET_OS ?= $(shell uname) +ifeq ($(TARGET_OS),) + TARGET_OS ?= $(OS) +endif CPPFLAGS+= -DXXH_NAMESPACE=LZ4_ CFLAGS ?= -O3 DEBUGFLAGS:= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ @@ -71,10 +74,26 @@ else SHARED_EXT_VER = $(SHARED_EXT).$(LIBVER) endif -ifneq (,$(filter Windows%,$(OS))) +WINBASED = yes +ifneq (,$(filter Windows%,$(TARGET_OS))) LIBLZ4 = liblz4-$(LIBVER_MAJOR) +LIBLZ4_EXP = liblz4.lib +else +LIBLZ4_EXP = liblz4.dll.a +ifneq (,$(filter MINGW%,$(TARGET_OS))) +LIBLZ4 = liblz4 +else +ifneq (,$(filter MSYS%,$(TARGET_OS))) +LIBLZ4 = msys-lz4-$(LIBVER_MAJOR) +else +ifneq (,$(filter CYGWIN%,$(TARGET_OS))) +LIBLZ4 = cyglz4-$(LIBVER_MAJOR) else LIBLZ4 = liblz4.$(SHARED_EXT_VER) +WINBASED = no +endif +endif +endif endif .PHONY: default @@ -106,8 +125,8 @@ endif $(LIBLZ4): $(SRCFILES) ifeq ($(BUILD_SHARED),yes) # can be disabled on command line @echo compiling dynamic library $(LIBVER) -ifneq (,$(filter Windows%,$(OS))) - $(Q)$(CC) $(FLAGS) -DLZ4_DLL_EXPORT=1 -shared $^ -o dll/$@.dll -Wl,--out-implib,dll/liblz4.lib +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 $@ @echo creating versioned links @@ -116,18 +135,19 @@ else endif endif +ifeq (,$(filter MINGW%,$(TARGET_OS))) liblz4: $(LIBLZ4) +endif clean: - $(Q)$(RM) core *.o liblz4.pc dll/liblz4.dll dll/liblz4.lib + $(Q)$(RM) core *.o liblz4.pc dll/$(LIBLZ4).dll dll/$(LIBLZ4_EXP) $(Q)$(RM) *.a *.$(SHARED_EXT) *.$(SHARED_EXT_MAJOR) *.$(SHARED_EXT_VER) @echo Cleaning library completed - #----------------------------------------------------------------------------- # make install is validated only for Linux, OSX, BSD, Hurd and Solaris targets #----------------------------------------------------------------------------- -ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW32_NT-6.1 MINGW64_NT-6.1 MINGW32_NT-10.0 MINGW64_NT-10.0)) +ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW32_NT% MINGW64_NT% MSYS% CYGWIN_NT%,$(shell uname))) .PHONY: listL120 listL120: # extract lines >= 120 characters in *.{c,h}, by Takayuki Matsuoka (note : $$, for Makefile compatibility) @@ -184,9 +204,9 @@ 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. -ifneq (,$(filter Windows%,$(OS))) +ifeq ($(WINBASED),yes) $(Q)$(INSTALL_PROGRAM) dll/$(LIBLZ4).dll $(DESTDIR)$(bindir) - $(Q)$(INSTALL_PROGRAM) dll/liblz4.lib $(DESTDIR)$(libdir) + $(Q)$(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) @@ -201,9 +221,9 @@ endif uninstall: $(Q)$(RM) $(DESTDIR)$(pkgconfigdir)/liblz4.pc -ifneq (,$(filter Windows%,$(OS))) +ifeq (WINBASED,1) $(Q)$(RM) $(DESTDIR)$(bindir)/$(LIBLZ4).dll - $(Q)$(RM) $(DESTDIR)$(libdir)/liblz4.lib + $(Q)$(RM) $(DESTDIR)$(libdir)/$(LIBLZ4_EXP) else $(Q)$(RM) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT) $(Q)$(RM) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT_MAJOR) diff --git a/programs/Makefile b/programs/Makefile index 92fd683..47912d8 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -56,17 +56,48 @@ LZ4_VERSION=$(LIBVER) MD2ROFF = ronn MD2ROFF_FLAGS = --roff --warnings --manual="User Commands" --organization="lz4 $(LZ4_VERSION)" +TARGET_OS ?= $(shell uname) +ifeq ($(TARGET_OS),) + TARGET_OS ?= $(OS) +endif # Define *.exe as extension for Windows systems -ifneq (,$(filter Windows%,$(OS))) +ifneq (,$(filter Windows%,$(TARGET_OS))) +EXT :=.exe +else +ifneq (,$(filter MINGW%,$(TARGET_OS))) +EXT :=.exe +else +ifneq (,$(filter MSYS%,$(TARGET_OS))) +EXT :=.exe +else +ifneq (,$(filter CYGWIN%,$(TARGET_OS))) EXT :=.exe -VOID := nul else EXT := -VOID := /dev/null +endif +endif +endif endif - +#determine if dev/nul based on host environment +ifneq (,$(filter MINGW%,$(shell uname))) +VOID := /dev/null +else +ifneq (,$(filter MSYS%,$(shell uname))) +VOID := /dev/null +else +ifneq (,$(filter CYGWIN%,$(shell uname))) +VOID := /dev/null +else +ifneq (,$(filter Windows%,$(OS))) +VOID := nul +else +VOID := /dev/null +endif +endif +endif +endif default: lz4-release @@ -109,7 +140,7 @@ clean: #----------------------------------------------------------------------------- # make install is validated only for Linux, OSX, BSD, Hurd and Solaris targets #----------------------------------------------------------------------------- -ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW32_NT-6.1 MINGW64_NT-6.1 MINGW32_NT-10.0 MINGW64_NT-10.0)) +ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW32_NT% MINGW64_NT% MSYS% CYGWIN_NT%,$(shell uname))) unlz4: lz4 ln -s lz4$(EXT) unlz4$(EXT) diff --git a/tests/Makefile b/tests/Makefile index 70cae63..d8104de 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -43,15 +43,72 @@ CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) CPPFLAGS+= -I$(LZ4DIR) -I$(PRGDIR) -DXXH_NAMESPACE=LZ4_ FLAGS = $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) - # Define *.exe as extension for Windows systems +TARGET_OS ?= $(shell uname) +ifeq ($(TARGET_OS),) + TARGET_OS ?= $(OS) +endif + +ifneq (,$(filter Windows%,$(TARGET_OS))) +EXT :=.exe +else +ifneq (,$(filter MINGW%,$(TARGET_OS))) +EXT :=.exe +else +ifneq (,$(filter MSYS%,$(TARGET_OS))) +EXT :=.exe +else +ifneq (,$(filter CYGWIN%,$(TARGET_OS))) +EXT :=.exe +else +EXT := +endif +endif +endif +endif + +# determine name of .DLL for the target +WINBASED = yes +ifneq (,$(filter Windows%,$(TARGET_OS))) +LIBLZ4 = liblz4-$(LIBVER_MAJOR) +LIBLZ4_EXP = liblz4.lib +else +LIBLZ4_EXP = liblz4.dll.a +ifneq (,$(filter MINGW%,$(TARGET_OS))) +LIBLZ4 = liblz4 +else +ifneq (,$(filter MSYS%,$(TARGET_OS))) +LIBLZ4 = msys-lz4-$(LIBVER_MAJOR) +else +ifneq (,$(filter CYGWIN%,$(TARGET_OS))) +LIBLZ4 = cyglz4-$(LIBVER_MAJOR) +else +LIBLZ4 = liblz4.$(SHARED_EXT_VER) +WINBASED = no +endif +endif +endif +endif + +#determine if dev/nul based on host environment +ifneq (,$(filter MINGW%,$(shell uname))) +VOID := /dev/null +else +ifneq (,$(filter MSYS%,$(shell uname))) +VOID := /dev/null +else +ifneq (,$(filter CYGWIN%,$(shell uname))) +VOID := /dev/null +else ifneq (,$(filter Windows%,$(OS))) -EXT =.exe -VOID = nul +VOID := nul else -EXT = -VOID = /dev/null +VOID := /dev/null +endif endif +endif +endif + LZ4 := $(PRGDIR)/lz4$(EXT) @@ -95,7 +152,7 @@ fullbench-lib: fullbench.c $(LZ4DIR)/liblz4.a fullbench-dll: fullbench.c $(LZ4DIR)/xxhash.c $(MAKE) -C $(LZ4DIR) liblz4 - $(CC) $(FLAGS) $^ -o $@$(EXT) -DLZ4_DLL_IMPORT=1 $(LZ4DIR)/dll/liblz4.dll + $(CC) $(FLAGS) $^ -o $@$(EXT) -DLZ4_DLL_IMPORT=1 $(LZ4DIR)/dll/$(LIBLZ4).dll fuzzer : lz4.o lz4hc.o xxhash.o fuzzer.c $(CC) $(FLAGS) $^ -o $@$(EXT) @@ -137,7 +194,7 @@ checkTag: checkTag.c $(LZ4DIR)/lz4.h #----------------------------------------------------------------------------- # validated only for Linux, OSX, BSD, Hurd and Solaris targets #----------------------------------------------------------------------------- -ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD)) +ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW32% MINGW64% CYGWIN% MSYS%,$(shell uname))) MD5:=md5sum ifneq (,$(filter $(shell uname), Darwin )) -- cgit v0.12 From b48f823f907e7763ed4178726c00453fb2af7a28 Mon Sep 17 00:00:00 2001 From: JPeterMugaas Date: Mon, 22 Apr 2019 15:48:48 -0400 Subject: Try to put some tests I made in ONE place. I also moved a test for "install" in one place to try to isolate it. --- Makefile | 48 ++------------------------------------ Makefile.inc | 59 +++++++++++++++++++++++++++++++++++++++++++++++ examples/Makefile | 48 +------------------------------------- lib/Makefile | 28 ++-------------------- tests/Makefile | 69 ++----------------------------------------------------- 5 files changed, 66 insertions(+), 186 deletions(-) create mode 100644 Makefile.inc diff --git a/Makefile b/Makefile index 51b4216..b7926b7 100644 --- a/Makefile +++ b/Makefile @@ -35,51 +35,7 @@ PRGDIR = programs TESTDIR = tests EXDIR = examples - -# Define *.exe as extension for targetting Windows systems -TARGET_OS ?= $(shell uname) -ifeq ($(TARGET_OS),) - TARGET_OS ?= $(OS) -endif - -ifneq (,$(filter Windows%,$(TARGET_OS))) -LIBLZ4 = liblz4-$(LIBVER_MAJOR) -EXT = .exe -else -EXT = .exe -ifneq (,$(filter MINGW%,$(TARGET_OS))) -EXT = .exe -else -ifneq (,$(filter MSYS%,$(TARGET_OS))) -EXT = .exe -else -ifneq (,$(filter CYGWIN%,$(TARGET_OS))) -EXT = .exe -else -EXT = -endif -endif -endif -endif - -#determine if dev/nul based on host environment -ifneq (,$(filter MINGW%,$(shell uname))) -VOID := /dev/null -else -ifneq (,$(filter MSYS%,$(shell uname))) -VOID := /dev/null -else -ifneq (,$(filter CYGWIN%,$(shell uname))) -VOID := /dev/null -else -ifneq (,$(filter Windows%,$(OS))) -VOID := nul -else -VOID := /dev/null -endif -endif -endif -endif +include Makefile.inc .PHONY: default default: lib-release lz4-release @@ -128,7 +84,7 @@ clean: #----------------------------------------------------------------------------- # make install is validated only for Linux, OSX, BSD, Hurd and Solaris targets #----------------------------------------------------------------------------- -ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW32% MINGW64% CYGWIN% MSYS%,$(shell uname))) +ifeq ($(POSIX_ENV),yes) HOST_OS = POSIX .PHONY: install uninstall diff --git a/Makefile.inc b/Makefile.inc new file mode 100644 index 0000000..d9dc891 --- /dev/null +++ b/Makefile.inc @@ -0,0 +1,59 @@ +TARGET_OS ?= $(shell uname) +ifeq ($(TARGET_OS),) + TARGET_OS ?= $(OS) +endif + +ifneq (,$(filter Windows%,$(TARGET_OS))) +LIBLZ4 = liblz4-$(LIBVER_MAJOR) +LIBLZ4_EXP = liblz4.lib +WINBASED = yes +else +LIBLZ4_EXP = liblz4.dll.a + ifneq (,$(filter MINGW%,$(TARGET_OS))) +LIBLZ4 = liblz4 +WINBASED = yes + else + ifneq (,$(filter MSYS%,$(TARGET_OS))) +LIBLZ4 = msys-lz4-$(LIBVER_MAJOR) +WINBASED = yes + else + ifneq (,$(filter CYGWIN%,$(TARGET_OS))) +LIBLZ4 = cyglz4-$(LIBVER_MAJOR) +WINBASED = yes + else +LIBLZ4 = liblz4.$(SHARED_EXT_VER) +WINBASED = no +EXT = + endif + endif + endif +endif + +ifeq ($(WINBASED),yes) +EXT = .exe +endif + +#determine if dev/nul based on host environment +ifneq (,$(filter MINGW%,$(shell uname))) +VOID := /dev/null +else + ifneq (,$(filter MSYS%,$(shell uname))) +VOID := /dev/null + else + ifneq (,$(filter CYGWIN%,$(shell uname))) +VOID := /dev/null + else + ifneq (,$(filter Windows%,$(OS))) +VOID := nul + else +VOID := /dev/null + endif + endif + endif +endif + +ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW32% MINGW64% CYGWIN% MSYS%,$(shell uname))) +POSIX_ENV = Yes +else +POSIX_ENV = No +endif diff --git a/examples/Makefile b/examples/Makefile index 26aaafd..6a34b33 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -36,53 +36,7 @@ TESTFILE = Makefile LZ4DIR := ../lib LZ4 = ../programs/lz4 - -# Define *.exe as extension for Windows systems - -# Define *.exe as extension for targetting Windows systems -TARGET_OS ?= $(shell uname) -ifeq ($(TARGET_OS),) - TARGET_OS ?= $(OS) -endif - -ifneq (,$(filter Windows%,$(TARGET_OS))) -LIBLZ4 = liblz4-$(LIBVER_MAJOR) -EXT = .exe -else -EXT = .exe -ifneq (,$(filter MINGW%,$(TARGET_OS))) -EXT = .exe -else -ifneq (,$(filter MSYS%,$(TARGET_OS))) -EXT = .exe -else -ifneq (,$(filter CYGWIN%,$(TARGET_OS))) -EXT = .exe -else -EXT = -endif -endif -endif -endif - -#determine if dev/nul based on host environment -ifneq (,$(filter MINGW%,$(shell uname))) -VOID := /dev/null -else -ifneq (,$(filter MSYS%,$(shell uname))) -VOID := /dev/null -else -ifneq (,$(filter CYGWIN%,$(shell uname))) -VOID := /dev/null -else -ifneq (,$(filter Windows%,$(OS))) -VOID := nul -else -VOID := /dev/null -endif -endif -endif -endif +include ../Makefile.inc default: all diff --git a/lib/Makefile b/lib/Makefile index 4e96b57..0546031 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -45,10 +45,6 @@ LIBVER := $(shell echo $(LIBVER_SCRIPT)) BUILD_SHARED:=yes BUILD_STATIC:=yes -TARGET_OS ?= $(shell uname) -ifeq ($(TARGET_OS),) - TARGET_OS ?= $(OS) -endif CPPFLAGS+= -DXXH_NAMESPACE=LZ4_ CFLAGS ?= -O3 DEBUGFLAGS:= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ @@ -74,27 +70,7 @@ else SHARED_EXT_VER = $(SHARED_EXT).$(LIBVER) endif -WINBASED = yes -ifneq (,$(filter Windows%,$(TARGET_OS))) -LIBLZ4 = liblz4-$(LIBVER_MAJOR) -LIBLZ4_EXP = liblz4.lib -else -LIBLZ4_EXP = liblz4.dll.a -ifneq (,$(filter MINGW%,$(TARGET_OS))) -LIBLZ4 = liblz4 -else -ifneq (,$(filter MSYS%,$(TARGET_OS))) -LIBLZ4 = msys-lz4-$(LIBVER_MAJOR) -else -ifneq (,$(filter CYGWIN%,$(TARGET_OS))) -LIBLZ4 = cyglz4-$(LIBVER_MAJOR) -else -LIBLZ4 = liblz4.$(SHARED_EXT_VER) -WINBASED = no -endif -endif -endif -endif +include ../Makefile.inc .PHONY: default default: lib-release @@ -147,7 +123,7 @@ clean: #----------------------------------------------------------------------------- # make install is validated only for Linux, OSX, BSD, Hurd and Solaris targets #----------------------------------------------------------------------------- -ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW32_NT% MINGW64_NT% MSYS% CYGWIN_NT%,$(shell uname))) +ifeq ($(POSIX_ENV),yes) .PHONY: listL120 listL120: # extract lines >= 120 characters in *.{c,h}, by Takayuki Matsuoka (note : $$, for Makefile compatibility) diff --git a/tests/Makefile b/tests/Makefile index d8104de..b9afb02 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -43,71 +43,7 @@ CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) CPPFLAGS+= -I$(LZ4DIR) -I$(PRGDIR) -DXXH_NAMESPACE=LZ4_ FLAGS = $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -# Define *.exe as extension for Windows systems -TARGET_OS ?= $(shell uname) -ifeq ($(TARGET_OS),) - TARGET_OS ?= $(OS) -endif - -ifneq (,$(filter Windows%,$(TARGET_OS))) -EXT :=.exe -else -ifneq (,$(filter MINGW%,$(TARGET_OS))) -EXT :=.exe -else -ifneq (,$(filter MSYS%,$(TARGET_OS))) -EXT :=.exe -else -ifneq (,$(filter CYGWIN%,$(TARGET_OS))) -EXT :=.exe -else -EXT := -endif -endif -endif -endif - -# determine name of .DLL for the target -WINBASED = yes -ifneq (,$(filter Windows%,$(TARGET_OS))) -LIBLZ4 = liblz4-$(LIBVER_MAJOR) -LIBLZ4_EXP = liblz4.lib -else -LIBLZ4_EXP = liblz4.dll.a -ifneq (,$(filter MINGW%,$(TARGET_OS))) -LIBLZ4 = liblz4 -else -ifneq (,$(filter MSYS%,$(TARGET_OS))) -LIBLZ4 = msys-lz4-$(LIBVER_MAJOR) -else -ifneq (,$(filter CYGWIN%,$(TARGET_OS))) -LIBLZ4 = cyglz4-$(LIBVER_MAJOR) -else -LIBLZ4 = liblz4.$(SHARED_EXT_VER) -WINBASED = no -endif -endif -endif -endif - -#determine if dev/nul based on host environment -ifneq (,$(filter MINGW%,$(shell uname))) -VOID := /dev/null -else -ifneq (,$(filter MSYS%,$(shell uname))) -VOID := /dev/null -else -ifneq (,$(filter CYGWIN%,$(shell uname))) -VOID := /dev/null -else -ifneq (,$(filter Windows%,$(OS))) -VOID := nul -else -VOID := /dev/null -endif -endif -endif -endif +include ../Makefile.inc LZ4 := $(PRGDIR)/lz4$(EXT) @@ -117,7 +53,6 @@ TEST_FILES := COPYING FUZZER_TIME := -T90s NB_LOOPS ?= -i1 - default: all all: fullbench fuzzer frametest roundTripTest datagen checkFrame @@ -194,7 +129,7 @@ checkTag: checkTag.c $(LZ4DIR)/lz4.h #----------------------------------------------------------------------------- # validated only for Linux, OSX, BSD, Hurd and Solaris targets #----------------------------------------------------------------------------- -ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW32% MINGW64% CYGWIN% MSYS%,$(shell uname))) +ifeq ($(POSIX_ENV),yes) MD5:=md5sum ifneq (,$(filter $(shell uname), Darwin )) -- cgit v0.12 From 2acddd9918bdef87179d63fd06dc31e9d9bc3f1e Mon Sep 17 00:00:00 2001 From: JPeterMugaas Date: Mon, 22 Apr 2019 16:06:04 -0400 Subject: Fix a test for mingw --- Makefile | 2 +- Makefile.inc | 2 +- lib/Makefile | 2 +- tests/Makefile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index b7926b7..dd731eb 100644 --- a/Makefile +++ b/Makefile @@ -84,7 +84,7 @@ clean: #----------------------------------------------------------------------------- # make install is validated only for Linux, OSX, BSD, Hurd and Solaris targets #----------------------------------------------------------------------------- -ifeq ($(POSIX_ENV),yes) +ifeq ($(POSIX_ENV),Yes) HOST_OS = POSIX .PHONY: install uninstall diff --git a/Makefile.inc b/Makefile.inc index d9dc891..c09ba62 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -52,7 +52,7 @@ VOID := /dev/null endif endif -ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW32% MINGW64% CYGWIN% MSYS%,$(shell uname))) +ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW% CYGWIN% MSYS%,$(shell uname))) POSIX_ENV = Yes else POSIX_ENV = No diff --git a/lib/Makefile b/lib/Makefile index 0546031..28853df 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -123,7 +123,7 @@ clean: #----------------------------------------------------------------------------- # make install is validated only for Linux, OSX, BSD, Hurd and Solaris targets #----------------------------------------------------------------------------- -ifeq ($(POSIX_ENV),yes) +ifeq ($(POSIX_ENV),Yes) .PHONY: listL120 listL120: # extract lines >= 120 characters in *.{c,h}, by Takayuki Matsuoka (note : $$, for Makefile compatibility) diff --git a/tests/Makefile b/tests/Makefile index b9afb02..9b7ed8d 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -129,7 +129,7 @@ checkTag: checkTag.c $(LZ4DIR)/lz4.h #----------------------------------------------------------------------------- # validated only for Linux, OSX, BSD, Hurd and Solaris targets #----------------------------------------------------------------------------- -ifeq ($(POSIX_ENV),yes) +ifeq ($(POSIX_ENV),Yes) MD5:=md5sum ifneq (,$(filter $(shell uname), Darwin )) -- cgit v0.12 From 5e6807fd95284fcef48a976e2a28617f8ff134d7 Mon Sep 17 00:00:00 2001 From: JPeterMugaas Date: Mon, 22 Apr 2019 17:38:43 -0400 Subject: Make programs/Makefile use the includes. --- programs/Makefile | 43 +------------------------------------------ 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/programs/Makefile b/programs/Makefile index 47912d8..e055491 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -56,48 +56,7 @@ LZ4_VERSION=$(LIBVER) MD2ROFF = ronn MD2ROFF_FLAGS = --roff --warnings --manual="User Commands" --organization="lz4 $(LZ4_VERSION)" -TARGET_OS ?= $(shell uname) -ifeq ($(TARGET_OS),) - TARGET_OS ?= $(OS) -endif - -# Define *.exe as extension for Windows systems -ifneq (,$(filter Windows%,$(TARGET_OS))) -EXT :=.exe -else -ifneq (,$(filter MINGW%,$(TARGET_OS))) -EXT :=.exe -else -ifneq (,$(filter MSYS%,$(TARGET_OS))) -EXT :=.exe -else -ifneq (,$(filter CYGWIN%,$(TARGET_OS))) -EXT :=.exe -else -EXT := -endif -endif -endif -endif - -#determine if dev/nul based on host environment -ifneq (,$(filter MINGW%,$(shell uname))) -VOID := /dev/null -else -ifneq (,$(filter MSYS%,$(shell uname))) -VOID := /dev/null -else -ifneq (,$(filter CYGWIN%,$(shell uname))) -VOID := /dev/null -else -ifneq (,$(filter Windows%,$(OS))) -VOID := nul -else -VOID := /dev/null -endif -endif -endif -endif +include ../Makefile.inc default: lz4-release -- cgit v0.12