Makefile 1.6 KB

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