makefile 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #CXX=g++-8
  2. #CC=gcc-8
  3. PLATFORM=$(shell uname -m)
  4. CXXFLAGS=-std=c++11
  5. CCFLAGS=
  6. ifeq ($(PLATFORM),amd64)
  7. CXXFLAGS += -maes
  8. endif
  9. ifeq ($(PLATFORM),x86_64)
  10. CXXFLAGS += -maes
  11. endif
  12. BINDIR=bin
  13. SRCDIR=src
  14. OBJDIR=obj
  15. LDFLAGS=-lpthread
  16. TOBJS=$(addprefix $(OBJDIR)/,instructionsPortable.o TestAluFpu.o)
  17. ROBJS=$(addprefix $(OBJDIR)/,argon2_core.o argon2_ref.o AssemblyGeneratorX86.o blake2b.o CompiledVirtualMachine.o dataset.o JitCompilerX86.o instructionsPortable.o Instruction.o InterpretedVirtualMachine.o main.o Program.o softAes.o VirtualMachine.o Cache.o virtualMemory.o divideByConstantCodegen.o LightClientAsyncWorker.o hashAes1Rx4.o)
  18. ifeq ($(PLATFORM),amd64)
  19. ROBJS += $(OBJDIR)/JitCompilerX86-static.o $(OBJDIR)/squareHash.o
  20. endif
  21. ifeq ($(PLATFORM),x86_64)
  22. ROBJS += $(OBJDIR)/JitCompilerX86-static.o $(OBJDIR)/squareHash.o
  23. endif
  24. all: release
  25. release: CXXFLAGS += -march=native -O3 -flto
  26. release: CCFLAGS += -march=native -O3 -flto
  27. release: $(BINDIR)/randomx
  28. debug: CXXFLAGS += -g
  29. debug: CCFLAGS += -g
  30. debug: LDFLAGS += -g
  31. debug: $(BINDIR)/randomx
  32. profile: CXXFLAGS += -pg
  33. profile: CCFLAGS += -pg
  34. profile: LDFLAGS += -pg
  35. profile: $(BINDIR)/randomx
  36. test: CXXFLAGS += -O0
  37. test: $(BINDIR)/AluFpuTest
  38. $(BINDIR)/randomx: $(ROBJS) | $(BINDIR)
  39. $(CXX) $(ROBJS) $(LDFLAGS) -o $@
  40. $(BINDIR)/AluFpuTest: $(TOBJS) | $(BINDIR)
  41. $(CXX) $(TOBJS) $(LDFLAGS) -o $@
  42. $(OBJDIR)/TestAluFpu.o: $(addprefix $(SRCDIR)/,TestAluFpu.cpp instructions.hpp) | $(OBJDIR)
  43. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/TestAluFpu.cpp -o $@
  44. $(OBJDIR)/argon2_core.o: $(addprefix $(SRCDIR)/,argon2_core.c argon2_core.h blake2/blake2.h blake2/blake2-impl.h) | $(OBJDIR)
  45. $(CC) $(CCFLAGS) -c $(SRCDIR)/argon2_core.c -o $@
  46. $(OBJDIR)/argon2_ref.o: $(addprefix $(SRCDIR)/,argon2_ref.c argon2.h argon2_core.h blake2/blake2.h blake2/blake2-impl.h blake2/blamka-round-ref.h) | $(OBJDIR)
  47. $(CC) $(CCFLAGS) -c $(SRCDIR)/argon2_ref.c -o $@
  48. $(OBJDIR)/AssemblyGeneratorX86.o: $(addprefix $(SRCDIR)/,AssemblyGeneratorX86.cpp AssemblyGeneratorX86.hpp Instruction.hpp common.hpp instructionWeights.hpp) | $(OBJDIR)
  49. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/AssemblyGeneratorX86.cpp -o $@
  50. $(OBJDIR)/blake2b.o: $(addprefix $(SRCDIR)/blake2/,blake2b.c blake2.h blake2-impl.h) | $(OBJDIR)
  51. $(CC) $(CCFLAGS) -c $(SRCDIR)/blake2/blake2b.c -o $@
  52. $(OBJDIR)/CompiledVirtualMachine.o: $(addprefix $(SRCDIR)/,CompiledVirtualMachine.cpp CompiledVirtualMachine.hpp common.hpp) | $(OBJDIR)
  53. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/CompiledVirtualMachine.cpp -o $@
  54. $(OBJDIR)/dataset.o: $(addprefix $(SRCDIR)/,dataset.cpp common.hpp) | $(OBJDIR)
  55. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/dataset.cpp -o $@
  56. $(OBJDIR)/divideByConstantCodegen.o: $(addprefix $(SRCDIR)/,divideByConstantCodegen.c divideByConstantCodegen.h) | $(OBJDIR)
  57. $(CC) $(CCFLAGS) -c $(SRCDIR)/divideByConstantCodegen.c -o $@
  58. $(OBJDIR)/hashAes1Rx4.o: $(addprefix $(SRCDIR)/,hashAes1Rx4.cpp softAes.h) | $(OBJDIR)
  59. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/hashAes1Rx4.cpp -o $@
  60. $(OBJDIR)/JitCompilerX86.o: $(addprefix $(SRCDIR)/,JitCompilerX86.cpp JitCompilerX86.hpp Instruction.hpp instructionWeights.hpp) | $(OBJDIR)
  61. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/JitCompilerX86.cpp -o $@
  62. $(OBJDIR)/JitCompilerX86-static.o: $(addprefix $(SRCDIR)/,JitCompilerX86-static.S $(addprefix asm/program_, prologue_linux.inc prologue_load.inc epilogue_linux.inc epilogue_store.inc read_dataset.inc loop_load.inc loop_store.inc xmm_constants.inc)) | $(OBJDIR)
  63. $(CXX) -x assembler-with-cpp -c $(SRCDIR)/JitCompilerX86-static.S -o $@
  64. $(OBJDIR)/squareHash.o: $(addprefix $(SRCDIR)/,squareHash.S $(addprefix asm/, squareHash.inc)) | $(OBJDIR)
  65. $(CXX) -x assembler-with-cpp -c $(SRCDIR)/squareHash.S -o $@
  66. $(OBJDIR)/instructionsPortable.o: $(addprefix $(SRCDIR)/,instructionsPortable.cpp intrinPortable.h) | $(OBJDIR)
  67. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/instructionsPortable.cpp -o $@
  68. $(OBJDIR)/Instruction.o: $(addprefix $(SRCDIR)/,Instruction.cpp Instruction.hpp instructionWeights.hpp) | $(OBJDIR)
  69. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/Instruction.cpp -o $@
  70. $(OBJDIR)/InterpretedVirtualMachine.o: $(addprefix $(SRCDIR)/,InterpretedVirtualMachine.cpp InterpretedVirtualMachine.hpp instructionWeights.hpp) | $(OBJDIR)
  71. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/InterpretedVirtualMachine.cpp -o $@
  72. $(OBJDIR)/LightClientAsyncWorker.o: $(addprefix $(SRCDIR)/,LightClientAsyncWorker.cpp LightClientAsyncWorker.hpp common.hpp) | $(OBJDIR)
  73. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/LightClientAsyncWorker.cpp -o $@
  74. $(OBJDIR)/main.o: $(addprefix $(SRCDIR)/,main.cpp InterpretedVirtualMachine.hpp Stopwatch.hpp blake2/blake2.h) | $(OBJDIR)
  75. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/main.cpp -o $@
  76. $(OBJDIR)/Program.o: $(addprefix $(SRCDIR)/,Program.cpp Program.hpp) | $(OBJDIR)
  77. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/Program.cpp -o $@
  78. $(OBJDIR)/Cache.o: $(addprefix $(SRCDIR)/,Cache.cpp Cache.hpp argon2_core.h) | $(OBJDIR)
  79. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/Cache.cpp -o $@
  80. $(OBJDIR)/softAes.o: $(addprefix $(SRCDIR)/,softAes.cpp softAes.h) | $(OBJDIR)
  81. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/softAes.cpp -o $@
  82. $(OBJDIR)/VirtualMachine.o: $(addprefix $(SRCDIR)/,VirtualMachine.cpp VirtualMachine.hpp common.hpp dataset.hpp) | $(OBJDIR)
  83. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/VirtualMachine.cpp -o $@
  84. $(OBJDIR)/virtualMemory.o: $(addprefix $(SRCDIR)/,virtualMemory.cpp virtualMemory.hpp) | $(OBJDIR)
  85. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/virtualMemory.cpp -o $@
  86. $(OBJDIR):
  87. mkdir $(OBJDIR)
  88. $(BINDIR):
  89. mkdir $(BINDIR)
  90. clean:
  91. rm -f $(BINDIR)/randomx $(BINDIR)/AluFpuTest $(OBJDIR)/*.o