dhodovsk / source-git / pacemaker

Forked from source-git/pacemaker 3 years ago
Clone

Blame GNUmakefile

rpm-build 3ee90c
#
rpm-build 3ee90c
# Copyright 2008-2019 the Pacemaker project contributors
rpm-build 3ee90c
#
rpm-build 3ee90c
# The version control history for this file may have further details.
rpm-build 3ee90c
#
rpm-build 3ee90c
# This source code is licensed under the GNU General Public License version 2
rpm-build 3ee90c
# or later (GPLv2+) WITHOUT ANY WARRANTY.
rpm-build 3ee90c
#
rpm-build 3ee90c
rpm-build 3ee90c
default: build
rpm-build 3ee90c
.PHONY: default
rpm-build 3ee90c
rpm-build 3ee90c
# The toplevel "clean" targets are generated from Makefile.am, not this file.
rpm-build 3ee90c
# We can't use autotools' CLEANFILES, clean-local, etc. here. Instead, we
rpm-build 3ee90c
# define this target, which Makefile.am can use as a dependency of clean-local.
rpm-build 3ee90c
EXTRA_CLEAN_TARGETS	= ancillary-clean
rpm-build 3ee90c
rpm-build 3ee90c
-include Makefile
rpm-build 3ee90c
rpm-build 3ee90c
# The main purpose of this GNUmakefile is that its targets can be invoked
rpm-build 3ee90c
# without having to call autogen.sh and configure first. That means automake
rpm-build 3ee90c
# variables may or may not be defined. Here, we use the current working
rpm-build 3ee90c
# directory if a relevant variable hasn't been defined.
rpm-build 3ee90c
#
rpm-build 3ee90c
# The idea is to keep generated artifacts in the build tree, in case a VPATH
rpm-build 3ee90c
# build is in use, but in practice it would be difficult to make the targets
rpm-build 3ee90c
# here usable from a different location than the source tree.
rpm-build 3ee90c
abs_srcdir	?= $(shell pwd)
rpm-build 3ee90c
abs_builddir	?= $(shell pwd)
rpm-build 3ee90c
rpm-build 3ee90c
PACKAGE		?= pacemaker
rpm-build 3ee90c
rpm-build 3ee90c
rpm-build 3ee90c
# Definitions that specify what various targets will apply to
rpm-build 3ee90c
rpm-build 3ee90c
COMMIT  ?= HEAD
rpm-build 3ee90c
TAG     ?= $(shell T=$$(git describe --all '$(COMMIT)' 2>/dev/null | sed -n 's|tags/\(.*\)|\1|p'); \
rpm-build 3ee90c
	     test -n "$${T}" && echo "$${T}" \
rpm-build 3ee90c
	       || git log --pretty=format:%H -n 1 '$(COMMIT)' 2>/dev/null || echo DIST)
rpm-build 3ee90c
lparen = (
rpm-build 3ee90c
rparen = )
rpm-build 3ee90c
SHORTTAG ?= $(shell case $(TAG) in Pacemaker-*|DIST$(rparen) echo '$(TAG)' | cut -c11-;; \
rpm-build 3ee90c
	      *$(rparen) git log --pretty=format:%h -n 1 '$(TAG)';; esac)
