I have a source file that needs to be compiled for ARM A-32. A-32 includes ARMv4 and ARMv7 (but not Aarch32 or Aarch64). Our GNU makefile has:
IS_ARM32 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E 'arm|armhf|arm7l|eabihf')
...
ifeq ($(IS_ARM32),1)
AES_ARCH = -march=armv7-a -marm
SRCS += aes-armv4.S
endif
...
ifeq ($(IS_ARM32),1)
aes-armv4.o : aes-armv4.S
$(CC) $(strip $(CXXFLAGS) $(AES_ARCH) -mfloat-abi=$(FP_ABI) -c) $<
endif
According to the Conditional Compilation using Automake Conditionals manual:
An often simpler way to compile source files conditionally is to use Automake conditionals. For instance, you could use this Makefile.am construct to build the same hello example:
bin_PROGRAMS = hello if LINUX hello_SOURCES = hello-linux.c hello-common.c else hello_SOURCES = hello-generic.c hello-common.c endif
In this case, configure.ac should setup the LINUX conditional using AM_CONDITIONAL (see Conditionals).
Following the link to conditionals I don't see a list of the conditionals like LINUX
as used in the example. It also lacks a discussion of conditional compilation for architectures, like ARM and PowerPC.
What conditional does Automake use for ARM A-32?
Or how does one conditionally compile for ARM A-32?
Following the link to conditionals I don't see a list of the conditionals like
LINUX
in the manual's example. It also lacks a discussion of conditional compilation for platforms, like ARM and PowerPC.
You appear to have overlooked this text from the quoted excerpt of the manual:
In this case, configure.ac should setup the LINUX conditional using AM_CONDITIONAL
AM_CONDITIONAL
is the Autoconf macro with which you define a predicate for use in an Automake conditional. There are no premade predicates.
What does Automake use for ARM A-32?
Or how does one conditionally compile for ARM A-32?
Given that your existing approach is based on
IS_ARM32 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E 'arm|armhf|arm7l|eabihf')
you might do this in configure.ac
:
AM_CONDITIONAL([ARM32], [echo "$HOSTX" | $GREP -i -c -E 'arm|armhf|arm7l|eabihf'])
This assumes that HOSTX
and GREP
are autoconf output variables whose values have already been set. If that's not the case for you then I'm sure that it at least provides a model for you to start with.
With the ARM32
predicate defined in your configure.ac, you can then use it in your Makefile.am
files much as in the example from the manual:
if ARM32
hello_SOURCES = hello-arm32.c hello-common.c
else
hello_SOURCES = hello-generic.c hello-common.c
endif