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 <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Closes #10493
This commit is contained in:
Arvind Sankar 2020-06-19 15:24:20 -04:00 committed by Brian Behlendorf
parent 109d2c9310
commit 2989d1012a
4 changed files with 8 additions and 29 deletions

View File

@ -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)

View File

@ -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

View File

@ -1 +1 @@
noinst_HEADERS = atomic.S
EXTRA_DIST = atomic.S

View File

@ -1 +1 @@
noinst_HEADERS = atomic.S
EXTRA_DIST = atomic.S