127b27ec6Sopenharmony_ci# ########################################################################## 227b27ec6Sopenharmony_ci# LZ4 examples - Makefile 327b27ec6Sopenharmony_ci# Copyright (C) Yann Collet 2011-2020 427b27ec6Sopenharmony_ci# 527b27ec6Sopenharmony_ci# GPL v2 License 627b27ec6Sopenharmony_ci# 727b27ec6Sopenharmony_ci# This program is free software; you can redistribute it and/or modify 827b27ec6Sopenharmony_ci# it under the terms of the GNU General Public License as published by 927b27ec6Sopenharmony_ci# the Free Software Foundation; either version 2 of the License, or 1027b27ec6Sopenharmony_ci# (at your option) any later version. 1127b27ec6Sopenharmony_ci# 1227b27ec6Sopenharmony_ci# This program is distributed in the hope that it will be useful, 1327b27ec6Sopenharmony_ci# but WITHOUT ANY WARRANTY; without even the implied warranty of 1427b27ec6Sopenharmony_ci# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1527b27ec6Sopenharmony_ci# GNU General Public License for more details. 1627b27ec6Sopenharmony_ci# 1727b27ec6Sopenharmony_ci# You should have received a copy of the GNU General Public License along 1827b27ec6Sopenharmony_ci# with this program; if not, write to the Free Software Foundation, Inc., 1927b27ec6Sopenharmony_ci# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 2027b27ec6Sopenharmony_ci# 2127b27ec6Sopenharmony_ci# You can contact the author at : 2227b27ec6Sopenharmony_ci# - LZ4 source repository : https://github.com/lz4/lz4 2327b27ec6Sopenharmony_ci# - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c 2427b27ec6Sopenharmony_ci# ########################################################################## 2527b27ec6Sopenharmony_ci# This makefile compile and test 2627b27ec6Sopenharmony_ci# example programs, using (mostly) LZ4 streaming library, 2727b27ec6Sopenharmony_ci# kindly provided by Takayuki Matsuoka 2827b27ec6Sopenharmony_ci# ########################################################################## 2927b27ec6Sopenharmony_ci 3027b27ec6Sopenharmony_ciCPPFLAGS += -I../lib 3127b27ec6Sopenharmony_ciCFLAGS ?= -O3 3227b27ec6Sopenharmony_ciCFLAGS += -std=gnu99 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wstrict-prototypes 3327b27ec6Sopenharmony_ciFLAGS := $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(MOREFLAGS) 3427b27ec6Sopenharmony_ci 3527b27ec6Sopenharmony_ciTESTFILE = Makefile 3627b27ec6Sopenharmony_ciLZ4DIR := ../lib 3727b27ec6Sopenharmony_ciLZ4 = ../programs/lz4 3827b27ec6Sopenharmony_ci 3927b27ec6Sopenharmony_ciinclude ../Makefile.inc 4027b27ec6Sopenharmony_ci 4127b27ec6Sopenharmony_cidefault: all 4227b27ec6Sopenharmony_ci 4327b27ec6Sopenharmony_ciall: printVersion doubleBuffer dictionaryRandomAccess ringBuffer ringBufferHC \ 4427b27ec6Sopenharmony_ci lineCompress frameCompress fileCompress simpleBuffer 4527b27ec6Sopenharmony_ci 4627b27ec6Sopenharmony_ci$(LZ4DIR)/liblz4.a: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c $(LZ4DIR)/lz4frame.c $(LZ4DIR)/lz4.h $(LZ4DIR)/lz4hc.h $(LZ4DIR)/lz4frame.h $(LZ4DIR)/lz4frame_static.h 4727b27ec6Sopenharmony_ci $(MAKE) -C $(LZ4DIR) liblz4.a 4827b27ec6Sopenharmony_ci 4927b27ec6Sopenharmony_ciprintVersion: printVersion.c $(LZ4DIR)/liblz4.a 5027b27ec6Sopenharmony_ci $(CC) $(FLAGS) $^ -o $@$(EXT) 5127b27ec6Sopenharmony_ci 5227b27ec6Sopenharmony_cidoubleBuffer: blockStreaming_doubleBuffer.c $(LZ4DIR)/liblz4.a 5327b27ec6Sopenharmony_ci $(CC) $(FLAGS) $^ -o $@$(EXT) 5427b27ec6Sopenharmony_ci 5527b27ec6Sopenharmony_cidictionaryRandomAccess: dictionaryRandomAccess.c $(LZ4DIR)/liblz4.a 5627b27ec6Sopenharmony_ci $(CC) $(FLAGS) $^ -o $@$(EXT) 5727b27ec6Sopenharmony_ci 5827b27ec6Sopenharmony_ciringBuffer : blockStreaming_ringBuffer.c $(LZ4DIR)/liblz4.a 5927b27ec6Sopenharmony_ci $(CC) $(FLAGS) $^ -o $@$(EXT) 6027b27ec6Sopenharmony_ci 6127b27ec6Sopenharmony_ciringBufferHC: HCStreaming_ringBuffer.c $(LZ4DIR)/liblz4.a 6227b27ec6Sopenharmony_ci $(CC) $(FLAGS) $^ -o $@$(EXT) 6327b27ec6Sopenharmony_ci 6427b27ec6Sopenharmony_cilineCompress: blockStreaming_lineByLine.c $(LZ4DIR)/liblz4.a 6527b27ec6Sopenharmony_ci $(CC) $(FLAGS) $^ -o $@$(EXT) 6627b27ec6Sopenharmony_ci 6727b27ec6Sopenharmony_ciframeCompress: frameCompress.c $(LZ4DIR)/liblz4.a 6827b27ec6Sopenharmony_ci $(CC) $(FLAGS) $^ -o $@$(EXT) 6927b27ec6Sopenharmony_ci 7027b27ec6Sopenharmony_cifileCompress: fileCompress.c $(LZ4DIR)/liblz4.a 7127b27ec6Sopenharmony_ci $(CC) $(FLAGS) $^ -o $@$(EXT) 7227b27ec6Sopenharmony_ci 7327b27ec6Sopenharmony_cicompressFunctions: compress_functions.c $(LZ4DIR)/liblz4.a 7427b27ec6Sopenharmony_ci $(CC) $(FLAGS) $^ -o $@$(EXT) -lrt 7527b27ec6Sopenharmony_ci 7627b27ec6Sopenharmony_cisimpleBuffer: simple_buffer.c $(LZ4DIR)/liblz4.a 7727b27ec6Sopenharmony_ci $(CC) $(FLAGS) $^ -o $@$(EXT) 7827b27ec6Sopenharmony_ci 7927b27ec6Sopenharmony_ci$(LZ4) : 8027b27ec6Sopenharmony_ci $(MAKE) -C ../programs lz4 8127b27ec6Sopenharmony_ci 8227b27ec6Sopenharmony_citest : all $(LZ4) 8327b27ec6Sopenharmony_ci @echo "\n=== Print Version ===" 8427b27ec6Sopenharmony_ci ./printVersion$(EXT) 8527b27ec6Sopenharmony_ci @echo "\n=== Simple compression example ===" 8627b27ec6Sopenharmony_ci ./simpleBuffer$(EXT) 8727b27ec6Sopenharmony_ci @echo "\n=== Double-buffer ===" 8827b27ec6Sopenharmony_ci ./doubleBuffer$(EXT) $(TESTFILE) 8927b27ec6Sopenharmony_ci @echo "\n=== Ring Buffer ===" 9027b27ec6Sopenharmony_ci ./ringBuffer$(EXT) $(TESTFILE) 9127b27ec6Sopenharmony_ci @echo "\n=== Ring Buffer + LZ4 HC ===" 9227b27ec6Sopenharmony_ci ./ringBufferHC$(EXT) $(TESTFILE) 9327b27ec6Sopenharmony_ci @echo "\n=== Compress line by line ===" 9427b27ec6Sopenharmony_ci ./lineCompress$(EXT) $(TESTFILE) 9527b27ec6Sopenharmony_ci @echo "\n=== Dictionary Random Access ===" 9627b27ec6Sopenharmony_ci ./dictionaryRandomAccess$(EXT) $(TESTFILE) $(TESTFILE) 1100 1400 9727b27ec6Sopenharmony_ci @echo "\n=== Frame compression ===" 9827b27ec6Sopenharmony_ci ./frameCompress$(EXT) $(TESTFILE) 9927b27ec6Sopenharmony_ci $(LZ4) -vt $(TESTFILE).lz4 10027b27ec6Sopenharmony_ci @echo "\n=== file compression ===" 10127b27ec6Sopenharmony_ci ./fileCompress$(EXT) $(TESTFILE) 10227b27ec6Sopenharmony_ci $(LZ4) -vt $(TESTFILE).lz4 10327b27ec6Sopenharmony_ci 10427b27ec6Sopenharmony_ci.PHONY: cxxtest 10527b27ec6Sopenharmony_cicxxtest: CFLAGS := -O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror 10627b27ec6Sopenharmony_cicxxtest: clean 10727b27ec6Sopenharmony_ci CC=$(CXX) $(MAKE) -C . all CFLAGS="$(CFLAGS)" 10827b27ec6Sopenharmony_ci 10927b27ec6Sopenharmony_ciclean: 11027b27ec6Sopenharmony_ci @rm -f core *.o *.dec *-0 *-9 *-8192 *.lz4s *.lz4 \ 11127b27ec6Sopenharmony_ci printVersion$(EXT) doubleBuffer$(EXT) dictionaryRandomAccess$(EXT) \ 11227b27ec6Sopenharmony_ci ringBuffer$(EXT) ringBufferHC$(EXT) lineCompress$(EXT) frameCompress$(EXT) \ 11327b27ec6Sopenharmony_ci fileCompress$(EXT) compressFunctions$(EXT) simpleBuffer$(EXT) 11427b27ec6Sopenharmony_ci @echo Cleaning completed 115