mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
2b7fa40aac
Add support for specif STATIC_LDFLAGS when linking static binaries.
105 lines
3.1 KiB
Makefile
105 lines
3.1 KiB
Makefile
#
|
|
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
|
# Copyright (C) 2004-2018 Red Hat, Inc. All rights reserved.
|
|
#
|
|
# This file is part of LVM2.
|
|
#
|
|
# This copyrighted material is made available to anyone wishing to use,
|
|
# modify, copy, or redistribute it subject to the terms and conditions
|
|
# of the GNU General Public License v.2.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software Foundation,
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
srcdir = @srcdir@
|
|
top_srcdir = @top_srcdir@
|
|
top_builddir = @top_builddir@
|
|
|
|
all: device-mapper
|
|
|
|
SOURCES2 = dmsetup.c
|
|
TARGETS_DM = dmsetup
|
|
|
|
CFLOW_SOURCES = $(addprefix $(srcdir)/, $(SOURCES2))
|
|
CFLOW_TARGET := $(TARGETS_DM)
|
|
-include $(top_builddir)/libdm/libdevmapper.cflow
|
|
|
|
install_device-mapper: install_dmsetup_dynamic
|
|
|
|
ifeq ("@STATIC_LINK@", "yes")
|
|
TARGETS_DM += dmsetup.static
|
|
install_device-mapper: install_dmsetup_static
|
|
endif
|
|
|
|
# dmfilemapd support
|
|
ifeq ("@BUILD_DMFILEMAPD@", "yes")
|
|
SOURCES2 += dmfilemapd.c
|
|
TARGETS_DM += dmfilemapd
|
|
install_dmfilemapd: install_dmfilemapd_dynamic
|
|
|
|
ifeq ("@STATIC_LINK@", "yes")
|
|
TARGETS_DM += dmfilemapd.static
|
|
install_dmfilemapd: install_dmfilemapd_static
|
|
endif
|
|
endif
|
|
|
|
CLEAN_TARGETS = $(LDDEPS) .exported_symbols_generated \
|
|
dmfilemapd dmfilemapd.static \
|
|
dmsetup dmsetup.static
|
|
|
|
include $(top_builddir)/libdm/make.tmpl
|
|
|
|
CFLAGS_dmsetup.o += $(UDEV_CFLAGS) $(EXTRA_EXEC_CFLAGS)
|
|
CFLAGS_dmfilemapd.o += $(EXTRA_EXEC_CFLAGS)
|
|
LIBDM_LIBS = -L$(interfacebuilddir) -ldevmapper
|
|
LIBDM_SHARED = $(interfacebuilddir)/libdevmapper.so
|
|
LIBDM_STATIC = $(interfacebuilddir)/libdevmapper.a
|
|
|
|
dmsetup: dmsetup.o $(LIBDM_SHARED)
|
|
@echo " [CC] $@"
|
|
$(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) \
|
|
-o $@ $< $(LIBDM_LIBS) $(LIBS)
|
|
|
|
dmsetup.static: dmsetup.o $(LIBDM_STATIC)
|
|
@echo " [CC] $@"
|
|
$(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(STATIC_LDFLAGS) -static \
|
|
-o $@ $< $(LIBDM_LIBS) $(LIBS) $(STATIC_LIBS)
|
|
|
|
install_dmsetup_dynamic: dmsetup
|
|
@echo " [INSTALL] $<"
|
|
$(Q) $(INSTALL_PROGRAM) -D $< $(sbindir)/$(<F)
|
|
$(Q) $(LN_S) -f $(<F) $(sbindir)/dmstats
|
|
|
|
install_dmsetup_static: dmsetup.static
|
|
@echo " [INSTALL] $<"
|
|
$(Q) $(INSTALL_PROGRAM) -D $< $(staticdir)/$(<F)
|
|
$(Q) $(LN_S) -f $(<F) $(staticdir)/dmstats.static
|
|
|
|
|
|
dmfilemapd: dmfilemapd.o $(LIBDM_SHARED)
|
|
@echo " [CC] $@"
|
|
$(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) \
|
|
-o $@ $< $(LIBDM_LIBS) $(LIBS)
|
|
|
|
dmfilemapd.static: dmfilemapd.o $(LIBDM_STATIC)
|
|
@echo " [CC] $@"
|
|
$(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(STATIC_LDFLAGS) -static \
|
|
-o $@ $< $(LIBDM_LIBS) $(LIBS) $(STATIC_LIBS)
|
|
|
|
install_dmfilemapd_dynamic: dmfilemapd
|
|
@echo " [INSTALL] $<"
|
|
$(Q) $(INSTALL_PROGRAM) -D $< $(sbindir)/$(<F)
|
|
|
|
install_dmfilemapd_static: dmfilemapd.static
|
|
@echo " [INSTALL] $<"
|
|
$(Q) $(INSTALL_PROGRAM) -D $< $(staticdir)/$(<F)
|
|
|
|
|
|
.PHONY: install_dmsetup_dynamic install_dmsetup_static
|
|
.PHONY: install_dmfilemapd install_dmfilemapd_static
|
|
|
|
install: install_device-mapper install_dmfilemapd
|
|
|
|
device-mapper: $(TARGETS_DM)
|