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

makefiles: improving cleaning rules

This commit is contained in:
Zdenek Kabelac 2018-11-29 21:47:11 +01:00
parent f54ead831f
commit 98c21e98b2
5 changed files with 24 additions and 15 deletions

View File

@ -22,9 +22,11 @@ BASE_SOURCE=\
base/data-struct/hash.c \
base/data-struct/list.c
BASE_DEPENDS=$(addprefix $(top_builddir)/,$(subst .c,.d,$(BASE_SOURCE)))
BASE_OBJECTS=$(addprefix $(top_builddir)/,$(subst .c,.o,$(BASE_SOURCE)))
CLEAN_TARGETS+=$(BASE_DEPENDS) $(BASE_OBJECTS)
BASE_DEPENDS = $(BASE_SOURCE:%.c=%.d)
BASE_OBJECTS = $(BASE_SOURCE:%.c=%.o)
CLEAN_TARGETS += $(BASE_DEPENDS) $(BASE_OBJECTS) \
$(BASE_SOURCE:%.c=%.gcda) \
$(BASE_SOURCE:%.c=%.gcno)
ifeq ("$(USE_TRACKING)","yes")
ifeq (,$(findstring $(MAKECMDGOALS),cscope.out cflow clean distclean lcov lcov-reset \
@ -35,9 +37,9 @@ endif
$(BASE_OBJECTS): INCLUDES+=-I$(top_srcdir)/base/
$(top_builddir)/base/libbase.a: $(BASE_OBJECTS)
base/libbase.a: $(BASE_OBJECTS)
@echo " [AR] $@"
$(Q) $(RM) $@
$(Q) $(AR) rsv $@ $(BASE_OBJECTS) > /dev/null
CLEAN_TARGETS+=$(top_builddir)/base/libbase.a
CLEAN_TARGETS += base/libbase.a

View File

@ -10,6 +10,9 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# NOTE: this include only works as 'include' for toplevel Makefile
# which defined all top_* variables
DEVICE_MAPPER_SOURCE=\
device_mapper/datastruct/bitset.c \
device_mapper/libdm-common.c \
@ -28,9 +31,11 @@ DEVICE_MAPPER_SOURCE=\
device_mapper/vdo/vdo_target.c \
device_mapper/vdo/status.c
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)
DEVICE_MAPPER_DEPENDS = $(DEVICE_MAPPER_SOURCE:%.c=%.d)
DEVICE_MAPPER_OBJECTS = $(DEVICE_MAPPER_SOURCE:%.c=%.o)
CLEAN_TARGETS += $(DEVICE_MAPPER_DEPENDS) $(DEVICE_MAPPER_OBJECTS) \
$(DEVICE_MAPPER_SOURCE:%.c=%.gcda) \
$(DEVICE_MAPPER_SOURCE:%.c=%.gcno)
#$(DEVICE_MAPPER_DEPENDS): INCLUDES+=$(VDO_INCLUDES)
#$(DEVICE_MAPPER_OBJECTS): INCLUDES+=$(VDO_INCLUDES)
@ -44,9 +49,9 @@ endif
$(DEVICE_MAPPER_OBJECTS): INCLUDES+=-I$(top_srcdir)/device_mapper/
$(top_builddir)/device_mapper/libdevice-mapper.a: $(DEVICE_MAPPER_OBJECTS)
device_mapper/libdevice-mapper.a: $(DEVICE_MAPPER_OBJECTS)
@echo " [AR] $@"
$(Q) $(RM) $@
$(Q) $(AR) rsv $@ $(DEVICE_MAPPER_OBJECTS) > /dev/null
CLEAN_TARGETS+=$(top_builddir)/device_mapper/libdevice-mapper.a
CLEAN_TARGETS += device_mapper/libdevice-mapper.a

View File

@ -18,7 +18,7 @@ top_builddir = @top_builddir@
include $(top_builddir)/make.tmpl
DISTCLEAN_TARGETS += .configure.h lvm-version.h
DISTCLEAN_TARGETS += configure.h lvm-version.h
CLEAN_TARGETS += \
.symlinks \
.symlinks_created \

View File

@ -105,4 +105,4 @@ install_ioctl_static: $(LIB_STATIC)
$(Q) $(INSTALL_DATA) -D $< $(usrlibdir)/$(<F)
CLEAN_TARGETS += ioctl/libdevmapper.a
DISTCLEAN_TARGETS += libdevmapper.pc
DISTCLEAN_TARGETS += libdevmapper.pc make.tmpl

View File

@ -31,9 +31,11 @@ UNIT_SOURCE=\
test/unit/radix_tree_t.o: test/unit/rt_case1.c
UNIT_DEPENDS=$(subst .c,.d,$(UNIT_SOURCE))
UNIT_DEPENDS = $(UNIT_SOURCE:%.c=%.d)
UNIT_OBJECTS = $(UNIT_SOURCE:%.c=%.o)
CLEAN_TARGETS+=$(UNIT_DEPENDS) $(UNIT_OBJECTS)
CLEAN_TARGETS += $(UNIT_DEPENDS) $(UNIT_OBJECTS) \
$(UNIT_SOURCE:%.c=%.gcda) \
$(UNIT_SOURCE:%.c=%.gcno)
test/unit/unit-test: $(UNIT_OBJECTS) lib/liblvm-internal.a libdaemon/client/libdaemonclient.a $(INTERNAL_LIBS)
@echo " [LD] $@"