Makefile 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. CC := g++
  2. UNAME := $(shell uname)
  3. ifeq ($(UNAME), Darwin)
  4. OPENSSL_INCLUDE_PATH := /usr/local/opt/openssl@1.1/include
  5. OPENSSL_LIB_PATH := /usr/local/opt/openssl@1.1/lib
  6. else
  7. OPENSSL_INCLUDE_PATH := # use system default
  8. OPENSSL_LIB_PATH := # use system default
  9. endif
  10. MPIR_INCLUDE_PATH := # use system default
  11. MPIR_LIB_PATH := # use system default
  12. OUTPUT_DIR := ./bin/
  13. KEYGEN_HEADER := \
  14. BigInteger.hpp \
  15. EllipticCurveGF2m.hpp \
  16. GaloisField.hpp \
  17. Hasher.hpp \
  18. HasherCrc32Traits.hpp \
  19. HasherSha1Traits.hpp \
  20. WinRarConfig.hpp \
  21. WinRarKeygen.hpp
  22. KEYGEN_SOURCE := \
  23. _tmain.cpp
  24. KEYGEN_BINARY = $(OUTPUT_DIR)winrar-keygen
  25. keygen: $(KEYGEM_HEADER) $(KEYGEN_SOURCE)
  26. @if [ ! -d $(OUTPUT_DIR) ]; then mkdir -p $(OUTPUT_DIR); fi
  27. $(CC) -std=c++17 -O2 \
  28. $(if $(OPENSSL_INCLUDE_PATH),-I$(OPENSSL_INCLUDE_PATH),) $(if $(OPENSSL_LIB_PATH),-L$(OPENSSL_LIB_PATH),) \
  29. $(if $(MPIR_INCLUDE_PATH),-I$(MPIR_INCLUDE_PATH),) $(if $(MPIR_LIB_PATH),-L$(MPIR_LIB_PATH),) \
  30. $(KEYGEN_SOURCE) \
  31. -o $(KEYGEN_BINARY) \
  32. -lcrypto -lmpir
  33. @echo 'Done.'
  34. .PHONY: keygen
  35. clean:
  36. ifeq ($(wildcard $(KEYGEN_BINARY)), $(KEYGEN_BINARY))
  37. rm $(KEYGEN_BINARY)
  38. endif