From 1acca240a9ce824612619dde36de44723785ebe3 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Wed, 31 Jan 2018 16:11:45 -0800 Subject: ensure proper dependencies are built for /examples also : use liblz4.a static lib to share compilation time --- examples/Makefile | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/examples/Makefile b/examples/Makefile index 9321c24..c56d455 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -52,34 +52,40 @@ default: all all: printVersion doubleBuffer dictionaryRandomAccess ringBuffer ringBufferHC \ lineCompress frameCompress simpleBuffer -printVersion: $(LZ4DIR)/lz4.c printVersion.c - $(CC) $(FLAGS) $^ -o $@$(EXT) +$(LZ4DIR)/liblz4.a: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c $(LZ4DIR)/lz4opt.h $(LZ4DIR)/lz4frame.c $(LZ4DIR)/lz4.h $(LZ4DIR)/lz4hc.h $(LZ4DIR)/lz4frame.h $(LZ4DIR)/lz4frame_static.h + $(MAKE) -C $(LZ4DIR) liblz4.a -doubleBuffer: $(LZ4DIR)/lz4.c blockStreaming_doubleBuffer.c - $(CC) $(FLAGS) $^ -o $@$(EXT) +printVersion: $(LZ4DIR)/liblz4.a printVersion.c + $(CC) $(FLAGS) $^ -o $@$(EXT) -dictionaryRandomAccess: $(LZ4DIR)/lz4.c dictionaryRandomAccess.c - $(CC) $(FLAGS) $^ -o $@$(EXT) +doubleBuffer: $(LZ4DIR)/liblz4.a blockStreaming_doubleBuffer.c + $(CC) $(FLAGS) $^ -o $@$(EXT) -ringBuffer : $(LZ4DIR)/lz4.c blockStreaming_ringBuffer.c - $(CC) $(FLAGS) $^ -o $@$(EXT) +dictionaryRandomAccess: $(LZ4DIR)/liblz4.a dictionaryRandomAccess.c + $(CC) $(FLAGS) $^ -o $@$(EXT) -ringBufferHC: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c HCStreaming_ringBuffer.c - $(CC) $(FLAGS) $^ -o $@$(EXT) +ringBuffer : $(LZ4DIR)/liblz4.a blockStreaming_ringBuffer.c + $(CC) $(FLAGS) $^ -o $@$(EXT) -lineCompress: $(LZ4DIR)/lz4.c blockStreaming_lineByLine.c - $(CC) $(FLAGS) $^ -o $@$(EXT) +ringBufferHC: $(LZ4DIR)/liblz4.a HCStreaming_ringBuffer.c + $(CC) $(FLAGS) $^ -o $@$(EXT) -frameCompress: frameCompress.c - $(CC) $(FLAGS) $^ -o $@$(EXT) $(LZ4DIR)/liblz4.a +lineCompress: $(LZ4DIR)/liblz4.a blockStreaming_lineByLine.c + $(CC) $(FLAGS) $^ -o $@$(EXT) -compressFunctions: $(LZ4DIR)/lz4.c compress_functions.c - $(CC) $(FLAGS) $^ -o $@$(EXT) -lrt +frameCompress: $(LZ4DIR)/liblz4.a frameCompress.c + $(CC) $(FLAGS) $^ -o $@$(EXT) -simpleBuffer: $(LZ4DIR)/lz4.c simple_buffer.c - $(CC) $(FLAGS) $^ -o $@$(EXT) +compressFunctions: $(LZ4DIR)/liblz4.a compress_functions.c + $(CC) $(FLAGS) $^ -o $@$(EXT) -lrt -test : all +simpleBuffer: $(LZ4DIR)/liblz4.a simple_buffer.c + $(CC) $(FLAGS) $^ -o $@$(EXT) + +$(LZ4) : + $(MAKE) -C ../programs lz4 + +test : all $(LZ4) @echo "\n=== Print Version ===" ./printVersion$(EXT) @echo "\n=== Simple compression example ===" -- cgit v0.12