makefile 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #CXX=g++-8
  2. #CC=gcc-8
  3. PLATFORM=$(shell uname -i)
  4. CXXFLAGS=-std=c++11
  5. CCFLAGS=
  6. ifeq ($(PLATFORM),x86_64)
  7. CXXFLAGS += -maes
  8. endif
  9. BINDIR=bin
  10. SRCDIR=src
  11. OBJDIR=obj
  12. LDFLAGS=-lpthread
  13. TOBJS=$(addprefix $(OBJDIR)/,instructionsPortable.o TestAluFpu.o)
  14. 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 t1ha2.o Cache.o virtualMemory.o divideByConstantCodegen.o)
  15. ifeq ($(PLATFORM),x86_64)
  16. ROBJS += $(OBJDIR)/JitCompilerX86-static.o
  17. endif
  18. all: release test
  19. release: CXXFLAGS += -march=native -O3 -flto
  20. release: CCFLAGS += -march=native -O3 -flto
  21. release: $(BINDIR)/randomx
  22. debug: CXXFLAGS += -g
  23. debug: CCFLAGS += -g
  24. debug: LDFLAGS += -g
  25. debug: $(BINDIR)/randomx
  26. test: CXXFLAGS += -O0
  27. test: $(BINDIR)/AluFpuTest
  28. $(BINDIR)/randomx: $(ROBJS) | $(BINDIR)
  29. $(CXX) $(ROBJS) $(LDFLAGS) -o $@
  30. $(BINDIR)/AluFpuTest: $(TOBJS) | $(BINDIR)
  31. $(CXX) $(TOBJS) $(LDFLAGS) -o $@
  32. $(OBJDIR)/TestAluFpu.o: $(addprefix $(SRCDIR)/,TestAluFpu.cpp instructions.hpp Pcg32.hpp) | $(OBJDIR)
  33. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/TestAluFpu.cpp -o $@
  34. $(OBJDIR)/argon2_core.o: $(addprefix $(SRCDIR)/,argon2_core.c argon2_core.h blake2/blake2.h blake2/blake2-impl.h) | $(OBJDIR)
  35. $(CC) $(CCFLAGS) -c $(SRCDIR)/argon2_core.c -o $@
  36. $(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)
  37. $(CC) $(CCFLAGS) -c $(SRCDIR)/argon2_ref.c -o $@
  38. $(OBJDIR)/AssemblyGeneratorX86.o: $(addprefix $(SRCDIR)/,AssemblyGeneratorX86.cpp AssemblyGeneratorX86.hpp Instruction.hpp Pcg32.hpp common.hpp instructions.hpp instructionWeights.hpp) | $(OBJDIR)
  39. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/AssemblyGeneratorX86.cpp -o $@
  40. $(OBJDIR)/blake2b.o: $(addprefix $(SRCDIR)/blake2/,blake2b.c blake2.h blake2-impl.h) | $(OBJDIR)
  41. $(CC) $(CCFLAGS) -c $(SRCDIR)/blake2/blake2b.c -o $@
  42. $(OBJDIR)/CompiledVirtualMachine.o: $(addprefix $(SRCDIR)/,CompiledVirtualMachine.cpp CompiledVirtualMachine.hpp Pcg32.hpp common.hpp instructions.hpp) | $(OBJDIR)
  43. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/CompiledVirtualMachine.cpp -o $@
  44. $(OBJDIR)/dataset.o: $(addprefix $(SRCDIR)/,dataset.cpp common.hpp Pcg32.hpp) | $(OBJDIR)
  45. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/dataset.cpp -o $@
  46. $(OBJDIR)/divideByConstantCodegen.o: $(addprefix $(SRCDIR)/,divideByConstantCodegen.c divideByConstantCodegen.h) | $(OBJDIR)
  47. $(CC) $(CCFLAGS) -c $(SRCDIR)/divideByConstantCodegen.c -o $@
  48. $(OBJDIR)/JitCompilerX86.o: $(addprefix $(SRCDIR)/,JitCompilerX86.cpp JitCompilerX86.hpp Instruction.hpp instructionWeights.hpp) | $(OBJDIR)
  49. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/JitCompilerX86.cpp -o $@
  50. $(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.inc)) | $(OBJDIR)
  51. $(CXX) -x assembler-with-cpp -c $(SRCDIR)/JitCompilerX86-static.S -o $@
  52. $(OBJDIR)/instructionsPortable.o: $(addprefix $(SRCDIR)/,instructionsPortable.cpp instructions.hpp intrinPortable.h) | $(OBJDIR)
  53. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/instructionsPortable.cpp -o $@
  54. $(OBJDIR)/Instruction.o: $(addprefix $(SRCDIR)/,Instruction.cpp Instruction.hpp instructionWeights.hpp) | $(OBJDIR)
  55. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/Instruction.cpp -o $@
  56. $(OBJDIR)/InterpretedVirtualMachine.o: $(addprefix $(SRCDIR)/,InterpretedVirtualMachine.cpp InterpretedVirtualMachine.hpp Pcg32.hpp instructions.hpp instructionWeights.hpp) | $(OBJDIR)
  57. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/InterpretedVirtualMachine.cpp -o $@
  58. $(OBJDIR)/main.o: $(addprefix $(SRCDIR)/,main.cpp InterpretedVirtualMachine.hpp Stopwatch.hpp blake2/blake2.h) | $(OBJDIR)
  59. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/main.cpp -o $@
  60. $(OBJDIR)/Program.o: $(addprefix $(SRCDIR)/,Program.cpp Program.hpp Pcg32.hpp) | $(OBJDIR)
  61. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/Program.cpp -o $@
  62. $(OBJDIR)/Cache.o: $(addprefix $(SRCDIR)/,Cache.cpp Cache.hpp Pcg32.hpp argon2_core.h) | $(OBJDIR)
  63. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/Cache.cpp -o $@
  64. $(OBJDIR)/softAes.o: $(addprefix $(SRCDIR)/,softAes.cpp softAes.h) | $(OBJDIR)
  65. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/softAes.cpp -o $@
  66. $(OBJDIR)/VirtualMachine.o: $(addprefix $(SRCDIR)/,VirtualMachine.cpp VirtualMachine.hpp common.hpp dataset.hpp) | $(OBJDIR)
  67. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/VirtualMachine.cpp -o $@
  68. $(OBJDIR)/virtualMemory.o: $(addprefix $(SRCDIR)/,virtualMemory.cpp virtualMemory.hpp) | $(OBJDIR)
  69. $(CXX) $(CXXFLAGS) -c $(SRCDIR)/virtualMemory.cpp -o $@
  70. $(OBJDIR)/t1ha2.o: $(addprefix $(SRCDIR)/t1ha/,t1ha2.c t1ha.h t1ha_bits.h) | $(OBJDIR)
  71. $(CC) $(CCFLAGS) -c $(SRCDIR)/t1ha/t1ha2.c -o $@
  72. $(OBJDIR):
  73. mkdir $(OBJDIR)
  74. $(BINDIR):
  75. mkdir $(BINDIR)
  76. clean:
  77. rm -f $(BINDIR)/randomx $(BINDIR)/AluFpuTest $(OBJDIR)/*.o