• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ################################################################
2# Copyright (C) Przemyslaw Skibinski 2016-present
3# All rights reserved.
4#
5# BSD license
6# Redistribution and use in source and binary forms, with or without modification,
7# are permitted provided that the following conditions are met:
8#
9# * Redistributions of source code must retain the above copyright notice, this
10#   list of conditions and the following disclaimer.
11#
12# * Redistributions in binary form must reproduce the above copyright notice, this
13#   list of conditions and the following disclaimer in the documentation and/or
14#   other materials provided with the distribution.
15#
16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
20# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27# You can contact the author at :
28#  - LZ4 source repository : https://github.com/Cyan4973/lz4
29#  - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
30# ################################################################
31
32
33CXXFLAGS ?= -O3
34CXXFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 -Wswitch-enum -Wno-comment
35CXXFLAGS += $(MOREFLAGS)
36FLAGS   = $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS)
37
38LZ4API = ../../lib/lz4.h
39LZ4MANUAL = ../../doc/lz4_manual.html
40LZ4FAPI = ../../lib/lz4frame.h
41LZ4FMANUAL = ../../doc/lz4frame_manual.html
42LIBVER_MAJOR_SCRIPT:=`sed -n '/define LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LZ4API)`
43LIBVER_MINOR_SCRIPT:=`sed -n '/define LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LZ4API)`
44LIBVER_PATCH_SCRIPT:=`sed -n '/define LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LZ4API)`
45LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT)
46LZ4VER := $(shell echo $(LIBVER_SCRIPT))
47
48# Define *.exe as extension for Windows systems
49ifneq (,$(filter Windows%,$(OS)))
50EXT =.exe
51else
52EXT =
53endif
54
55
56.PHONY: default
57default: gen_manual
58
59gen_manual: gen_manual.cpp
60	$(CXX) $(FLAGS) $^ -o $@$(EXT)
61
62$(LZ4MANUAL) : gen_manual $(LZ4API)
63	echo "Update lz4 manual in /doc"
64	./gen_manual $(LZ4VER) $(LZ4API) $@
65
66$(LZ4FMANUAL) : gen_manual $(LZ4FAPI)
67	echo "Update lz4frame manual in /doc"
68	./gen_manual $(LZ4VER) $(LZ4FAPI) $@
69
70.PHONY: manuals
71manuals: gen_manual $(LZ4MANUAL) $(LZ4FMANUAL)
72
73.PHONY: clean
74clean:
75	@$(RM) gen_manual$(EXT)
76	@echo Cleaning completed
77