rpm-build 3ee90c
SHORTTAG_ABBREV = $(shell printf %s '$(SHORTTAG)' | wc -c)
rpm-build 3ee90c
rpm-build 3ee90c
LAST_RC		?= $(shell test -e /Volumes || git tag -l | grep Pacemaker | sort -Vr | grep rc | head -n 1)
rpm-build 3ee90c
ifneq ($(origin VERSION), undefined)
rpm-build 3ee90c
LAST_RELEASE	?= Pacemaker-$(VERSION)
rpm-build 3ee90c
else
rpm-build 3ee90c
LAST_RELEASE	?= $(shell git tag -l | grep Pacemaker | sort -Vr | grep -v rc | head -n 1)
rpm-build 3ee90c
endif
rpm-build 3ee90c
NEXT_RELEASE	?= $(shell echo $(LAST_RELEASE) | awk -F. '/[0-9]+\./{$$3+=1;OFS=".";print $$1,$$2,$$3}')
rpm-build 3ee90c
rpm-build 3ee90c
rpm-build 3ee90c
# This Makefile can create 2 types of distributions:
rpm-build 3ee90c
#
rpm-build 3ee90c
# - "make dist" is automake's native functionality, based on the various
rpm-build 3ee90c
#   dist/nodist make variables; it always uses the current sources
rpm-build 3ee90c
#
rpm-build 3ee90c
# - "make export" is a custom target based on git archive and relevant entries
rpm-build 3ee90c
#   from .gitattributes; it defaults to current sources but can use any git tag
rpm-build 3ee90c
#
rpm-build 3ee90c
# Both types use the TARFILE name for the result, though they generate
rpm-build 3ee90c
# different contents.
rpm-build 3ee90c
distdir			= $(PACKAGE)-$(SHORTTAG)
rpm-build 3ee90c
TARFILE			= $(abs_builddir)/$(PACKAGE)-$(SHORTTAG).tar.gz
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: init
rpm-build 3ee90c
init:
rpm-build 3ee90c
	test -e $(top_srcdir)/configure || ./autogen.sh
rpm-build 3ee90c
	test -e $(abs_builddir)/Makefile || $(abs_builddir)/configure
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: build
rpm-build 3ee90c
build: init
rpm-build 3ee90c
	$(MAKE) $(AM_MAKEFLAGS) core
rpm-build 3ee90c
rpm-build 3ee90c
export:
rpm-build 3ee90c
	if [ ! -f "$(TARFILE)" ]; then						\
rpm-build 3ee90c
	    if [ $(TAG) = dirty ]; then 					\
rpm-build 3ee90c
		git commit -m "DO-NOT-PUSH" -a;					\
rpm-build 3ee90c
		git archive --prefix=$(distdir)/ -o "$(TARFILE)" HEAD^{tree};	\
rpm-build 3ee90c
		git reset --mixed HEAD^; 					\
rpm-build 3ee90c
	    else								\
rpm-build 3ee90c
		git archive --prefix=$(distdir)/ -o "$(TARFILE)" $(TAG)^{tree};	\
rpm-build 3ee90c
	    fi;									\
rpm-build 3ee90c
	    echo "`date`: Rebuilt $(TARFILE)";					\
rpm-build 3ee90c
	else									\
rpm-build 3ee90c
	    echo "`date`: Using existing tarball: $(TARFILE)";			\
rpm-build 3ee90c
	fi
rpm-build 3ee90c
rpm-build 3ee90c
## RPM-related targets
rpm-build 3ee90c
rpm-build 3ee90c
# Where to put RPM artifacts; possible values:
rpm-build 3ee90c
#
rpm-build 3ee90c
# - toplevel (default): RPM sources, spec, and source rpm in top-level build
rpm-build 3ee90c
#   directory (everything else uses the usual defaults)
rpm-build 3ee90c
#
rpm-build 3ee90c
# - subtree: RPM sources (i.e. TARFILE) in top-level build directory,
rpm-build 3ee90c
#   everything else in dedicated "rpm" subdirectory of build tree
rpm-build 3ee90c
RPMDEST         	?= toplevel
rpm-build 3ee90c
rpm-build 3ee90c
RPM_SPEC_DIR_toplevel	= $(abs_builddir)
rpm-build 3ee90c
RPM_SRCRPM_DIR_toplevel	= $(abs_builddir)
rpm-build 3ee90c
RPM_OPTS_toplevel	= --define "_sourcedir $(abs_builddir)" 		\
rpm-build 3ee90c
			  --define "_specdir   $(RPM_SPEC_DIR_toplevel)"	\
