kusano 7d535a
# ##########################################################################
kusano 7d535a
# LZ4 examples - Makefile
kusano 7d535a
# Copyright (C) Yann Collet 2011-2014
kusano 7d535a
#
kusano 7d535a
# GPL v2 License
kusano 7d535a
#
kusano 7d535a
# This program is free software; you can redistribute it and/or modify
kusano 7d535a
# it under the terms of the GNU General Public License as published by
kusano 7d535a
# the Free Software Foundation; either version 2 of the License, or
kusano 7d535a
# (at your option) any later version.
kusano 7d535a
#
kusano 7d535a
# This program is distributed in the hope that it will be useful,
kusano 7d535a
# but WITHOUT ANY WARRANTY; without even the implied warranty of
kusano 7d535a
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
kusano 7d535a
# GNU General Public License for more details.
kusano 7d535a
#
kusano 7d535a
# You should have received a copy of the GNU General Public License along
kusano 7d535a
# with this program; if not, write to the Free Software Foundation, Inc.,
kusano 7d535a
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
kusano 7d535a
#
kusano 7d535a
# You can contact the author at :
kusano 7d535a
#  - LZ4 source repository : http://code.google.com/p/lz4/
kusano 7d535a
#  - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
kusano 7d535a
# ##########################################################################
kusano 7d535a
# This makefile compile and test
kusano 7d535a
# example programs, using (mostly) LZ4 streaming library,
kusano 7d535a
# kindly provided by Takayuki Matsuoka
kusano 7d535a
# ##########################################################################
kusano 7d535a
kusano 7d535a
CFLAGS ?= -O3
kusano 7d535a
CFLAGS += -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wstrict-prototypes
kusano 7d535a
FLAGS  := -I../lib $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
kusano 7d535a
kusano 7d535a
TESTFILE= Makefile
kusano 7d535a
LZ4DIR := ../lib
kusano 7d535a
LZ4 = ../programs/lz4
kusano 7d535a
kusano 7d535a
kusano 7d535a
# Define *.exe as extension for Windows systems
kusano 7d535a
ifneq (,$(filter Windows%,$(OS)))
kusano 7d535a
EXT =.exe
kusano 7d535a
VOID = nul
kusano 7d535a
else
kusano 7d535a
EXT =
kusano 7d535a
VOID = /dev/null
kusano 7d535a
endif
kusano 7d535a
kusano 7d535a
kusano 7d535a
default: all
kusano 7d535a
kusano 7d535a
all: printVersion doubleBuffer ringBuffer ringBufferHC lineCompress frameCompress
kusano 7d535a
kusano 7d535a
printVersion: $(LZ4DIR)/lz4.c printVersion.c
kusano 7d535a
	$(CC)      $(FLAGS) $^ -o $@$(EXT)
kusano 7d535a
kusano 7d535a
doubleBuffer: $(LZ4DIR)/lz4.c blockStreaming_doubleBuffer.c
kusano 7d535a
	$(CC)      $(FLAGS) $^ -o $@$(EXT)
kusano 7d535a
kusano 7d535a
ringBuffer  : $(LZ4DIR)/lz4.c blockStreaming_ringBuffer.c
kusano 7d535a
	$(CC)      $(FLAGS) $^ -o $@$(EXT)
kusano 7d535a
kusano 7d535a
ringBufferHC: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c HCStreaming_ringBuffer.c
kusano 7d535a
	$(CC)      $(FLAGS) $^ -o $@$(EXT)
kusano 7d535a
kusano 7d535a
lineCompress: $(LZ4DIR)/lz4.c blockStreaming_lineByLine.c
kusano 7d535a
	$(CC)      $(FLAGS) $^ -o $@$(EXT)
kusano 7d535a
kusano 7d535a
frameCompress: frameCompress.c
kusano 7d535a
	$(CC)      $(FLAGS) $^ -o $@$(EXT) -L$(LZ4DIR) -llz4
kusano 7d535a
kusano 7d535a
test : all
kusano 7d535a
	./printVersion$(EXT)
kusano 7d535a
	./doubleBuffer$(EXT) $(TESTFILE)
kusano 7d535a
	./ringBuffer$(EXT)   $(TESTFILE)
kusano 7d535a
	./ringBufferHC$(EXT) $(TESTFILE)
kusano 7d535a
	./lineCompress$(EXT) $(TESTFILE)
kusano 7d535a
	LD_LIBRARY_PATH=$(LZ4DIR) ./frameCompress$(EXT) $(TESTFILE)
kusano 7d535a
	$(LZ4) -vt $(TESTFILE).lz4
kusano 7d535a
kusano 7d535a
clean:
kusano 7d535a
	@rm -f core *.o *.dec *-0 *-9 *-8192 *.lz4s *.lz4 \
kusano 7d535a
	 printVersion$(EXT) doubleBuffer$(EXT) ringBuffer$(EXT) ringBufferHC$(EXT) \
kusano 7d535a
	 lineCompress$(EXT) frameCompress$(EXT)
kusano 7d535a
	@echo Cleaning completed
kusano 7d535a