AC_CANONICAL_HOST, . , configure.ac:
AC_CANONICAL_HOST
AC_SUBST([USE_DIR],[$host_cpu])
test -d $srcdir/$USE_DIR || USE_DIR=generic
Makefile.am:
SUBDIRS = $(USE_DIR) common
common/Makefile.am:
LDADD = ../$(USE_DIR)/libfoo.a
${host_cpu}/Makefile.am:
noinst_LIBRARIES = libfoo.a
libfoo_a_SOURCES = one.s ../common/two.c
This uses a slightly different directory structure than what you describe. C files that are used on all platforms will be located in commonand associated with the convenience library created in the platform’s specific directory. If some c files are used only on some platforms, you can use them in general terms and refer to them explicitly in Makefile.am for those platforms that need them.
source
share