diff options
author | Yann Collet <Cyan4973@users.noreply.github.com> | 2022-12-02 22:46:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-02 22:46:24 (GMT) |
commit | d879e7f15a7c392fc590123eaf3620128ff8106e (patch) | |
tree | 84b798646b2478795b3b513c41197af7fbb71d5a /tests/Makefile | |
parent | 3e213fdf8e50694fdc6cafd51874394dc057b56d (diff) | |
parent | 08f1483b0a4e685c2211f3ca24a9e505502dc333 (diff) | |
download | lz4-d879e7f15a7c392fc590123eaf3620128ff8106e.zip lz4-d879e7f15a7c392fc590123eaf3620128ff8106e.tar.gz lz4-d879e7f15a7c392fc590123eaf3620128ff8106e.tar.bz2 |
Merge pull request #1187 from t-mat/pr-issue-1186
Add environment check for freestanding test : resolves #1186
Diffstat (limited to 'tests/Makefile')
-rw-r--r-- | tests/Makefile | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/tests/Makefile b/tests/Makefile index 1dd8628..a24185c 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -115,9 +115,6 @@ decompress-partial: lz4.o decompress-partial.c decompress-partial-usingDict: lz4.o decompress-partial-usingDict.c $(CC) $(FLAGS) $^ -o $@$(EXT) -freestanding: freestanding.c - $(CC) -ffreestanding -nostdlib $^ -o $@$(EXT) - .PHONY: clean clean: @$(MAKE) -C $(LZ4DIR) $@ > $(VOID) @@ -353,10 +350,44 @@ test-decompress-partial : decompress-partial decompress-partial-usingDict @echo "\n ---- test decompress-partial-usingDict ----" ./decompress-partial-usingDict$(EXT) + +#----------------------------------------------------------------------------- +# freestanding test only for Linux x86_64 +#----------------------------------------------------------------------------- +ifeq ($(OS),Windows_NT) + UNAME_S := Windows +else + UNAME_S := $(shell uname -s) +endif + +ifeq ($(OS),Windows_NT) + UNAME_P := Unknown +else + UNAME_P := $(shell uname -p) +endif + +FREESTANDING_CFLAGS := -ffreestanding -nostdlib + +ifneq ($(UNAME_S), Linux) + FREESTANDING_CFLAGS := +endif + +ifneq ($(UNAME_P), x86_64) + FREESTANDING_CFLAGS := +endif + +freestanding: freestanding.c + $(CC) $(FREESTANDING_CFLAGS) $^ -o $@$(EXT) + test-freestanding: freestanding @echo "\n ---- test freestanding ----" +ifeq ($(FREESTANDING_CFLAGS),) + @echo "\n (skip)" +else ./freestanding$(EXT) -strace ./freestanding$(EXT) -ltrace ./freestanding$(EXT) +endif + endif |