How to make if statement in Makefile based on platform?
10:00 20 Jun 2020

I am having trouble with crypto wallet, which does not probably matter that much. The issue is that makefile contains files which is used for x86 architecture and I have AARCH64 files, but can't seem to find a way, how to deal with that...

So I would like to change, based on platform(in this case x86), this:

  crypto/randomx/jit_compiler_x86.cpp 
  crypto/randomx/jit_compiler_x86.hpp 
  crypto/randomx/jit_compiler_x86_static.asm 
  crypto/randomx/jit_compiler_x86_static.hpp 
  crypto/randomx/jit_compiler_x86_static.S 

to this (when AARCH64):

  crypto/randomx/jit_compiler_a64.cpp
  crypto/randomx/jit_compiler_a64.hpp
  crypto/randomx/jit_compiler_a64_static.hpp
  crypto/randomx/jit_compiler_a64_static.S

So is there any way, how to do that in more elegant way, then merge those cpp/hpp/s files together*, just in Makefile?

*Well I don't think that would work, because x86 implementation has one more file.

Another issue is that it creates dependency files in form of *.PO or *PLO files, which...where are they from, they are created on the fly by compiler.

Any than in the end of Makefile is stated this:

crypto/randomx/libbitcoinconsensus_la-jit_compiler_x86.lo:  \
    crypto/randomx/$(am__dirstamp) \
    crypto/randomx/$(DEPDIR)/$(am__dirstamp)

Which probably can cause some problems, because it has x86 in it and it's some temporary *.lo file, which I too don't know where in compiling process are those files introduced.

So is there any way, how to solve this? If there is need to have separate make file, that's not a problem, if I know how to differentiate (by code) between them. I am compiling linux, so I guess in configure.ac there is a way to do that or in autogen.sh or stuff like this, which there are for setting environment.

Thank you in advance for help.

c++ linux assembly makefile arm64