Home | History | Annotate | Download | only in examples
      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 
     33 CC     := $(CC)
     34 CFLAGS ?= -O3
     35 CFLAGS += -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wno-missing-braces   # Wno-missing-braces required due to GCC <4.8.3 bug
     36 FLAGS   = -I../lib $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
     37 
     38 TESTFILE= Makefile
     39 LZ4DIR  = ../lib
     40 
     41 
     42 # Minimize test target for Travis CI's Build Matrix
     43 ifeq ($(LZ4_TRAVIS_CI_ENV),-m32)
     44 CFLAGS += -m32
     45 else ifeq ($(LZ4_TRAVIS_CI_ENV),-m64)
     46 endif
     47 
     48 
     49 # Define *.exe as extension for Windows systems
     50 ifneq (,$(filter Windows%,$(OS)))
     51 EXT =.exe
     52 VOID = nul
     53 else
     54 EXT =
     55 VOID = /dev/null
     56 endif
     57 
     58 
     59 default: all
     60 
     61 all: printVersion doubleBuffer ringBuffer ringBufferHC lineCompress
     62 
     63 printVersion: $(LZ4DIR)/lz4.c printVersion.c
     64 	$(CC)      $(FLAGS) $^ -o $@$(EXT)
     65 
     66 doubleBuffer: $(LZ4DIR)/lz4.c blockStreaming_doubleBuffer.c
     67 	$(CC)      $(FLAGS) $^ -o $@$(EXT)
     68 
     69 ringBuffer  : $(LZ4DIR)/lz4.c blockStreaming_ringBuffer.c
     70 	$(CC)      $(FLAGS) $^ -o $@$(EXT)
     71 
     72 ringBufferHC: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c HCStreaming_ringBuffer.c
     73 	$(CC)      $(FLAGS) $^ -o $@$(EXT)
     74 
     75 lineCompress: $(LZ4DIR)/lz4.c blockStreaming_lineByLine.c
     76 	$(CC)      $(FLAGS) $^ -o $@$(EXT)
     77 
     78 test : all
     79 	./printVersion$(EXT)
     80 	./doubleBuffer$(EXT) $(TESTFILE)
     81 	./ringBuffer$(EXT)   $(TESTFILE)
     82 	./ringBufferHC$(EXT) $(TESTFILE)
     83 	./lineCompress$(EXT) $(TESTFILE)
     84 
     85 clean:
     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