Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 =
  8. OPENSSL_LIB_PATH =
  9. endif
  10. CAPSTONE_INCLUDE_PATH =
  11. CAPSTONE_LIB_PATH =
  12. KEYSTONE_INCLUDE_PATH =
  13. KEYSTONE_LIB_PATH =
  14. RAPIDJSON_INCLUDE_PATH =
  15. OUTPUT_DIR = ./bin/
  16. COMMON_DIR = ./common/
  17. PATCHER_DIR = ./navicat-patcher/
  18. KEYGEN_DIR = ./navicat-keygen/
  19. COMMON_HEADER = \
  20. $(COMMON_DIR)Exception.hpp \
  21. $(COMMON_DIR)ExceptionGeneric.hpp \
  22. $(COMMON_DIR)ExceptionOpenssl.hpp \
  23. $(COMMON_DIR)ExceptionSystem.hpp \
  24. $(COMMON_DIR)ResourceTraitsOpenssl.hpp \
  25. $(COMMON_DIR)ResourceWrapper.hpp \
  26. $(COMMON_DIR)RSACipher.hpp
  27. PATCHER_HEADER = \
  28. $(PATCHER_DIR)CapstoneDisassembler.hpp \
  29. $(PATCHER_DIR)KeystoneAssembler.hpp \
  30. $(PATCHER_DIR)Elf64Interpreter.hpp \
  31. $(PATCHER_DIR)ExceptionCapstone.hpp \
  32. $(PATCHER_DIR)ExceptionKeystone.hpp \
  33. $(PATCHER_DIR)MemoryAccess.hpp \
  34. $(PATCHER_DIR)Misc.hpp \
  35. $(PATCHER_DIR)PatchSolutions.hpp \
  36. $(PATCHER_DIR)ResourceTraitsCapstone.hpp \
  37. $(PATCHER_DIR)ResourceTraitsKeystone.hpp \
  38. $(PATCHER_DIR)ResourceTraitsUnix.hpp
  39. PATCHER_SOURCE = \
  40. $(PATCHER_DIR)CapstoneDisassembler.cpp \
  41. $(PATCHER_DIR)KeystoneAssembler.cpp \
  42. $(PATCHER_DIR)Elf64Interpreter.cpp \
  43. $(PATCHER_DIR)Misc.cpp \
  44. $(PATCHER_DIR)PatchSolution.cpp \
  45. $(PATCHER_DIR)PatchSolution0.cpp \
  46. $(PATCHER_DIR)main.cpp
  47. PATCHER_BINARY = $(OUTPUT_DIR)navicat-patcher
  48. KEYGEN_HEADER = \
  49. $(KEYGEN_DIR)Base32.hpp \
  50. $(KEYGEN_DIR)Base64.hpp \
  51. $(KEYGEN_DIR)SerialNumberGenerator.hpp
  52. KEYGEN_SOURCE = \
  53. $(KEYGEN_DIR)CollectInformation.cpp \
  54. $(KEYGEN_DIR)GenerateLicense.cpp \
  55. $(KEYGEN_DIR)main.cpp \
  56. $(KEYGEN_DIR)SerialNumberGenerator.cpp
  57. KEYGEN_BINARY = $(OUTPUT_DIR)navicat-keygen
  58. patcher: $(PATCHER_HEADER) $(PATCHER_SOURCE)
  59. @if [ ! -d $(OUTPUT_DIR) ]; then mkdir -p $(OUTPUT_DIR); fi
  60. $(CC) -std=c++17 -O2 \
  61. -I$(COMMON_DIR) \
  62. $(if $(OPENSSL_INCLUDE_PATH),-I$(OPENSSL_INCLUDE_PATH),) $(if $(OPENSSL_LIB_PATH),-L$(OPENSSL_LIB_PATH),) \
  63. $(if $(CAPSTONE_INCLUDE_PATH),-I$(CAPSTONE_INCLUDE_PATH),) $(if $(CAPSTONE_LIB_PATH),-L$(CAPSTONE_LIB_PATH),) \
  64. $(if $(KEYSTONE_INCLUDE_PATH),-I$(KEYSTONE_INCLUDE_PATH),) $(if $(KEYSTONE_LIB_PATH),-L$(KEYSTONE_LIB_PATH),) \
  65. $(PATCHER_SOURCE) -o $(PATCHER_BINARY) -lcrypto -lcapstone -lkeystone \
  66. -lstdc++fs
  67. @echo
  68. keygen: $(KEYGEM_HEADER) $(KEYGEN_SOURCE)
  69. @if [ ! -d $(OUTPUT_DIR) ]; then mkdir -p $(OUTPUT_DIR); fi
  70. $(CC) -std=c++17 -O2 \
  71. -I$(COMMON_DIR) \
  72. $(if $(OPENSSL_INCLUDE_PATH),-I$(OPENSSL_INCLUDE_PATH),) $(if $(OPENSSL_LIB_PATH),-L$(OPENSSL_LIB_PATH),) \
  73. $(if $(RAPIDJSON_INCLUDE_PATH),-I$(RAPIDJSON_INCLUDE_PATH),) \
  74. $(KEYGEN_SOURCE) -o $(KEYGEN_BINARY) -lcrypto
  75. all: patcher keygen
  76. @echo 'Done.'
  77. .PHONY: all
  78. clean:
  79. ifeq ($(wildcard $(PATCHER_BINARY)), $(PATCHER_BINARY))
  80. rm $(PATCHER_BINARY)
  81. endif
  82. ifeq ($(wildcard $(KEYGEN_BINARY)), $(KEYGEN_BINARY))
  83. rm $(KEYGEN_BINARY)
  84. endif