From 2989d1012ac00b4134a0dc490917e0b0d048d289 Mon Sep 17 00:00:00 2001 From: Arvind Sankar Date: Fri, 19 Jun 2020 15:24:20 -0400 Subject: [PATCH] Fix libspl/asm-generic/atomic for VPATH build Currently, asm-generic/atomic.c is compiled into a .S file, with a comment saying this is to simplify the upper-level Makefile. However, this doesn't work properly with a VPATH build, which would require better logic to deal with generated sources correctly. It also doesn't seem more complex to just specify the .c/.S source file, depending on the cpu, instead of only the source directory in lib/libspl/Makefile.am, which eliminates the need to do the intermediate compilation. Reviewed-by: Ryan Moeller Reviewed-by: Brian Behlendorf Signed-off-by: Arvind Sankar Closes #10493 --- lib/libspl/Makefile.am | 17 +++++------------ lib/libspl/asm-generic/Makefile.am | 16 +--------------- lib/libspl/asm-i386/Makefile.am | 2 +- lib/libspl/asm-x86_64/Makefile.am | 2 +- 4 files changed, 8 insertions(+), 29 deletions(-) diff --git a/lib/libspl/Makefile.am b/lib/libspl/Makefile.am index 77d8aba0ed00..e11b165d7d04 100644 --- a/lib/libspl/Makefile.am +++ b/lib/libspl/Makefile.am @@ -1,20 +1,16 @@ include $(top_srcdir)/config/Rules.am if TARGET_CPU_I386 -TARGET_CPU_DIR = asm-i386 +TARGET_CPU_ATOMIC_SOURCE = asm-i386/atomic.S else if TARGET_CPU_X86_64 -TARGET_CPU_DIR = asm-x86_64 +TARGET_CPU_ATOMIC_SOURCE = asm-x86_64/atomic.S else -TARGET_CPU_DIR = asm-generic +TARGET_CPU_ATOMIC_SOURCE = asm-generic/atomic.c endif endif -VPATH = \ - $(top_srcdir)/lib/libspl \ - $(top_srcdir)/lib/libspl/$(TARGET_CPU_DIR) - -SUBDIRS = include $(TARGET_CPU_DIR) +SUBDIRS = include DIST_SUBDIRS = include asm-generic asm-i386 asm-x86_64 AM_CFLAGS += $(LIBTIRPC_CFLAGS) @@ -48,14 +44,11 @@ USER_C += \ os/freebsd/gethostid.c \ os/freebsd/getmntany.c \ os/freebsd/mnttab.c - endif -USER_ASM = atomic.S - nodist_libspl_la_SOURCES = \ $(USER_C) \ - $(USER_ASM) + $(TARGET_CPU_ATOMIC_SOURCE) libspl_la_LIBADD = -lrt $(LIBTIRPC_LIBS) diff --git a/lib/libspl/asm-generic/Makefile.am b/lib/libspl/asm-generic/Makefile.am index 39682316073d..1d5e224b1cff 100644 --- a/lib/libspl/asm-generic/Makefile.am +++ b/lib/libspl/asm-generic/Makefile.am @@ -1,15 +1 @@ -include $(top_srcdir)/config/Rules.am - -atomic_SOURCE = atomic.c -atomic_ASM = atomic.S - -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -fPIC -EXTRA_DIST = $(atomic_SOURCE) - -# Generates assembly to simplify inclusion in ../Makefile.am -all-am: - $(COMPILE) -c -S $(atomic_SOURCE) -o $(atomic_ASM) - -clean-generic: - $(RM) $(atomic_ASM) +EXTRA_DIST = atomic.c diff --git a/lib/libspl/asm-i386/Makefile.am b/lib/libspl/asm-i386/Makefile.am index e1126102f7c3..e954ec401a15 100644 --- a/lib/libspl/asm-i386/Makefile.am +++ b/lib/libspl/asm-i386/Makefile.am @@ -1 +1 @@ -noinst_HEADERS = atomic.S +EXTRA_DIST = atomic.S diff --git a/lib/libspl/asm-x86_64/Makefile.am b/lib/libspl/asm-x86_64/Makefile.am index e1126102f7c3..e954ec401a15 100644 --- a/lib/libspl/asm-x86_64/Makefile.am +++ b/lib/libspl/asm-x86_64/Makefile.am @@ -1 +1 @@ -noinst_HEADERS = atomic.S +EXTRA_DIST = atomic.S