]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
decouple zstd object files from lib/ 2367/head
authorYann Collet <yann.collet.73@gmail.com>
Wed, 21 Oct 2020 01:16:11 +0000 (18:16 -0700)
committerYann Collet <yann.collet.73@gmail.com>
Wed, 21 Oct 2020 01:16:11 +0000 (18:16 -0700)
That was a subtle one :
VPATH is affecting search for both %.c source and %.o object files.
This meant that, when an object file already exists in lib/,
it's used in programs/,
even though programs/ is supposed to generate its own %.o object files.

With the new vpath directive, this is no longer the case :
the search is only activated for %.c source files.
Now, local programs/%.o are always generated
even if equivalent ones are already created in lib/.

It more clearly guarantees that lib/ and programs/ can use different compilation directives
without mixing resulting %.o object files.

programs/Makefile

index 1170ccbd3a21b3defba9f0898f88ca6a705eebba..8f14292f3ede4193748dfc9cc1f50962efe375ba 100644 (file)
@@ -65,7 +65,11 @@ ZSTDLIB_DECOMPRESS := $(ZSTDDIR)/decompress
 ZDICT_DIR := $(ZSTDDIR)/dictBuilder
 ZSTDLEGACY_DIR := $(ZSTDDIR)/legacy
 
-VPATH := $(ZSTDLIB_COMMON):$(ZSTDLIB_COMPRESS):$(ZSTDLIB_DECOMPRESS):$(ZDICT_DIR):$(ZSTDLEGACY_DIR)
+vpath %.c $(ZSTDLIB_COMMON)
+vpath %.c $(ZSTDLIB_COMPRESS)
+vpath %.c $(ZSTDLIB_DECOMPRESS)
+vpath %.c $(ZDICT_DIR)
+vpath %.c $(ZSTDLEGACY_DIR)
 
 ZSTDLIB_COMMON_C := $(wildcard $(ZSTDLIB_COMMON)/*.c)
 ZSTDLIB_COMPRESS_C := $(wildcard $(ZSTDLIB_COMPRESS)/*.c)
@@ -284,7 +288,6 @@ endif
 
 .PHONY: clean
 clean:
-       $(MAKE) -C $(ZSTDDIR) clean
        $(Q)$(RM) core *.o tmp* result* *.gcda dictionary *.zst \
         zstd$(EXT) zstd32$(EXT) zstd-compress$(EXT) zstd-decompress$(EXT) \
         zstd-small$(EXT) zstd-frugal$(EXT) zstd-nolegacy$(EXT) zstd4$(EXT) \