Makefile 2.8 KB

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