1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

build: get separate builddir working again

This commit is contained in:
Joe Thornber 2018-06-04 13:22:14 +01:00
parent 66b10275c5
commit 29abba3785
14 changed files with 53 additions and 35 deletions

View File

@ -213,7 +213,7 @@ endif
endif endif
include test/unit/Makefile include test/unit/Makefile
include device_mapper/Makefile include $(top_srcdir)/device_mapper/Makefile
ifneq ($(shell which ctags),) ifneq ($(shell which ctags),)
.PHONY: tags .PHONY: tags

View File

@ -30,17 +30,17 @@ DEVICE_MAPPER_SOURCE=\
device_mapper/regex/ttree.c \ device_mapper/regex/ttree.c \
device_mapper/ioctl/libdm-iface.c device_mapper/ioctl/libdm-iface.c
DEVICE_MAPPER_DEPENDS=$(subst .c,.d,$(DEVICE_MAPPER_SOURCE)) DEVICE_MAPPER_DEPENDS=$(addprefix $(top_builddir)/,$(subst .c,.d,$(DEVICE_MAPPER_SOURCE)))
DEVICE_MAPPER_OBJECTS=$(subst .c,.o,$(DEVICE_MAPPER_SOURCE)) DEVICE_MAPPER_OBJECTS=$(addprefix $(top_builddir)/,$(subst .c,.o,$(DEVICE_MAPPER_SOURCE)))
CLEAN_TARGETS+=$(DEVICE_MAPPER_DEPENDS) $(DEVICE_MAPPER_OBJECTS) CLEAN_TARGETS+=$(DEVICE_MAPPER_DEPENDS) $(DEVICE_MAPPER_OBJECTS)
-include $(DEVICE_MAPPER_DEPENDS) -include $(DEVICE_MAPPER_DEPENDS)
$(DEVICE_MAPPER_OBJECTS): INCLUDES+=-Idevice_mapper/ $(DEVICE_MAPPER_OBJECTS): INCLUDES+=-I$(top_srcdir)/device_mapper/
device_mapper/libdevice-mapper.a: $(DEVICE_MAPPER_OBJECTS) $(top_builddir)/device_mapper/libdevice-mapper.a: $(DEVICE_MAPPER_OBJECTS)
@echo " [AR] $@" @echo " [AR] $@"
$(Q) $(RM) $@ $(Q) $(RM) $@
$(Q) $(AR) rsv $@ $(DEVICE_MAPPER_OBJECTS) > /dev/null $(Q) $(AR) rsv $@ $(DEVICE_MAPPER_OBJECTS) > /dev/null
CLEAN_TARGETS+=device_mapper/libdevice-mapper.a CLEAN_TARGETS+=$(top_builddir)/device_mapper/libdevice-mapper.a

View File

@ -13,7 +13,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "misc/dmlib.h" #include "device_mapper/misc/dmlib.h"
#include <ctype.h> #include <ctype.h>

View File

