Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # ################################################################
  2. # Copyright (c) Yann Collet, 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. # You may select, at your option, one of the above-listed licenses.
  9. # ################################################################
  10. LIBDIR =../lib
  11. CPPFLAGS += -I$(LIBDIR)
  12. LIB = $(LIBDIR)/libzstd.a
  13. .PHONY: default
  14. default: all
  15. .PHONY: all
  16. all: simple_compression simple_decompression \
  17. multiple_simple_compression\
  18. dictionary_compression dictionary_decompression \
  19. streaming_compression streaming_decompression \
  20. multiple_streaming_compression streaming_memory_usage
  21. $(LIB) :
  22. $(MAKE) -C $(LIBDIR) libzstd.a
  23. simple_compression.o: common.h
  24. simple_compression : $(LIB)
  25. simple_decompression.o: common.h
  26. simple_decompression : $(LIB)
  27. multiple_simple_compression.o: common.h
  28. multiple_simple_compression : $(LIB)
  29. dictionary_compression.o: common.h
  30. dictionary_compression : $(LIB)
  31. dictionary_decompression.o: common.h
  32. dictionary_decompression : $(LIB)
  33. streaming_compression.o: common.h
  34. streaming_compression : $(LIB)
  35. multiple_streaming_compression.o: common.h
  36. multiple_streaming_compression : $(LIB)
  37. streaming_decompression.o: common.h
  38. streaming_decompression : $(LIB)
  39. streaming_memory_usage.o: common.h
  40. streaming_memory_usage : $(LIB)
  41. .PHONY:clean
  42. clean:
  43. @$(RM) core *.o tmp* result* *.zst \
  44. simple_compression simple_decompression \
  45. multiple_simple_compression \
  46. dictionary_compression dictionary_decompression \
  47. streaming_compression streaming_decompression \
  48. multiple_streaming_compression streaming_memory_usage
  49. @echo Cleaning completed
  50. .PHONY:test
  51. test: all
  52. cp README.md tmp
  53. cp Makefile tmp2
  54. @echo -- Simple compression tests
  55. ./simple_compression tmp
  56. ./simple_decompression tmp.zst
  57. ./multiple_simple_compression *.c
  58. ./streaming_decompression tmp.zst > /dev/null
  59. @echo -- Streaming memory usage
  60. ./streaming_memory_usage
  61. @echo -- Streaming compression tests
  62. ./streaming_compression tmp
  63. ./streaming_decompression tmp.zst > /dev/null
  64. @echo -- Edge cases detection
  65. ! ./streaming_decompression tmp # invalid input, must fail
  66. ! ./simple_decompression tmp # invalid input, must fail
  67. touch tmpNull # create 0-size file
  68. ./simple_compression tmpNull
  69. ./simple_decompression tmpNull.zst # 0-size frame : must work
  70. @echo -- Multiple streaming tests
  71. ./multiple_streaming_compression *.c
  72. @echo -- Dictionary compression tests
  73. ./dictionary_compression tmp2 tmp README.md
  74. ./dictionary_decompression tmp2.zst tmp.zst README.md
  75. $(RM) tmp* *.zst
  76. @echo tests completed