648db22b |
1 | # ################################################################ |
2 | # Copyright (c) Meta Platforms, Inc. and affiliates. |
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 | |
10 | CXXFLAGS ?= -O3 |
11 | CXXFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 -Wswitch-enum -Wno-comment |
12 | CXXFLAGS += $(MOREFLAGS) |
13 | FLAGS = $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) |
14 | |
15 | ZSTDAPI = ../../lib/zstd.h |
16 | ZSTDMANUAL = ../../doc/zstd_manual.html |
17 | LIBVER_MAJOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(ZSTDAPI)` |
18 | LIBVER_MINOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(ZSTDAPI)` |
19 | LIBVER_PATCH_SCRIPT:=`sed -n '/define ZSTD_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(ZSTDAPI)` |
20 | LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT) |
21 | LIBVER := $(shell echo $(LIBVER_SCRIPT)) |
22 | |
23 | |
24 | # Define *.exe as extension for Windows systems |
25 | ifneq (,$(filter Windows%,$(OS))) |
26 | EXT =.exe |
27 | else |
28 | EXT = |
29 | endif |
30 | |
31 | |
32 | .PHONY: default |
33 | default: gen_html |
34 | |
35 | .PHONY: all |
36 | all: manual |
37 | |
38 | gen_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 |
46 | manual: gen_html $(ZSTDMANUAL) |
47 | |
48 | .PHONY: clean |
49 | clean: |
50 | @$(RM) gen_html$(EXT) |
51 | @echo Cleaning completed |