rpm-build 3ee90c
			  --define "_srcrpmdir $(RPM_SRCRPM_DIR_toplevel)"
rpm-build 3ee90c
rpm-build 3ee90c
RPM_SPEC_DIR_subtree	= $(abs_builddir)/rpm/SPECS
rpm-build 3ee90c
RPM_SRCRPM_DIR_subtree	= $(abs_builddir)/rpm/SRPMS
rpm-build 3ee90c
RPM_OPTS_subtree	= --define "_sourcedir $(abs_builddir)" 		\
rpm-build 3ee90c
			  --define "_topdir $(abs_builddir)/rpm"
rpm-build 3ee90c
rpm-build 3ee90c
RPM_SPEC_DIR	= $(RPM_SPEC_DIR_$(RPMDEST))
rpm-build 3ee90c
RPM_SRCRPM_DIR	= $(RPM_SRCRPM_DIR_$(RPMDEST))
rpm-build 3ee90c
RPM_OPTS	= $(RPM_OPTS_$(RPMDEST))
rpm-build 3ee90c
rpm-build 3ee90c
WITH		?= --without doc
rpm-build 3ee90c
BUILD_COUNTER	?= build.counter
rpm-build 3ee90c
LAST_COUNT      = $(shell test ! -e $(BUILD_COUNTER) && echo 0; test -e $(BUILD_COUNTER) && cat $(BUILD_COUNTER))
rpm-build 3ee90c
COUNT           = $(shell expr 1 + $(LAST_COUNT))
rpm-build 3ee90c
SPECVERSION	?= $(COUNT)
rpm-build 3ee90c
rpm-build 3ee90c
MOCK_DIR	= $(abs_builddir)/mock
rpm-build 3ee90c
MOCK_OPTIONS	?= --resultdir=$(MOCK_DIR) --no-cleanup-after
rpm-build 3ee90c
rpm-build 3ee90c
F	?= $(shell test ! -e /etc/fedora-release && echo 0; test -e /etc/fedora-release && rpm --eval %{fedora})
rpm-build 3ee90c
ARCH	?= $(shell test ! -e /etc/fedora-release && uname -m; test -e /etc/fedora-release && rpm --eval %{_arch})
rpm-build 3ee90c
MOCK_CFG	?= $(shell test -e /etc/fedora-release && echo fedora-$(F)-$(ARCH))
rpm-build 3ee90c
rpm-build 3ee90c
# rpmbuild wrapper that translates "--with[out] FEATURE" into RPM macros
rpm-build 3ee90c
#
rpm-build 3ee90c
# Unfortunately, at least recent versions of rpm do not support mentioned
rpm-build 3ee90c
# switch.  To work this around, we can emulate mechanism that rpm uses
rpm-build 3ee90c
# internally: unfold the flags into respective macro definitions:
rpm-build 3ee90c
#
rpm-build 3ee90c
#    --with[out] FOO  ->  --define "_with[out]_FOO --with[out]-FOO"
rpm-build 3ee90c
#
rpm-build 3ee90c
# $(1) ... WITH string (e.g., --with pre_release --without doc)
rpm-build 3ee90c
# $(2) ... options following the initial "rpmbuild" in the command
rpm-build 3ee90c
# $(3) ... final arguments determined with $2 (e.g., pacemaker.spec)
rpm-build 3ee90c
#
rpm-build 3ee90c
# Note that if $(3) is a specfile, extra case is taken so as to reflect
rpm-build 3ee90c
# pcmkversion correctly (using in-place modification).
rpm-build 3ee90c
#
rpm-build 3ee90c
# Also note that both ways to specify long option with an argument
rpm-build 3ee90c
# (i.e., what getopt and, importantly, rpm itself support) can be used:
rpm-build 3ee90c
#
rpm-build 3ee90c
#    --with FOO
rpm-build 3ee90c
#    --with=FOO
rpm-build 3ee90c
rpmbuild-with = \
rpm-build 3ee90c
	WITH=$$(getopt -o "" -l with:,without: -- $(1)) || exit 1; \
