1# ################################################################ 2# Copyright (c) 2016-present, Facebook, Inc. 3# All rights reserved. 4# 5# This source code is licensed under both the BSD-style license (found in the 6# LICENSE file in the root directory of this source tree) and the GPLv2 (found 7# in the COPYING file in the root directory of this source tree). 8# ################################################################ 9 10CXXFLAGS ?= -O3 11CXXFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 -Wswitch-enum -Wno-comment 12CXXFLAGS += $(MOREFLAGS) 13FLAGS = $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) 14 15ZSTDAPI = ../../lib/zstd.h 16ZSTDMANUAL = ../../doc/zstd_manual.html 17LIBVER_MAJOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(ZSTDAPI)` 18LIBVER_MINOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(ZSTDAPI)` 19LIBVER_PATCH_SCRIPT:=`sed -n '/define ZSTD_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(ZSTDAPI)` 20LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT) 21LIBVER := $(shell echo $(LIBVER_SCRIPT)) 22 23 24# Define *.exe as extension for Windows systems 25ifneq (,$(filter Windows%,$(OS))) 26EXT =.exe 27else 28EXT = 29endif 30 31 32.PHONY: default 33default: gen_html 34 35.PHONY: all 36all: manual 37 38gen_html: gen_html.cpp 39 $(CXX) $(FLAGS) $^ -o $@$(EXT) 40 41$(ZSTDMANUAL): gen_html $(ZSTDAPI) 42 echo "Update zstd manual in /doc" 43 ./gen_html $(LIBVER) $(ZSTDAPI) $(ZSTDMANUAL) 44 45.PHONY: manual 46manual: gen_html $(ZSTDMANUAL) 47 48.PHONY: clean 49clean: 50 @$(RM) gen_html$(EXT) 51 @echo Cleaning completed 52