2018-12-11 20:00:30 +00:00
|
|
|
#CXX=g++-8
|
|
|
|
#CC=gcc-8
|
2019-04-21 13:04:17 +00:00
|
|
|
AR=gcc-ar
|
2019-02-11 14:51:34 +00:00
|
|
|
PLATFORM=$(shell uname -m)
|
2019-06-13 03:18:38 +00:00
|
|
|
OS=$(shell uname -s)
|
2018-12-23 13:09:09 +00:00
|
|
|
CXXFLAGS=-std=c++11
|
2019-04-28 14:42:45 +00:00
|
|
|
CCFLAGS=-std=c99
|
2019-04-26 09:07:47 +00:00
|
|
|
ARFLAGS=rcs
|
2018-12-11 20:00:30 +00:00
|
|
|
BINDIR=bin
|
|
|
|
SRCDIR=src
|
2019-04-21 13:04:17 +00:00
|
|
|
TESTDIR=src/tests
|
2018-12-11 20:00:30 +00:00
|
|
|
OBJDIR=obj
|
2018-12-19 20:54:44 +00:00
|
|
|
LDFLAGS=-lpthread
|
2019-05-30 15:17:32 +00:00
|
|
|
RXA=$(BINDIR)/librandomx.a
|
2019-04-21 13:04:17 +00:00
|
|
|
BINARIES=$(RXA) $(BINDIR)/benchmark $(BINDIR)/code-generator
|
2019-05-12 20:31:48 +00:00
|
|
|
RXOBJS=$(addprefix $(OBJDIR)/,aes_hash.o argon2_ref.o dataset.o soft_aes.o virtual_memory.o vm_interpreted.o allocator.o assembly_generator_x86.o instruction.o randomx.o superscalar.o vm_compiled.o vm_interpreted_light.o argon2_core.o blake2_generator.o instructions_portable.o reciprocal.o virtual_machine.o vm_compiled_light.o blake2b.o)
|
2019-02-11 14:51:34 +00:00
|
|
|
ifeq ($(PLATFORM),amd64)
|
2019-05-12 20:31:48 +00:00
|
|
|
RXOBJS += $(addprefix $(OBJDIR)/,jit_compiler_x86_static.o jit_compiler_x86.o)
|
2019-02-19 21:47:05 +00:00
|
|
|
CXXFLAGS += -maes
|
2019-02-11 14:51:34 +00:00
|
|
|
endif
|
2018-12-31 18:06:45 +00:00
|
|
|
ifeq ($(PLATFORM),x86_64)
|
2019-05-12 20:31:48 +00:00
|
|
|
RXOBJS += $(addprefix $(OBJDIR)/,jit_compiler_x86_static.o jit_compiler_x86.o)
|
2019-02-19 21:47:05 +00:00
|
|
|
CXXFLAGS += -maes
|
2018-12-31 18:06:45 +00:00
|
|
|
endif
|
2019-06-13 03:18:38 +00:00
|
|
|
ifeq ($(OS),Darwin)
|
|
|
|
AR=ar
|
|
|
|
endif
|
2018-12-11 20:00:30 +00:00
|
|
|
|
2019-04-26 09:07:47 +00:00
|
|
|
release: CXXFLAGS += -O3 -flto
|
|
|
|
release: CCFLAGS += -O3 -flto
|
2019-03-22 10:00:21 +00:00
|
|
|
release: LDFLAGS += -flto
|
2019-04-21 13:04:17 +00:00
|
|
|
release: $(BINARIES)
|
2018-12-11 20:00:30 +00:00
|
|
|
|
2019-04-26 09:07:47 +00:00
|
|
|
native: CXXFLAGS += -march=native -O3 -flto
|
|
|
|
native: CCFLAGS += -march=native -O3 -flto
|
|
|
|
native: $(BINARIES)
|
|
|
|
|
|
|
|
nolto: CXXFLAGS += -O3
|
|
|
|
nolto: CCFLAGS += -O3
|
2019-04-21 13:04:17 +00:00
|
|
|
nolto: $(BINARIES)
|
2019-03-22 10:00:21 +00:00
|
|
|
|
2018-12-11 20:00:30 +00:00
|
|
|
debug: CXXFLAGS += -g
|
|
|
|
debug: CCFLAGS += -g
|
|
|
|
debug: LDFLAGS += -g
|
2019-04-21 13:04:17 +00:00
|
|
|
debug: $(BINARIES)
|
2018-12-11 20:00:30 +00:00
|
|
|
|
2019-01-18 16:57:47 +00:00
|
|
|
profile: CXXFLAGS += -pg
|
|
|
|
profile: CCFLAGS += -pg
|
|
|
|
profile: LDFLAGS += -pg
|
2019-04-21 13:04:17 +00:00
|
|
|
profile: $(BINDIR)/benchmark
|
2019-01-18 16:57:47 +00:00
|
|
|
|
2018-12-11 20:00:30 +00:00
|
|
|
test: CXXFLAGS += -O0
|
2018-12-19 11:38:10 +00:00
|
|
|
|
2019-04-26 09:07:47 +00:00
|
|
|
$(RXA): $(RXOBJS) | $(BINDIR)
|
|
|
|
$(AR) $(ARFLAGS) $@ $(RXOBJS)
|
2018-12-11 20:00:30 +00:00
|
|
|
$(OBJDIR):
|
|
|
|
mkdir $(OBJDIR)
|
|
|
|
$(BINDIR):
|
|
|
|
mkdir $(BINDIR)
|
2019-04-21 13:04:17 +00:00
|
|
|
$(OBJDIR)/benchmark.o: $(TESTDIR)/benchmark.cpp $(TESTDIR)/stopwatch.hpp \
|
2019-06-13 03:18:38 +00:00
|
|
|
$(TESTDIR)/utility.hpp $(SRCDIR)/randomx.h $(SRCDIR)/blake2/endian.h $(SRCDIR)/affinity.hpp
|
2019-04-21 13:04:17 +00:00
|
|
|
$(CXX) $(CXXFLAGS) -pthread -c $< -o $@
|
2019-06-13 03:18:38 +00:00
|
|
|
$(BINDIR)/benchmark: $(OBJDIR)/benchmark.o $(OBJDIR)/affinity.o $(RXA)
|
|
|
|
$(CXX) $(LDFLAGS) -pthread $< $(OBJDIR)/affinity.o $(RXA) -o $@
|
2019-04-21 13:04:17 +00:00
|
|
|
$(OBJDIR)/code-generator.o: $(TESTDIR)/code-generator.cpp $(TESTDIR)/utility.hpp \
|
|
|
|
$(SRCDIR)/common.hpp $(SRCDIR)/blake2/endian.h \
|
|
|
|
$(SRCDIR)/configuration.h $(SRCDIR)/randomx.h \
|
|
|
|
$(SRCDIR)/assembly_generator_x86.hpp $(SRCDIR)/superscalar.hpp \
|
|
|
|
$(SRCDIR)/superscalar_program.hpp $(SRCDIR)/instruction.hpp \
|
|
|
|
$(SRCDIR)/blake2_generator.hpp $(SRCDIR)/aes_hash.hpp \
|
|
|
|
$(SRCDIR)/blake2/blake2.h $(SRCDIR)/program.hpp
|
|
|
|
$(CXX) $(CXXFLAGS) -c $< -o $@
|
|
|
|
$(BINDIR)/code-generator: $(OBJDIR)/code-generator.o $(RXA)
|
|
|
|
$(CXX) $(LDFLAGS) $< $(RXA) -o $@
|
2019-04-26 09:07:47 +00:00
|
|
|
$(OBJDIR)/aes_hash.o: $(SRCDIR)/aes_hash.cpp $(SRCDIR)/soft_aes.h $(SRCDIR)/intrin_portable.h | $(OBJDIR)
|
2019-04-21 13:04:17 +00:00
|
|
|
$(OBJDIR)/argon2_ref.o: $(SRCDIR)/argon2_ref.c $(SRCDIR)/argon2.h $(SRCDIR)/argon2_core.h \
|
|
|
|
$(SRCDIR)/blake2/blamka-round-ref.h $(SRCDIR)/blake2/blake2.h \
|
|
|
|
$(SRCDIR)/blake2/blake2-impl.h $(SRCDIR)/blake2/endian.h $(SRCDIR)/blake2/blake2-impl.h \
|
|
|
|
$(SRCDIR)/blake2/blake2.h
|
|
|
|
$(OBJDIR)/blake2b.o: $(SRCDIR)/blake2/blake2b.c $(SRCDIR)/blake2/blake2.h \
|
|
|
|
$(SRCDIR)/blake2/blake2-impl.h $(SRCDIR)/blake2/endian.h
|
|
|
|
$(CC) $(CCFLAGS) -c $< -o $@
|
|
|
|
$(OBJDIR)/dataset.o: $(SRCDIR)/dataset.cpp $(SRCDIR)/common.hpp $(SRCDIR)/blake2/endian.h \
|
|
|
|
$(SRCDIR)/configuration.h $(SRCDIR)/randomx.h $(SRCDIR)/dataset.hpp \
|
|
|
|
$(SRCDIR)/superscalar_program.hpp $(SRCDIR)/instruction.hpp $(SRCDIR)/jit_compiler_x86.hpp \
|
|
|
|
$(SRCDIR)/allocator.hpp $(SRCDIR)/virtual_memory.hpp $(SRCDIR)/superscalar.hpp \
|
2019-04-28 14:42:45 +00:00
|
|
|
$(SRCDIR)/blake2_generator.hpp $(SRCDIR)/reciprocal.h $(SRCDIR)/argon2.h $(SRCDIR)/argon2_core.h \
|
|
|
|
$(SRCDIR)/intrin_portable.h
|
2019-04-21 13:04:17 +00:00
|
|
|
$(OBJDIR)/jit_compiler_x86.o: $(SRCDIR)/jit_compiler_x86.cpp $(SRCDIR)/jit_compiler_x86.hpp \
|
|
|
|
$(SRCDIR)/common.hpp $(SRCDIR)/blake2/endian.h $(SRCDIR)/configuration.h $(SRCDIR)/randomx.h \
|
|
|
|
$(SRCDIR)/jit_compiler_x86_static.hpp $(SRCDIR)/superscalar.hpp \
|
|
|
|
$(SRCDIR)/superscalar_program.hpp $(SRCDIR)/instruction.hpp $(SRCDIR)/blake2_generator.hpp \
|
|
|
|
$(SRCDIR)/program.hpp $(SRCDIR)/reciprocal.h $(SRCDIR)/virtual_memory.hpp \
|
|
|
|
$(SRCDIR)/instruction_weights.hpp
|
2019-05-06 16:14:00 +00:00
|
|
|
$(OBJDIR)/jit_compiler_x86_static.o: $(SRCDIR)/jit_compiler_x86_static.S $(SRCDIR)/configuration.h \
|
2019-04-21 13:04:17 +00:00
|
|
|
$(SRCDIR)/asm/program_prologue_linux.inc $(SRCDIR)/asm/program_xmm_constants.inc \
|
|
|
|
$(SRCDIR)/asm/program_loop_load.inc $(SRCDIR)/asm/program_read_dataset.inc \
|
|
|
|
$(SRCDIR)/asm/program_read_dataset_sshash_init.inc \
|
|
|
|
$(SRCDIR)/asm/program_read_dataset_sshash_fin.inc \
|
|
|
|
$(SRCDIR)/asm/program_loop_store.inc $(SRCDIR)/asm/program_epilogue_linux.inc \
|
|
|
|
$(SRCDIR)/asm/program_epilogue_store.inc $(SRCDIR)/asm/program_sshash_load.inc \
|
2019-05-04 17:40:25 +00:00
|
|
|
$(SRCDIR)/asm/program_sshash_prefetch.inc $(SRCDIR)/asm/program_sshash_constants.inc \
|
|
|
|
$(SRCDIR)/asm/randomx_reciprocal.inc
|
2019-04-21 13:04:17 +00:00
|
|
|
$(OBJDIR)/soft_aes.o: $(SRCDIR)/soft_aes.cpp $(SRCDIR)/soft_aes.h $(SRCDIR)/intrin_portable.h
|
|
|
|
$(OBJDIR)/virtual_memory.o: $(SRCDIR)/virtual_memory.cpp $(SRCDIR)/virtual_memory.hpp
|
|
|
|
$(OBJDIR)/vm_interpreted.o: $(SRCDIR)/vm_interpreted.cpp $(SRCDIR)/vm_interpreted.hpp \
|
|
|
|
$(SRCDIR)/common.hpp $(SRCDIR)/blake2/endian.h $(SRCDIR)/configuration.h $(SRCDIR)/randomx.h \
|
|
|
|
$(SRCDIR)/virtual_machine.hpp $(SRCDIR)/program.hpp $(SRCDIR)/instruction.hpp \
|
|
|
|
$(SRCDIR)/intrin_portable.h $(SRCDIR)/allocator.hpp $(SRCDIR)/dataset.hpp \
|
|
|
|
$(SRCDIR)/superscalar_program.hpp $(SRCDIR)/jit_compiler_x86.hpp $(SRCDIR)/reciprocal.h \
|
|
|
|
$(SRCDIR)/instruction_weights.hpp
|
2019-06-13 03:18:38 +00:00
|
|
|
$(OBJDIR/affinity.o: $(SRCDIR)/affinity.cpp $(SRCDIR)/affinity.hpp
|
2019-04-21 13:04:17 +00:00
|
|
|
$(OBJDIR)/allocator.o: $(SRCDIR)/allocator.cpp $(SRCDIR)/allocator.hpp $(SRCDIR)/intrin_portable.h \
|
|
|
|
$(SRCDIR)/virtual_memory.hpp $(SRCDIR)/common.hpp $(SRCDIR)/blake2/endian.h \
|
|
|
|
$(SRCDIR)/configuration.h $(SRCDIR)/randomx.h
|
|
|
|
$(OBJDIR)/assembly_generator_x86.o: $(SRCDIR)/assembly_generator_x86.cpp \
|
|
|
|
$(SRCDIR)/assembly_generator_x86.hpp $(SRCDIR)/common.hpp $(SRCDIR)/blake2/endian.h \
|
|
|
|
$(SRCDIR)/configuration.h $(SRCDIR)/randomx.h $(SRCDIR)/reciprocal.h $(SRCDIR)/program.hpp \
|
|
|
|
$(SRCDIR)/instruction.hpp $(SRCDIR)/superscalar.hpp $(SRCDIR)/superscalar_program.hpp \
|
|
|
|
$(SRCDIR)/blake2_generator.hpp $(SRCDIR)/instruction_weights.hpp
|
|
|
|
$(OBJDIR)/instruction.o: $(SRCDIR)/instruction.cpp $(SRCDIR)/instruction.hpp \
|
|
|
|
$(SRCDIR)/blake2/endian.h $(SRCDIR)/common.hpp $(SRCDIR)/configuration.h $(SRCDIR)/randomx.h \
|
|
|
|
$(SRCDIR)/instruction_weights.hpp
|
|
|
|
$(OBJDIR)/randomx.o: $(SRCDIR)/randomx.cpp $(SRCDIR)/randomx.h $(SRCDIR)/dataset.hpp $(SRCDIR)/common.hpp \
|
|
|
|
$(SRCDIR)/blake2/endian.h $(SRCDIR)/configuration.h $(SRCDIR)/superscalar_program.hpp \
|
|
|
|
$(SRCDIR)/instruction.hpp $(SRCDIR)/jit_compiler_x86.hpp $(SRCDIR)/allocator.hpp \
|
|
|
|
$(SRCDIR)/vm_interpreted.hpp $(SRCDIR)/virtual_machine.hpp $(SRCDIR)/program.hpp \
|
|
|
|
$(SRCDIR)/intrin_portable.h $(SRCDIR)/vm_interpreted_light.hpp $(SRCDIR)/vm_compiled.hpp \
|
|
|
|
$(SRCDIR)/vm_compiled_light.hpp $(SRCDIR)/blake2/blake2.h
|
|
|
|
$(OBJDIR)/superscalar.o: $(SRCDIR)/superscalar.cpp $(SRCDIR)/configuration.h $(SRCDIR)/program.hpp \
|
|
|
|
$(SRCDIR)/common.hpp $(SRCDIR)/blake2/endian.h $(SRCDIR)/randomx.h $(SRCDIR)/instruction.hpp \
|
|
|
|
$(SRCDIR)/superscalar.hpp $(SRCDIR)/superscalar_program.hpp $(SRCDIR)/blake2_generator.hpp \
|
|
|
|
$(SRCDIR)/intrin_portable.h $(SRCDIR)/reciprocal.h
|
|
|
|
$(OBJDIR)/vm_compiled.o: $(SRCDIR)/vm_compiled.cpp $(SRCDIR)/vm_compiled.hpp \
|
|
|
|
$(SRCDIR)/virtual_machine.hpp $(SRCDIR)/common.hpp $(SRCDIR)/blake2/endian.h \
|
|
|
|
$(SRCDIR)/configuration.h $(SRCDIR)/randomx.h $(SRCDIR)/program.hpp $(SRCDIR)/instruction.hpp \
|
|
|
|
$(SRCDIR)/jit_compiler_x86.hpp $(SRCDIR)/allocator.hpp $(SRCDIR)/dataset.hpp \
|
|
|
|
$(SRCDIR)/superscalar_program.hpp
|
|
|
|
$(OBJDIR)/vm_interpreted_light.o: $(SRCDIR)/vm_interpreted_light.cpp \
|
|
|
|
$(SRCDIR)/vm_interpreted_light.hpp $(SRCDIR)/vm_interpreted.hpp $(SRCDIR)/common.hpp \
|
|
|
|
$(SRCDIR)/blake2/endian.h $(SRCDIR)/configuration.h $(SRCDIR)/randomx.h \
|
|
|
|
$(SRCDIR)/virtual_machine.hpp $(SRCDIR)/program.hpp $(SRCDIR)/instruction.hpp \
|
|
|
|
$(SRCDIR)/intrin_portable.h $(SRCDIR)/allocator.hpp $(SRCDIR)/dataset.hpp \
|
|
|
|
$(SRCDIR)/superscalar_program.hpp $(SRCDIR)/jit_compiler_x86.hpp
|
|
|
|
$(OBJDIR)/argon2_core.o: $(SRCDIR)/argon2_core.c $(SRCDIR)/argon2_core.h $(SRCDIR)/argon2.h \
|
|
|
|
$(SRCDIR)/blake2/blake2.h $(SRCDIR)/blake2/blake2-impl.h $(SRCDIR)/blake2/endian.h
|
|
|
|
$(OBJDIR)/blake2_generator.o: $(SRCDIR)/blake2_generator.cpp $(SRCDIR)/blake2/blake2.h \
|
|
|
|
$(SRCDIR)/blake2/endian.h $(SRCDIR)/blake2_generator.hpp
|
|
|
|
$(OBJDIR)/instructions_portable.o: $(SRCDIR)/instructions_portable.cpp $(SRCDIR)/common.hpp \
|
|
|
|
$(SRCDIR)/blake2/endian.h $(SRCDIR)/configuration.h $(SRCDIR)/randomx.h \
|
|
|
|
$(SRCDIR)/intrin_portable.h
|
|
|
|
$(OBJDIR)/reciprocal.o: $(SRCDIR)/reciprocal.c $(SRCDIR)/reciprocal.h
|
|
|
|
$(OBJDIR)/virtual_machine.o: $(SRCDIR)/virtual_machine.cpp $(SRCDIR)/virtual_machine.hpp \
|
|
|
|
$(SRCDIR)/common.hpp $(SRCDIR)/blake2/endian.h $(SRCDIR)/configuration.h $(SRCDIR)/randomx.h \
|
|
|
|
$(SRCDIR)/program.hpp $(SRCDIR)/instruction.hpp $(SRCDIR)/aes_hash.hpp $(SRCDIR)/blake2/blake2.h \
|
|
|
|
$(SRCDIR)/intrin_portable.h $(SRCDIR)/allocator.hpp
|
|
|
|
$(OBJDIR)/vm_compiled_light.o: $(SRCDIR)/vm_compiled_light.cpp $(SRCDIR)/vm_compiled_light.hpp \
|
|
|
|
$(SRCDIR)/vm_compiled.hpp $(SRCDIR)/virtual_machine.hpp $(SRCDIR)/common.hpp \
|
|
|
|
$(SRCDIR)/blake2/endian.h $(SRCDIR)/configuration.h $(SRCDIR)/randomx.h $(SRCDIR)/program.hpp \
|
|
|
|
$(SRCDIR)/instruction.hpp $(SRCDIR)/jit_compiler_x86.hpp $(SRCDIR)/allocator.hpp \
|
|
|
|
$(SRCDIR)/dataset.hpp $(SRCDIR)/superscalar_program.hpp
|
|
|
|
|
|
|
|
$(OBJDIR)/%.o: $(SRCDIR)/%.c
|
|
|
|
$(CC) $(CCFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
|
|
|
|
$(CXX) $(CXXFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
$(OBJDIR)/%.o: $(SRCDIR)/%.S
|
|
|
|
$(CXX) -x assembler-with-cpp -c $< -o $@
|
2018-12-11 20:00:30 +00:00
|
|
|
|
|
|
|
clean:
|
2019-04-21 13:04:17 +00:00
|
|
|
rm -f $(BINARIES) $(OBJDIR)/*.o
|