@ -13,7 +13,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "misc/dmlib.h" #include "device_mapper/misc/dmlib.h"
struct dm_hash_node { struct dm_hash_node {
struct dm_hash_node *next; struct dm_hash_node *next;

View File

@ -13,7 +13,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "misc/dmlib.h" #include "device_mapper/misc/dmlib.h"
#include <assert.h> #include <assert.h>
/* /*

View File

@ -13,9 +13,9 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "misc/dmlib.h" #include "device_mapper/misc/dmlib.h"
#include "libdm-targets.h" #include "device_mapper/ioctl/libdm-targets.h"
#include "libdm-common.h" #include "device_mapper/libdm-common.h"
#include <stddef.h> #include <stddef.h>
#include <fcntl.h> #include <fcntl.h>
@ -26,7 +26,7 @@
#include <unistd.h> #include <unistd.h>
#ifdef __linux__ #ifdef __linux__
# include "misc/kdev_t.h" # include "device_mapper/misc/kdev_t.h"
# include <linux/limits.h> # include <linux/limits.h>
#else #else
# define MAJOR(x) major((x)) # define MAJOR(x) major((x))
@ -34,7 +34,7 @@
# define MKDEV(x,y) makedev((x),(y)) # define MKDEV(x,y) makedev((x),(y))
#endif #endif
#include "misc/dm-ioctl.h" #include "device_mapper/misc/dm-ioctl.h"
/* /*
* Ensure build compatibility. * Ensure build compatibility.

View File

@ -13,7 +13,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "misc/dmlib.h" #include "device_mapper/misc/dmlib.h"
#ifdef VALGRIND_POOL #ifdef VALGRIND_POOL
#include "memcheck.h" #include "memcheck.h"

View File

@ -17,7 +17,7 @@
#include "memcheck.h" #include "memcheck.h"
#endif #endif
#include "misc/dmlib.h" #include "device_mapper/misc/dmlib.h"
#include <stddef.h> /* For musl libc */ #include <stddef.h> /* For musl libc */
#include <malloc.h> #include <malloc.h>

View File

@ -13,7 +13,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "misc/dmlib.h" #include "device_mapper/misc/dmlib.h"
#include <sys/mman.h> #include <sys/mman.h>
#include <pthread.h> #include <pthread.h>

View File

@ -13,7 +13,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "misc/dmlib.h" #include "device_mapper/misc/dmlib.h"
#include "parse_rx.h" #include "parse_rx.h"
#include "ttree.h" #include "ttree.h"
#include "assert.h" #include "assert.h"

View File

@ -13,7 +13,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "misc/dmlib.h" #include "device_mapper/misc/dmlib.h"
#include "parse_rx.h" #include "parse_rx.h"
#ifdef DEBUG #ifdef DEBUG

View File

@ -13,7 +13,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "misc/dmlib.h" #include "device_mapper/misc/dmlib.h"
#include "ttree.h" #include "ttree.h"
struct node { struct node {

View File

@ -58,6 +58,7 @@ PYTHON3 = @PYTHON3@
PYCOMPILE = $(top_srcdir)/autoconf/py-compile PYCOMPILE = $(top_srcdir)/autoconf/py-compile
LIBS = @LIBS@ LIBS = @LIBS@
LIBS += $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) $(RT_LIBS) -lm
# Extra libraries always linked with static binaries # Extra libraries always linked with static binaries
STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS)
DEFS += @DEFS@ DEFS += @DEFS@
@ -68,7 +69,9 @@ CLDFLAGS += @CLDFLAGS@
ELDFLAGS += @ELDFLAGS@ ELDFLAGS += @ELDFLAGS@
LDDEPS += @LDDEPS@ LDDEPS += @LDDEPS@
LIB_SUFFIX = @LIB_SUFFIX@ LIB_SUFFIX = @LIB_SUFFIX@
LVMINTERNAL_LIBS = -llvm-internal $(DMEVENT_LIBS) $(DAEMON_LIBS) $(SYSTEMD_LIBS) $(UDEV_LIBS) $(DL_LIBS) $(BLKID_LIBS) LVMINTERNAL_LIBS=\
-llvm-internal \
$(DMEVENT_LIBS) $(DAEMON_LIBS) $(SYSTEMD_LIBS) $(UDEV_LIBS) $(DL_LIBS) $(BLKID_LIBS)
DL_LIBS = @DL_LIBS@ DL_LIBS = @DL_LIBS@
RT_LIBS = @RT_LIBS@ RT_LIBS = @RT_LIBS@
M_LIBS = @M_LIBS@ M_LIBS = @M_LIBS@
@ -308,6 +311,7 @@ LIB_VERSION_APP := $(shell $(AWK) -F '[(). ]' '{printf "%s.%s",$$1,$$4}' $(top_s
INCLUDES += -I$(top_srcdir) -I$(srcdir) -I$(top_builddir)/include INCLUDES += -I$(top_srcdir) -I$(srcdir) -I$(top_builddir)/include
DEPS = $(top_builddir)/make.tmpl $(top_srcdir)/VERSION \ DEPS = $(top_builddir)/make.tmpl $(top_srcdir)/VERSION \
$(top_builddir)/Makefile $(top_builddir)/Makefile
@ -338,7 +342,7 @@ SUBDIRS.distclean := $(SUBDIRS:=.distclean)
TARGETS += $(LIB_SHARED) $(LIB_STATIC) TARGETS += $(LIB_SHARED) $(LIB_STATIC)
all: $(SUBDIRS) $(TARGETS) all: $(top_builddir)/device_mapper/libdevice-mapper.a $(SUBDIRS) $(TARGETS)
install: all $(SUBDIRS.install) install: all $(SUBDIRS.install)
install_cluster: all $(SUBDIRS.install_cluster) install_cluster: all $(SUBDIRS.install_cluster)
@ -347,7 +351,7 @@ install_lvm2: $(SUBDIRS.install_lvm2)
install_ocf: $(SUBDIRS.install_ocf) install_ocf: $(SUBDIRS.install_ocf)
cflow: $(SUBDIRS.cflow) cflow: $(SUBDIRS.cflow)
$(SUBDIRS): $(SUBDIRS.device-mapper) $(SUBDIRS): $(SUBDIRS.device-mapper) $(top_builddir)/device_mapper/libdevice-mapper.a
$(MAKE) -C $@ $(MAKE) -C $@
$(SUBDIRS.device-mapper): $(SUBDIRS.device-mapper):
@ -440,14 +444,12 @@ endif
.LIBPATTERNS = lib%.so lib%.a .LIBPATTERNS = lib%.so lib%.a
DEPFLAGS=-MT $@ -MMD -MP -MF $*.d
# still needed in 2018 for 32bit builds # still needed in 2018 for 32bit builds
DEFS+=-D_FILE_OFFSET_BITS=64 DEFS+=-D_FILE_OFFSET_BITS=64
%.o: %.c %.o: %.c
@echo " [CC] $<" @echo " [CC] $<"
$(Q) $(CC) $(DEPFLAGS) -c $(INCLUDES) $(VALGRIND_CFLAGS) $(PROGS_CFLAGS) $(DEFS) $(DEFS_$@) $(WFLAGS) $(WCFLAGS) $(CFLAGS) $(CFLAGS_$@) $< -o $@ $(Q) $(CC) -c $(INCLUDES) $(VALGRIND_CFLAGS) $(PROGS_CFLAGS) $(DEFS) $(DEFS_$@) $(WFLAGS) $(WCFLAGS) $(CFLAGS) $(CFLAGS_$@) $< -o $@
%.o: %.cpp %.o: %.cpp
@echo " [CXX] $<" @echo " [CXX] $<"
@ -507,8 +509,17 @@ $(LIB_STATIC): $(OBJECTS)
$(Q) $(RM) $@ $(Q) $(RM) $@
$(Q) $(AR) rsv $@ $(OBJECTS) > /dev/null $(Q) $(AR) rsv $@ $(OBJECTS) > /dev/null
%.d: %.d: %.c
.PRECIOUS: %.d @echo " [DEP] $<"
$(Q) $(MKDIR_P) $(dir $@); \
set -e; \
FILE=`echo $@ | sed 's/\\//\\\\\\//g;s/\\.d//g'`; \
DEPS=`echo $(DEPS) | sed -e 's/\\//\\\\\\//g'`; \
$(CC) -MM $(INCLUDES) $(VALGRIND_CFLAGS) $(PROGS_CFLAGS) $(DEFS) -o $@ $<; \
sed -i "s/\(.*\)\.o[ :]*/$$FILE.o $$FILE.d $$FILE.pot: $$DEPS /g" $@; \
DEPLIST=`sed 's/ \\\\//;s/.*://;' < $@`; \
echo $$DEPLIST | fmt -1 | sed 's/ //g;s/\(.*\)/\1:/' >> $@; \
[ -s $@ ] || $(RM) $@
%.mo: %.po %.mo: %.po
@echo " [MSGFMT] $<" @echo " [MSGFMT] $<"

View File

@ -444,14 +444,12 @@ endif
.LIBPATTERNS = lib%.so lib%.a .LIBPATTERNS = lib%.so lib%.a
DEPFLAGS=-MT $@ -MMD -MP -MF $*.d
# still needed in 2018 for 32bit builds # still needed in 2018 for 32bit builds
DEFS+=-D_FILE_OFFSET_BITS=64 DEFS+=-D_FILE_OFFSET_BITS=64
%.o: %.c %.o: %.c
@echo " [CC] $<" @echo " [CC] $<"
$(Q) $(CC) $(DEPFLAGS) -c $(INCLUDES) $(VALGRIND_CFLAGS) $(PROGS_CFLAGS) $(DEFS) $(DEFS_$@) $(WFLAGS) $(WCFLAGS) $(CFLAGS) $(CFLAGS_$@) $< -o $@ $(Q) $(CC) -c $(INCLUDES) $(VALGRIND_CFLAGS) $(PROGS_CFLAGS) $(DEFS) $(DEFS_$@) $(WFLAGS) $(WCFLAGS) $(CFLAGS) $(CFLAGS_$@) $< -o $@
%.o: %.cpp %.o: %.cpp
@echo " [CXX] $<" @echo " [CXX] $<"
@ -511,8 +509,17 @@ $(LIB_STATIC): $(OBJECTS)
$(Q) $(RM) $@ $(Q) $(RM) $@
$(Q) $(AR) rsv $@ $(OBJECTS) > /dev/null $(Q) $(AR) rsv $@ $(OBJECTS) > /dev/null
%.d: %.d: %.c
.PRECIOUS: %.d @echo " [DEP] $<"
$(Q) $(MKDIR_P) $(dir $@); \
set -e; \
FILE=`echo $@ | sed 's/\\//\\\\\\//g;s/\\.d//g'`; \
DEPS=`echo $(DEPS) | sed -e 's/\\//\\\\\\//g'`; \
$(CC) -MM $(INCLUDES) $(VALGRIND_CFLAGS) $(PROGS_CFLAGS) $(DEFS) -o $@ $<; \
sed -i "s/\(.*\)\.o[ :]*/$$FILE.o $$FILE.d $$FILE.pot: $$DEPS /g" $@; \
DEPLIST=`sed 's/ \\\\//;s/.*://;' < $@`; \
echo $$DEPLIST | fmt -1 | sed 's/ //g;s/\(.*\)/\1:/' >> $@; \
[ -s $@ ] || $(RM) $@
%.mo: %.po %.mo: %.po
@echo " [MSGFMT] $<" @echo " [MSGFMT] $<"