rpm-build 3ee90c
	CMD='rpmbuild $(2)'; PREREL=0; \
rpm-build 3ee90c
	eval set -- "$${WITH}"; \
rpm-build 3ee90c
	while true; do \
rpm-build 3ee90c
		case "$$1" in \
rpm-build 3ee90c
		--with) CMD="$${CMD} --define \"_with_$$2 --with-$$2\""; \
rpm-build 3ee90c
			[ "$$2" != pre_release ] || PREREL=1; shift 2;; \
rpm-build 3ee90c
		--without) CMD="$${CMD} --define \"_without_$$2 --without-$$2\""; \
rpm-build 3ee90c
		        [ "$$2" != pre_release ] || PREREL=0; shift 2;; \
rpm-build 3ee90c
		--) shift ; break ;; \
rpm-build 3ee90c
		*) echo "cannot parse WITH: $$1"; exit 1;; \
rpm-build 3ee90c
		esac; \
rpm-build 3ee90c
	done; \
rpm-build 3ee90c
	case "$(3)" in \
rpm-build 3ee90c
	*.spec) { [ $${PREREL} -eq 0 ] || [ $(LAST_RELEASE) = $(TAG) ]; } \
rpm-build 3ee90c
		&& sed -i "s/^\(%global pcmkversion \).*/\1$$(echo $(LAST_RELEASE) | sed -e s:Pacemaker-:: -e s:-.*::)/" $(3) \
rpm-build 3ee90c
		|| sed -i "s/^\(%global pcmkversion \).*/\1$$(echo $(NEXT_RELEASE) | sed -e s:Pacemaker-:: -e s:-.*::)/" $(3);; \
rpm-build 3ee90c
	esac; \
rpm-build 3ee90c
	CMD="$${CMD} $(3)"; \
rpm-build 3ee90c
	eval "$${CMD}"
rpm-build 3ee90c
rpm-build 3ee90c
# Depend on spec-clean so it gets rebuilt every time
rpm-build 3ee90c
$(RPM_SPEC_DIR)/$(PACKAGE).spec: spec-clean rpm/pacemaker.spec.in
rpm-build 3ee90c
	$(AM_V_at)$(MKDIR_P) $(RPM_SPEC_DIR)	# might not exist in VPATH build
rpm-build 3ee90c
	$(AM_V_GEN)if [ x != x"`git ls-files -m rpm/pacemaker.spec.in 2>/dev/null`" ]; then	\
rpm-build 3ee90c
	    cat $(abs_srcdir)/rpm/pacemaker.spec.in;							\
rpm-build 3ee90c
	elif git cat-file -e $(TAG):rpm/pacemaker.spec.in 2>/dev/null; then		\
rpm-build 3ee90c
	    git show $(TAG):rpm/pacemaker.spec.in;					\
rpm-build 3ee90c
	elif git cat-file -e $(TAG):pacemaker.spec.in 2>/dev/null; then			\
rpm-build 3ee90c
	    git show $(TAG):pacemaker.spec.in;						\
rpm-build 3ee90c
	else 										\
rpm-build 3ee90c
	    cat $(abs_srcdir)/rpm/pacemaker.spec.in;							\
rpm-build 3ee90c
	fi | sed									\
rpm-build 3ee90c
	    -e 's/global\ specversion\ .*/global\ specversion\ $(SPECVERSION)/' 	\
rpm-build 3ee90c
	    -e 's/global\ commit\ .*/global\ commit\ $(SHORTTAG)/'			\
rpm-build 3ee90c
	    -e 's/global\ commit_abbrev\ .*/global\ commit_abbrev\ $(SHORTTAG_ABBREV)/' \
rpm-build 3ee90c
	    -e "s/PACKAGE_DATE/$$(date +'%a %b %d %Y')/"				\
