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:
parent
66b10275c5
commit
29abba3785
@ -213,7 +213,7 @@ endif
|
||||
endif
|
||||
|
||||
include test/unit/Makefile
|
||||
include device_mapper/Makefile
|
||||
include $(top_srcdir)/device_mapper/Makefile
|
||||
|
||||
ifneq ($(shell which ctags),)
|
||||
.PHONY: tags
|
||||
|
@ -30,17 +30,17 @@ DEVICE_MAPPER_SOURCE=\
|
||||
device_mapper/regex/ttree.c \
|
||||
device_mapper/ioctl/libdm-iface.c
|
||||
|
||||
DEVICE_MAPPER_DEPENDS=$(subst .c,.d,$(DEVICE_MAPPER_SOURCE))
|
||||
DEVICE_MAPPER_OBJECTS=$(subst .c,.o,$(DEVICE_MAPPER_SOURCE))
|
||||
DEVICE_MAPPER_DEPENDS=$(addprefix $(top_builddir)/,$(subst .c,.d,$(DEVICE_MAPPER_SOURCE)))
|
||||
DEVICE_MAPPER_OBJECTS=$(addprefix $(top_builddir)/,$(subst .c,.o,$(DEVICE_MAPPER_SOURCE)))
|
||||
CLEAN_TARGETS+=$(DEVICE_MAPPER_DEPENDS) $(DEVICE_MAPPER_OBJECTS)
|
||||
|
||||
-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] $@"
|
||||
$(Q) $(RM) $@
|
||||
$(Q) $(AR) rsv $@ $(DEVICE_MAPPER_OBJECTS) > /dev/null
|
||||
|
||||
CLEAN_TARGETS+=device_mapper/libdevice-mapper.a
|
||||
CLEAN_TARGETS+=$(top_builddir)/device_mapper/libdevice-mapper.a
|
||||
|
@ -13,7 +13,7 @@
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "misc/dmlib.h"
|
||||
#include "device_mapper/misc/dmlib.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 *next;
|
||||
|
@ -13,7 +13,7 @@
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "misc/dmlib.h"
|
||||
#include "device_mapper/misc/dmlib.h"
|
||||
#include <assert.h>
|
||||
|
||||
/*
|
||||
|
@ -13,9 +13,9 @@
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "misc/dmlib.h"
|
||||
#include "libdm-targets.h"
|
||||
#include "libdm-common.h"
|
||||
#include "device_mapper/misc/dmlib.h"
|
||||
#include "device_mapper/ioctl/libdm-targets.h"
|
||||
#include "device_mapper/libdm-common.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <fcntl.h>
|
||||
@ -26,7 +26,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef __linux__
|
||||
# include "misc/kdev_t.h"
|
||||
# include "device_mapper/misc/kdev_t.h"
|
||||
# include <linux/limits.h>
|
||||
#else
|
||||
# define MAJOR(x) major((x))
|
||||
@ -34,7 +34,7 @@
|
||||
# define MKDEV(x,y) makedev((x),(y))
|
||||
#endif
|
||||
|
||||
#include "misc/dm-ioctl.h"
|
||||
#include "device_mapper/misc/dm-ioctl.h"
|
||||
|
||||
/*
|
||||
* Ensure build compatibility.
|
||||
|
@ -13,7 +13,7 @@
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "misc/dmlib.h"
|
||||
#include "device_mapper/misc/dmlib.h"
|
||||
|
||||
#ifdef VALGRIND_POOL
|
||||
#include "memcheck.h"
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "memcheck.h"
|
||||
#endif
|
||||
|
||||
#include "misc/dmlib.h"
|
||||
#include "device_mapper/misc/dmlib.h"
|
||||
#include <stddef.h> /* For musl libc */
|
||||
#include <malloc.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <pthread.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 "ttree.h"
|
||||
#include "assert.h"
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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"
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -13,7 +13,7 @@
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "misc/dmlib.h"
|
||||
#include "device_mapper/misc/dmlib.h"
|
||||
#include "ttree.h"
|
||||
|
||||
struct node {
|
||||
|
@ -58,6 +58,7 @@ PYTHON3 = @PYTHON3@
|
||||
PYCOMPILE = $(top_srcdir)/autoconf/py-compile
|
||||
|
||||
LIBS = @LIBS@
|
||||
LIBS += $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) $(RT_LIBS) -lm
|
||||
# Extra libraries always linked with static binaries
|
||||
STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS)
|
||||
DEFS += @DEFS@
|
||||
@ -68,7 +69,9 @@ CLDFLAGS += @CLDFLAGS@
|
||||
ELDFLAGS += @ELDFLAGS@
|
||||
LDDEPS += @LDDEPS@
|
||||
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@
|
||||
RT_LIBS = @RT_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
|
||||
|
||||
|
||||
DEPS = $(top_builddir)/make.tmpl $(top_srcdir)/VERSION \
|
||||
$(top_builddir)/Makefile
|
||||
|
||||
@ -338,7 +342,7 @@ SUBDIRS.distclean := $(SUBDIRS:=.distclean)
|
||||
|
||||
TARGETS += $(LIB_SHARED) $(LIB_STATIC)
|
||||
|
||||
all: $(SUBDIRS) $(TARGETS)
|
||||
all: $(top_builddir)/device_mapper/libdevice-mapper.a $(SUBDIRS) $(TARGETS)
|
||||
|
||||
install: all $(SUBDIRS.install)
|
||||
install_cluster: all $(SUBDIRS.install_cluster)
|
||||
@ -347,7 +351,7 @@ install_lvm2: $(SUBDIRS.install_lvm2)
|
||||
install_ocf: $(SUBDIRS.install_ocf)
|
||||
cflow: $(SUBDIRS.cflow)
|
||||
|
||||
$(SUBDIRS): $(SUBDIRS.device-mapper)
|
||||
$(SUBDIRS): $(SUBDIRS.device-mapper) $(top_builddir)/device_mapper/libdevice-mapper.a
|
||||
$(MAKE) -C $@
|
||||
|
||||
$(SUBDIRS.device-mapper):
|
||||
@ -440,14 +444,12 @@ endif
|
||||
|
||||
.LIBPATTERNS = lib%.so lib%.a
|
||||
|
||||
DEPFLAGS=-MT $@ -MMD -MP -MF $*.d
|
||||
|
||||
# still needed in 2018 for 32bit builds
|
||||
DEFS+=-D_FILE_OFFSET_BITS=64
|
||||
|
||||
%.o: %.c
|
||||
@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
|
||||
@echo " [CXX] $<"
|
||||
@ -507,9 +509,18 @@ $(LIB_STATIC): $(OBJECTS)
|
||||
$(Q) $(RM) $@
|
||||
$(Q) $(AR) rsv $@ $(OBJECTS) > /dev/null
|
||||
|
||||
%.d:
|
||||
.PRECIOUS: %.d
|
||||
|
||||
%.d: %.c
|
||||
@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
|
||||
@echo " [MSGFMT] $<"
|
||||
$(Q) $(MSGFMT) -o $@ $<
|
||||
|
19
make.tmpl.in
19
make.tmpl.in
@ -444,14 +444,12 @@ endif
|
||||
|
||||
.LIBPATTERNS = lib%.so lib%.a
|
||||
|
||||
DEPFLAGS=-MT $@ -MMD -MP -MF $*.d
|
||||
|
||||
# still needed in 2018 for 32bit builds
|
||||
DEFS+=-D_FILE_OFFSET_BITS=64
|
||||
|
||||
%.o: %.c
|
||||
@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
|
||||
@echo " [CXX] $<"
|
||||
@ -511,9 +509,18 @@ $(LIB_STATIC): $(OBJECTS)
|
||||
$(Q) $(RM) $@
|
||||
$(Q) $(AR) rsv $@ $(OBJECTS) > /dev/null
|
||||
|
||||
%.d:
|
||||
.PRECIOUS: %.d
|
||||
|
||||
%.d: %.c
|
||||
@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
|
||||
@echo " [MSGFMT] $<"
|
||||
$(Q) $(MSGFMT) -o $@ $<
|
||||
|
Loading…
Reference in New Issue
Block a user