1# ##########################################################################
2# LZ4 examples - Makefile
3# Copyright (C) Yann Collet 2011-2014
4# GPL v2 License
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License along
17# with this program; if not, write to the Free Software Foundation, Inc.,
18# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19#
20# You can contact the author at :
21#  - LZ4 source repository : http://code.google.com/p/lz4/
22#  - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
23# ##########################################################################
24# lz4 : Command Line Utility, supporting gzip-like arguments
25# lz4c  : CLU, supporting also legacy lz4demo arguments
26# lz4c32: Same as lz4c, but forced to compile in 32-bits mode
27# fuzzer  : Test tool, to check lz4 integrity on target platform
28# fuzzer32: Same as fuzzer, but forced to compile in 32-bits mode
29# fullbench  : Precisely measure speed for each LZ4 function variant
30# fullbench32: Same as fullbench, but forced to compile in 32-bits mode
31# ##########################################################################
32
33CC     := $(CC)
34CFLAGS ?= -O3
35CFLAGS += -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wno-missing-braces   # Wno-missing-braces required due to GCC <4.8.3 bug
36FLAGS   = -I../lib $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
37
38TESTFILE= Makefile
39LZ4DIR  = ../lib
40
41
42# Minimize test target for Travis CI's Build Matrix
43ifeq ($(LZ4_TRAVIS_CI_ENV),-m32)
44CFLAGS += -m32
45else ifeq ($(LZ4_TRAVIS_CI_ENV),-m64)
46endif
47
48
49# Define *.exe as extension for Windows systems
50ifneq (,$(filter Windows%,$(OS)))
51EXT =.exe
52VOID = nul
53else
54EXT =
55VOID = /dev/null
56endif
57
58
59default: all
60
61all: printVersion doubleBuffer ringBuffer ringBufferHC lineCompress
62
63printVersion: $(LZ4DIR)/lz4.c printVersion.c
64	$(CC)      $(FLAGS) $^ -o $@$(EXT)
65
66doubleBuffer: $(LZ4DIR)/lz4.c blockStreaming_doubleBuffer.c
67	$(CC)      $(FLAGS) $^ -o $@$(EXT)
68
69ringBuffer  : $(LZ4DIR)/lz4.c blockStreaming_ringBuffer.c
70	$(CC)      $(FLAGS) $^ -o $@$(EXT)
71
72ringBufferHC: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c HCStreaming_ringBuffer.c
73	$(CC)      $(FLAGS) $^ -o $@$(EXT)
74
75lineCompress: $(LZ4DIR)/lz4.c blockStreaming_lineByLine.c
76	$(CC)      $(FLAGS) $^ -o $@$(EXT)
77
78test : all
79	./printVersion$(EXT)
80	./doubleBuffer$(EXT) $(TESTFILE)
81	./ringBuffer$(EXT)   $(TESTFILE)
82	./ringBufferHC$(EXT) $(TESTFILE)
83	./lineCompress$(EXT) $(TESTFILE)
84
85clean:
86	@rm -f core *.o *.dec *-0 *-9 *-8192 *.lz4s \
87        printVersion$(EXT) doubleBuffer$(EXT) ringBuffer$(EXT) ringBufferHC$(EXT) lineCompress$(EXT)
88	@echo Cleaning completed
89
90