rpm-build 3ee90c
	    -e "s/PACKAGE_VERSION/$$(git describe --tags $(TAG) | sed -e s:Pacemaker-:: -e s:-.*::)/"	\
rpm-build 3ee90c
	    > "$@"
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: $(PACKAGE).spec
rpm-build 3ee90c
$(PACKAGE).spec: $(RPM_SPEC_DIR)/$(PACKAGE).spec
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: spec-clean
rpm-build 3ee90c
spec-clean:
rpm-build 3ee90c
	-rm -f $(RPM_SPEC_DIR)/$(PACKAGE).spec
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: srpm
rpm-build 3ee90c
srpm:	export srpm-clean $(RPM_SPEC_DIR)/$(PACKAGE).spec
rpm-build 3ee90c
	if [ -e $(BUILD_COUNTER) ]; then					\
rpm-build 3ee90c
		echo $(COUNT) > $(BUILD_COUNTER);				\
rpm-build 3ee90c
	fi
rpm-build 3ee90c
	$(call rpmbuild-with,$(WITH),-bs $(RPM_OPTS),$(RPM_SPEC_DIR)/$(PACKAGE).spec)
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: srpm-clean
rpm-build 3ee90c
srpm-clean:
rpm-build 3ee90c
	-rm -f $(RPM_SRCRPM_DIR)/*.src.rpm
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: chroot
rpm-build 3ee90c
chroot: mock-$(MOCK_CFG) mock-install-$(MOCK_CFG) mock-sh-$(MOCK_CFG)
rpm-build 3ee90c
	@echo "Done"
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: mock-next
rpm-build 3ee90c
mock-next:
rpm-build 3ee90c
	$(MAKE) $(AM_MAKEFLAGS) F=$(shell expr 1 + $(F)) mock
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: mock-rawhide
rpm-build 3ee90c
mock-rawhide:
rpm-build 3ee90c
	$(MAKE) $(AM_MAKEFLAGS) F=rawhide mock
rpm-build 3ee90c
rpm-build 3ee90c
mock-install-%:
rpm-build 3ee90c
	@echo "Installing packages"
rpm-build 3ee90c
	mock --root=$* $(MOCK_OPTIONS) --install $(MOCK_DIR)/*.rpm \
rpm-build 3ee90c
		vi sudo valgrind lcov gdb fence-agents psmisc
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: mock-install
rpm-build 3ee90c
mock-install: mock-install-$(MOCK_CFG)
rpm-build 3ee90c
	@echo "Done"
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: mock-sh
rpm-build 3ee90c
mock-sh: mock-sh-$(MOCK_CFG)
rpm-build 3ee90c
	@echo "Done"
rpm-build 3ee90c
rpm-build 3ee90c
mock-sh-%:
rpm-build 3ee90c
	@echo "Connecting"
rpm-build 3ee90c
	mock --root=$* $(MOCK_OPTIONS) --shell
rpm-build 3ee90c
	@echo "Done"
rpm-build 3ee90c
rpm-build 3ee90c
mock-%: srpm mock-clean
rpm-build 3ee90c
	mock $(MOCK_OPTIONS) --root=$* --no-cleanup-after --rebuild	\
rpm-build 3ee90c
		$(WITH) $(RPM_SRCRPM_DIR)/*.src.rpm
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: mock
rpm-build 3ee90c
mock:   mock-$(MOCK_CFG)
rpm-build 3ee90c
	@echo "Done"
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: dirty
rpm-build 3ee90c
dirty:
rpm-build 3ee90c
	$(MAKE) $(AM_MAKEFLAGS) TAG=dirty mock
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: mock-clean
rpm-build 3ee90c
mock-clean:
rpm-build 3ee90c
	-rm -rf $(MOCK_DIR)
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: rpm-dep
rpm-build 3ee90c
rpm-dep: $(RPM_SPEC_DIR)/$(PACKAGE).spec
rpm-build 3ee90c
	sudo yum-builddep $(PACKAGE).spec
rpm-build 3ee90c
rpm-build 3ee90c
# e.g. make WITH="--with pre_release" rpm
rpm-build 3ee90c
.PHONY: rpm
rpm-build 3ee90c
rpm:	srpm
rpm-build 3ee90c
	@echo To create custom builds, edit the flags and options in $(PACKAGE).spec first
rpm-build 3ee90c
	$(call rpmbuild-with,$(WITH),$(RPM_OPTS),--rebuild $(RPM_SRCRPM_DIR)/*.src.rpm)
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: rpmlint
rpm-build 3ee90c
rpmlint: $(RPM_SPEC_DIR)/$(PACKAGE).spec
rpm-build 3ee90c
	rpmlint -f rpm/rpmlintrc "$<"
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: release
rpm-build 3ee90c
release:
rpm-build 3ee90c
	$(MAKE) $(AM_MAKEFLAGS) TAG=$(LAST_RELEASE) rpm
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: rc
rpm-build 3ee90c
rc:
rpm-build 3ee90c
	$(MAKE) $(AM_MAKEFLAGS) TAG=$(LAST_RC) rpm
rpm-build 3ee90c
rpm-build 3ee90c
rpm-build 3ee90c
## Static analysis via coverity
rpm-build 3ee90c
rpm-build 3ee90c
# Aggressiveness (low, medium, or high)
rpm-build 3ee90c
COVLEVEL	?= low
rpm-build 3ee90c
rpm-build 3ee90c
# Generated outputs
rpm-build 3ee90c
COVERITY_DIR	= $(abs_builddir)/coverity-$(TAG)
rpm-build 3ee90c
COVTAR		= $(abs_builddir)/$(PACKAGE)-coverity-$(TAG).tgz
rpm-build 3ee90c
COVEMACS	= $(abs_builddir)/$(TAG).coverity
rpm-build 3ee90c
COVHTML		= $(COVERITY_DIR)/output/errors
rpm-build 3ee90c
rpm-build 3ee90c
# Coverity outputs are phony so they get rebuilt every invocation
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: $(COVERITY_DIR)
rpm-build 3ee90c
$(COVERITY_DIR): init core-clean coverity-clean
rpm-build 3ee90c
	$(AM_V_GEN)cov-build --dir "$@" $(MAKE) $(AM_MAKEFLAGS) core
rpm-build 3ee90c
rpm-build 3ee90c
# Public coverity instance
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: $(COVTAR)
rpm-build 3ee90c
$(COVTAR): $(COVERITY_DIR)
rpm-build 3ee90c
	$(AM_V_GEN)tar czf "$@" --transform="s@.*$(TAG)@cov-int@" "$<"
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: coverity
rpm-build 3ee90c
coverity: $(COVTAR)
rpm-build 3ee90c
	@echo "Now go to https://scan.coverity.com/users/sign_in and upload:"
rpm-build 3ee90c
	@echo "  $(COVTAR)"
rpm-build 3ee90c
	@echo "then make core-clean coverity-clean"
rpm-build 3ee90c
rpm-build 3ee90c
# Licensed coverity instance
rpm-build 3ee90c
#
rpm-build 3ee90c
# The prerequisites are a little hacky; rather than actually required, some
rpm-build 3ee90c
# of them are designed so that things execute in the proper order (which is
rpm-build 3ee90c
# not the same as GNU make's order-only prerequisites).
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: coverity-analyze
rpm-build 3ee90c
coverity-analyze: $(COVERITY_DIR)
rpm-build 3ee90c
	@echo ""
rpm-build 3ee90c
	@echo "Analyzing (waiting for coverity license if necessary) ..."
rpm-build 3ee90c
	cov-analyze --dir "$<" --wait-for-license --security		\
rpm-build 3ee90c
		--aggressiveness-level "$(COVLEVEL)"
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: $(COVEMACS)
rpm-build 3ee90c
$(COVEMACS): coverity-analyze
rpm-build 3ee90c
	$(AM_V_GEN)cov-format-errors --dir "$(COVERITY_DIR)" --emacs-style > "$@"
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: $(COVHTML)
rpm-build 3ee90c
$(COVHTML): $(COVEMACS)
rpm-build 3ee90c
	$(AM_V_GEN)cov-format-errors --dir "$(COVERITY_DIR)" --html-output "$@"
rpm-build 3ee90c
rpm-build 3ee90c
.PHONY: coverity-corp
rpm-build 3ee90c
coverity-corp: $(COVHTML)
rpm-build 3ee90c
	$(MAKE) $(AM_MAKEFLAGS) core-clean
rpm-build 3ee90c
	@echo "Done. See:"
rpm-build 3ee90c
	@echo "  file://$(COVHTML)/index.html"
rpm-build 3ee90c
	@echo "When no longer needed, make coverity-clean"
rpm-build 3ee90c
rpm-build 3ee90c
# Remove all outputs regardless of tag
rpm-build 3ee90c
.PHONY: coverity-clean
rpm-build 3ee90c
coverity-clean:
rpm-build 3ee90c
	-rm -rf "$(abs_builddir)"/coverity-*			\
rpm-build 3ee90c
		"$(abs_builddir)"/$(PACKAGE)-coverity-*.tgz	\
rpm-build 3ee90c
		"$(abs_builddir)"/*.coverity
rpm-build 3ee90c
rpm-build 3ee90c
rpm-build 3ee90c
## Change log generation
rpm-build 3ee90c
rpm-build 3ee90c
summary:
rpm-build 3ee90c
	@printf "\n* `date +"%a %b %d %Y"` `git config user.name` <`git config user.email`> $(NEXT_RELEASE)"
rpm-build 3ee90c
	@printf "\n- Changesets: `git log --pretty=oneline --no-merges $(LAST_RELEASE)..HEAD | wc -l`"
rpm-build 3ee90c
	@printf "\n- Diff:\n"
rpm-build 3ee90c
	@git diff $(LAST_RELEASE)..HEAD --shortstat include lib daemons tools xml
rpm-build 3ee90c
rpm-build 3ee90c
rc-changes:
rpm-build 3ee90c
	@$(MAKE) $(AM_MAKEFLAGS) NEXT_RELEASE=$(shell echo $(LAST_RC) | sed s:-rc.*::) LAST_RELEASE=$(LAST_RC) changes
rpm-build 3ee90c
rpm-build 3ee90c
changes: summary
rpm-build 3ee90c
	@printf "\n- Features added since $(LAST_RELEASE)\n"
rpm-build 3ee90c
	@git log --pretty=format:'  +%s' --abbrev-commit $(LAST_RELEASE)..HEAD | grep -e Feature: | sed -e 's@Feature:@@' | sort -uf
rpm-build 3ee90c
	@printf "\n- Changes since $(LAST_RELEASE)\n"
rpm-build 3ee90c
	@git log --pretty=format:'  +%s' --no-merges --abbrev-commit $(LAST_RELEASE)..HEAD \
rpm-build 3ee90c
		| grep -e High: -e Fix: -e Bug | sed \
rpm-build 3ee90c
			-e 's@\(Fix\|High\|Bug\):@@' \
rpm-build 3ee90c
			-e 's@\(cib\|pacemaker-based\|based\):@CIB:@' \
rpm-build 3ee90c
			-e 's@\(crmd\|pacemaker-controld\|controld\):@controller:@' \
rpm-build 3ee90c
			-e 's@\(lrmd\|pacemaker-execd\|execd\):@executor:@' \
rpm-build 3ee90c
			-e 's@\(Fencing\|stonithd\|stonith\|pacemaker-fenced\|fenced\):@fencing:@' \
rpm-build 3ee90c
			-e 's@\(PE\|pengine\|pacemaker-schedulerd\|schedulerd\):@scheduler:@' \
rpm-build 3ee90c
		| sort -uf
rpm-build 3ee90c
rpm-build 3ee90c
authors:
rpm-build 3ee90c
	git log $(LAST_RELEASE)..$(COMMIT) --format='%an' | sort -u
rpm-build 3ee90c
rpm-build 3ee90c
changelog:
rpm-build 3ee90c
	@$(MAKE) $(AM_MAKEFLAGS) changes > ChangeLog
rpm-build 3ee90c
	@printf "\n">> ChangeLog
rpm-build 3ee90c
	git show $(LAST_RELEASE):ChangeLog >> ChangeLog
rpm-build 3ee90c
rpm-build 3ee90c
DO_NOT_INDENT = lib/gnu daemons/controld/controld_fsa.h
rpm-build 3ee90c
rpm-build 3ee90c
indent:
rpm-build 3ee90c
	find . -name "*.[ch]" -exec ./p-indent \{\} \;
rpm-build 3ee90c
	git co HEAD $(DO_NOT_INDENT)
rpm-build 3ee90c
rpm-build 3ee90c
rel-tags: tags
rpm-build 3ee90c
	find . -name TAGS -exec sed -i 's:\(.*\)/\(.*\)/TAGS:\2/TAGS:g' \{\} \;
rpm-build 3ee90c
rpm-build 3ee90c
CLANG_analyzer = $(shell which scan-build)
rpm-build 3ee90c
CLANG_checkers = 
rpm-build 3ee90c
rpm-build 3ee90c
# Use CPPCHECK_ARGS to pass extra cppcheck options, e.g.:
rpm-build 3ee90c
# --enable={warning,style,performance,portability,information,all}
rpm-build 3ee90c
# --inconclusive --std=posix
rpm-build 3ee90c
CPPCHECK_ARGS ?=
rpm-build 3ee90c
cppcheck:
rpm-build 3ee90c
	cppcheck $(CPPCHECK_ARGS) -I include --max-configs=25 -q replace lib daemons tools
rpm-build 3ee90c
rpm-build 3ee90c
clang:
rpm-build 3ee90c
	test -e $(CLANG_analyzer)
rpm-build 3ee90c
	scan-build $(CLANG_checkers:%=-enable-checker %) $(MAKE) $(AM_MAKEFLAGS) clean all
rpm-build 3ee90c
rpm-build 3ee90c
# V3	= scandir unsetenv alphasort xalloc
rpm-build 3ee90c
# V2	= setenv strerror strchrnul strndup
rpm-build 3ee90c
# https://www.gnu.org/software/gnulib/manual/html_node/Initial-import.html#Initial-import
rpm-build 3ee90c
# previously, this was crypto/md5, but got spoiled with streams/kernel crypto
rpm-build 3ee90c
GNU_MODS	= crypto/md5-buffer
rpm-build 3ee90c
# stdint appears to be surrogate only for C99-lacking environments
rpm-build 3ee90c
GNU_MODS_AVOID	= stdint
rpm-build 3ee90c
# only for plain crypto/md5: we make do without kernel-assisted crypto
rpm-build 3ee90c
# GNU_MODS_AVOID	+= crypto/af_alg
rpm-build 3ee90c
gnulib-update:
rpm-build 3ee90c
	-test -e maint/gnulib \
rpm-build 3ee90c
	  || git clone https://git.savannah.gnu.org/git/gnulib.git maint/gnulib
rpm-build 3ee90c
	cd maint/gnulib && git pull
rpm-build 3ee90c
	maint/gnulib/gnulib-tool \
rpm-build 3ee90c
	  --source-base=lib/gnu --lgpl=2 --no-vc-files --no-conditional-dependencies \
rpm-build 3ee90c
	  $(GNU_MODS_AVOID:%=--avoid %) --import $(GNU_MODS)
rpm-build 3ee90c
rpm-build 3ee90c
ancillary-clean: spec-clean srpm-clean mock-clean coverity-clean
rpm-build 3ee90c
	-rm -f $(TARFILE)