127b27ec6Sopenharmony_ci# ################################################################
227b27ec6Sopenharmony_ci# Copyright (C) Przemyslaw Skibinski 2016-present
327b27ec6Sopenharmony_ci# All rights reserved.
427b27ec6Sopenharmony_ci#
527b27ec6Sopenharmony_ci# BSD license
627b27ec6Sopenharmony_ci# Redistribution and use in source and binary forms, with or without modification,
727b27ec6Sopenharmony_ci# are permitted provided that the following conditions are met:
827b27ec6Sopenharmony_ci#
927b27ec6Sopenharmony_ci# * Redistributions of source code must retain the above copyright notice, this
1027b27ec6Sopenharmony_ci#   list of conditions and the following disclaimer.
1127b27ec6Sopenharmony_ci#
1227b27ec6Sopenharmony_ci# * Redistributions in binary form must reproduce the above copyright notice, this
1327b27ec6Sopenharmony_ci#   list of conditions and the following disclaimer in the documentation and/or
1427b27ec6Sopenharmony_ci#   other materials provided with the distribution.
1527b27ec6Sopenharmony_ci#
1627b27ec6Sopenharmony_ci# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1727b27ec6Sopenharmony_ci# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1827b27ec6Sopenharmony_ci# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1927b27ec6Sopenharmony_ci# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
2027b27ec6Sopenharmony_ci# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2127b27ec6Sopenharmony_ci# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2227b27ec6Sopenharmony_ci# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
2327b27ec6Sopenharmony_ci# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2427b27ec6Sopenharmony_ci# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2527b27ec6Sopenharmony_ci# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2627b27ec6Sopenharmony_ci#
2727b27ec6Sopenharmony_ci# You can contact the author at :
2827b27ec6Sopenharmony_ci#  - LZ4 source repository : https://github.com/Cyan4973/lz4
2927b27ec6Sopenharmony_ci#  - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
3027b27ec6Sopenharmony_ci# ################################################################
3127b27ec6Sopenharmony_ci
3227b27ec6Sopenharmony_ci
3327b27ec6Sopenharmony_ciCXXFLAGS ?= -O2
3427b27ec6Sopenharmony_ciCXXFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 -Wswitch-enum -Wno-comment
3527b27ec6Sopenharmony_ciCPPFLAGS += $(MOREFLAGS)
3627b27ec6Sopenharmony_ciFLAGS   = $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
3727b27ec6Sopenharmony_ci
3827b27ec6Sopenharmony_ciLZ4API = ../../lib/lz4.h
3927b27ec6Sopenharmony_ciLZ4MANUAL = ../../doc/lz4_manual.html
4027b27ec6Sopenharmony_ciLZ4FAPI = ../../lib/lz4frame.h
4127b27ec6Sopenharmony_ciLZ4FMANUAL = ../../doc/lz4frame_manual.html
4227b27ec6Sopenharmony_ciLIBVER_MAJOR_SCRIPT:=`sed -n '/define LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LZ4API)`
4327b27ec6Sopenharmony_ciLIBVER_MINOR_SCRIPT:=`sed -n '/define LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LZ4API)`
4427b27ec6Sopenharmony_ciLIBVER_PATCH_SCRIPT:=`sed -n '/define LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LZ4API)`
4527b27ec6Sopenharmony_ciLIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT)
4627b27ec6Sopenharmony_ciLZ4VER := $(shell echo $(LIBVER_SCRIPT))
4727b27ec6Sopenharmony_ci
4827b27ec6Sopenharmony_ci# Define *.exe as extension for Windows systems
4927b27ec6Sopenharmony_ciifneq (,$(filter Windows%,$(OS)))
5027b27ec6Sopenharmony_ciEXT =.exe
5127b27ec6Sopenharmony_cielse
5227b27ec6Sopenharmony_ciEXT =
5327b27ec6Sopenharmony_ciendif
5427b27ec6Sopenharmony_ci
5527b27ec6Sopenharmony_ci
5627b27ec6Sopenharmony_ci.PHONY: default
5727b27ec6Sopenharmony_cidefault: gen_manual
5827b27ec6Sopenharmony_ci
5927b27ec6Sopenharmony_cigen_manual: gen_manual.cpp
6027b27ec6Sopenharmony_ci	$(CXX) $(FLAGS) $^ -o $@$(EXT)
6127b27ec6Sopenharmony_ci
6227b27ec6Sopenharmony_ci$(LZ4MANUAL) : gen_manual $(LZ4API)
6327b27ec6Sopenharmony_ci	echo "Update lz4 manual in /doc"
6427b27ec6Sopenharmony_ci	./gen_manual $(LZ4VER) $(LZ4API) $@
6527b27ec6Sopenharmony_ci
6627b27ec6Sopenharmony_ci$(LZ4FMANUAL) : gen_manual $(LZ4FAPI)
6727b27ec6Sopenharmony_ci	echo "Update lz4frame manual in /doc"
6827b27ec6Sopenharmony_ci	./gen_manual $(LZ4VER) $(LZ4FAPI) $@
6927b27ec6Sopenharmony_ci
7027b27ec6Sopenharmony_ci.PHONY: manuals
7127b27ec6Sopenharmony_cimanuals: $(LZ4MANUAL) $(LZ4FMANUAL)
7227b27ec6Sopenharmony_ci
7327b27ec6Sopenharmony_ci.PHONY: clean
7427b27ec6Sopenharmony_ciclean:
7527b27ec6Sopenharmony_ci	@$(RM) gen_manual$(EXT)
7627b27ec6Sopenharmony_ci	@echo Cleaning completed
77