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

makefiles: runtime spec.inc

Support  CLEAN_DIRS
Var for rpmbuilddir
Use LN_S
Generate spec.inc at runtime for 'make rpm'.
This commit is contained in:
Zdenek Kabelac 2015-05-11 21:48:11 +02:00
parent f5199a1cbd
commit 9c2a6de68f
3 changed files with 26 additions and 14 deletions

View File

@ -99,24 +99,33 @@ check check_system check_cluster check_local check_lvmetad unit: all
conf.generate: tools conf.generate: tools
VER = LVM2.@LVM_MAJOR@.@LVM_MINOR@.@LVM_PATCHLEVEL@ # how to use parenthesis in makefiles
CLEAN_TARGETS += $(VER).tgz leftparen:=(
clean: LVM_VER := $(firstword $(subst $(leftparen), ,$(LVM_VERSION)))
$(RM) -r build VER := LVM2.$(LVM_VER)
# release file name
FILE_VER := $(VER).tgz
CLEAN_TARGETS += $(FILE_VER)
CLEAN_DIRS += $(rpmbuilddir)
dist: dist:
@echo "Generating $(VER).tgz";\ @echo "Generating $(FILE_VER)";\
git ls-tree -r HEAD --name-only | xargs tar --transform "s,^,$(VER)/," -zcf $(VER).tgz (cd $(top_srcdir); git ls-tree -r HEAD --name-only | xargs tar --transform "s,^,$(VER)/," -c) | gzip >$(FILE_VER)
rpm: dist rpm: dist
$(MKDIR_P) build/SPECS build/SOURCES $(RM) -r $(rpmbuilddir)/SOURCES
ln -sf $(abs_top_srcdir)/spec/lvm2.spec build/SPECS $(MKDIR_P) $(rpmbuilddir)/SOURCES
ln -sf $(abs_top_srcdir)/spec/build.inc build/SOURCES $(LN_S) -f $(abs_top_builddir)/$(FILE_VER) $(rpmbuilddir)/SOURCES
ln -sf $(abs_top_srcdir)/spec/macros.inc build/SOURCES $(LN_S) -f $(abs_top_srcdir)/spec/build.inc $(rpmbuilddir)/SOURCES
ln -sf $(abs_top_srcdir)/spec/packages.inc build/SOURCES $(LN_S) -f $(abs_top_srcdir)/spec/macros.inc $(rpmbuilddir)/SOURCES
ln -sf $(abs_top_srcdir)/spec/source.inc build/SOURCES $(LN_S) -f $(abs_top_srcdir)/spec/packages.inc $(rpmbuilddir)/SOURCES
ln -sf $(abs_top_builddir)/$(VER).tgz build/SOURCES DM_VER=$$(cut -d- -f1 $(top_srcdir)/VERSION_DM);\
rpmbuild -v --define "_topdir $(abs_top_builddir)/build" -ba build/SPECS/lvm2.spec GIT_VER=$$(cd $(top_srcdir); git describe | cut -d- --output-delimiter=. -f2,3 || echo 0);\
sed -e "s,\(device_mapper_version\) [0-9.]*$$,\1 $$DM_VER," \
-e "s,^\(Version:[^0-9%]*\)[0-9.]*$$,\1 $(LVM_VER)," \
-e "s,^\(Release:[^0-9%]*\)[0-9.]\+,\1 $$GIT_VER," \
$(top_srcdir)/spec/source.inc >$(rpmbuilddir)/SOURCES/source.inc
rpmbuild -v --define "_topdir $(abs_top_builddir)/$(rpmbuilddir)" -ba $(top_srcdir)/spec/lvm2.spec
generate: conf.generate generate: conf.generate
$(MAKE) -C conf generate $(MAKE) -C conf generate

View File

@ -1,5 +1,6 @@
Version 2.02.120 - Version 2.02.120 -
=============================== ===============================
Provide make dist and make rpm targets
Configure lvm.conf for use_lvmetad and use_lvmpolld. Configure lvm.conf for use_lvmetad and use_lvmpolld.
Add lvpoll for cmdline communication with lvmpolld. Add lvpoll for cmdline communication with lvmpolld.
Add lvmpolld acting as a free-standing version of polldaemon. Add lvmpolld acting as a free-standing version of polldaemon.

View File

@ -116,6 +116,7 @@ vpath %.exported_symbols $(srcdir)
interface = @interface@ interface = @interface@
interfacebuilddir = $(top_builddir)/libdm/$(interface) interfacebuilddir = $(top_builddir)/libdm/$(interface)
rpmbuilddir = build
# The number of jobs to run, if blank, defaults to the make standard # The number of jobs to run, if blank, defaults to the make standard
ifndef MAKEFLAGS ifndef MAKEFLAGS
@ -465,6 +466,7 @@ $(LIB_STATIC): $(OBJECTS)
$(MSGFMT) -o $@ $< $(MSGFMT) -o $@ $<
cleandir: cleandir:
test -z "$(CLEAN_DIRS)" || $(RM) -r $(CLEAN_DIRS)
$(RM) $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(CLEAN_CFLOW) $(LDDEPS) \ $(RM) $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(CLEAN_CFLOW) $(LDDEPS) \
$(POTFILES) $(SOURCES:%.c=%.d) $(SOURCES:%.c=%.gcno) $(SOURCES:%.c=%.gcda) \ $(POTFILES) $(SOURCES:%.c=%.d) $(SOURCES:%.c=%.gcno) $(SOURCES:%.c=%.gcda) \
$(SOURCES2:%.c=%.o) $(SOURCES2:%.c=%.d) $(SOURCES2:%.c=%.gcno) $(SOURCES2:%.c=%.gcda) \ $(SOURCES2:%.c=%.o) $(SOURCES2:%.c=%.d) $(SOURCES2:%.c=%.gcno) $(SOURCES2:%.c=%.gcda) \