• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ##########################################################################
2# LZ4 examples - Makefile
3# Copyright (C) Yann Collet 2011-2014
4#
5# GPL v2 License
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License along
18# with this program; if not, write to the Free Software Foundation, Inc.,
19# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20#
21# You can contact the author at :
22#  - LZ4 source repository : https://github.com/Cyan4973/lz4
23#  - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
24# ##########################################################################
25# This makefile compile and test
26# example programs, using (mostly) LZ4 streaming library,
27# kindly provided by Takayuki Matsuoka
28# ##########################################################################
29
30CFLAGS ?= -O3
31CFLAGS += -std=gnu99 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wstrict-prototypes
32FLAGS  := -I../lib $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
33
34TESTFILE= Makefile
35LZ4DIR := ../lib
36LZ4 = ../programs/lz4
37
38
39# Define *.exe as extension for Windows systems
40ifneq (,$(filter Windows%,$(OS)))
41EXT =.exe
42VOID = nul
43else
44EXT =
45VOID = /dev/null
46endif
47
48
49default: all
50
51all: printVersion doubleBuffer dictionaryRandomAccess ringBuffer ringBufferHC lineCompress frameCompress
52
53printVersion: $(LZ4DIR)/lz4.c printVersion.c
54	$(CC)      $(FLAGS) $^ -o $@$(EXT)
55
56doubleBuffer: $(LZ4DIR)/lz4.c blockStreaming_doubleBuffer.c
57	$(CC)      $(FLAGS) $^ -o $@$(EXT)
58
59dictionaryRandomAccess: $(LZ4DIR)/lz4.c dictionaryRandomAccess.c
60	$(CC)      $(FLAGS) $^ -o $@$(EXT)
61
62ringBuffer  : $(LZ4DIR)/lz4.c blockStreaming_ringBuffer.c
63	$(CC)      $(FLAGS) $^ -o $@$(EXT)
64
65ringBufferHC: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c HCStreaming_ringBuffer.c
66	$(CC)      $(FLAGS) $^ -o $@$(EXT)
67
68lineCompress: $(LZ4DIR)/lz4.c blockStreaming_lineByLine.c
69	$(CC)      $(FLAGS) $^ -o $@$(EXT)
70
71frameCompress: frameCompress.c
72	$(CC)      $(FLAGS) $^ -o $@$(EXT) $(LZ4DIR)/liblz4.a
73
74compressFunctions: $(LZ4DIR)/lz4.c compress_functions.c
75	$(CC)      $(FLAGS) $^ -o $@$(EXT) -lrt
76
77simpleBuffer: $(LZ4DIR)/lz4.c simple_buffer.c
78	$(CC)      $(FLAGS) $^ -o $@$(EXT)
79
80test : all
81	./printVersion$(EXT)
82	./doubleBuffer$(EXT) $(TESTFILE)
83	./dictionaryRandomAccess$(EXT) $(TESTFILE) $(TESTFILE) 1100 1400
84	./ringBuffer$(EXT)   $(TESTFILE)
85	./ringBufferHC$(EXT) $(TESTFILE)
86	./lineCompress$(EXT) $(TESTFILE)
87	./frameCompress$(EXT) $(TESTFILE)
88	$(LZ4) -vt $(TESTFILE).lz4
89
90clean:
91	@rm -f core *.o *.dec *-0 *-9 *-8192 *.lz4s *.lz4 \
92	 printVersion$(EXT) doubleBuffer$(EXT) dictionaryRandomAccess$(EXT) \
93	 ringBuffer$(EXT) ringBufferHC$(EXT) lineCompress$(EXT) frameCompress$(EXT) \
94	 compressFunctions$(EXT) simpleBuffer$(EXT)
95	@echo Cleaning completed
96