Skip to content
/ zstd Public
forked from facebook/zstd

Commit

Permalink
decouple zstd object files from lib/
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Cyan4973 committed Oct 21, 2020
1 parent a9f7e77 commit 684f8ea
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions programs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) \
Expand Down

0 comments on commit 684f8ea

Please sign in to comment.