diff --git a/GNUmakefile b/GNUmakefile index e824afb0af..47fcde0d8a 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,173 +1,176 @@ # # Copyright (C) 2008 Andrew Beekhof # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -include Makefile PACKAGE ?= pacemaker # Force 'make dist' to be consistent with 'make export' distdir = $(PACKAGE)-$(TAG) TARFILE = $(distdir).tar.bz2 DIST_ARCHIVES = $(TARFILE) LAST_RELEASE = $(firstword $(shell hg tags| grep Pacemaker | head -n 1)) RPM_ROOT = $(shell pwd) RPM_OPTS = --define "_sourcedir $(RPM_ROOT)" \ --define "_specdir $(RPM_ROOT)" \ --define "_srcrpmdir $(RPM_ROOT)" \ MOCK_OPTIONS ?= --resultdir=$(RPM_ROOT)/mock --no-cleanup-after # Default to fedora compliant spec files # SLES: /etc/SuSE-release # openSUSE: /etc/SuSE-release # RHEL: /etc/redhat-release # Fedora: /etc/fedora-release, /etc/redhat-release, /etc/system-release getdistro = $(shell test -e /etc/SuSE-release || echo fedora; test -e /etc/SuSE-release && echo suse) PROFILE ?= $(shell rpm --eval fedora-%{fedora}-%{_arch}) DISTRO ?= $(call getdistro) TAG ?= $(firstword $(shell hg id -i | tr '+' ' ')) WITH ?= BUILD_COUNTER ?= build.counter COUNT = $(shell test ! -e $(BUILD_COUNTER) || echo $(shell expr 1 + $(shell cat $(BUILD_COUNTER)))) initialize: ./autogen.sh echo "Now run configure with any arguments (eg. --prefix) specific to your system" export: rm -f $(PACKAGE)-scratch.tar.* $(PACKAGE)-tip.tar.* if [ ! -f $(TARFILE) ]; then \ if [ $(TAG) = scratch ]; then \ hg commit -m "DO-NOT-PUSH"; \ hg archive --prefix $(distdir) -t tbz2 -r tip $(TARFILE); \ hg rollback; \ else \ hg archive --prefix $(distdir) -t tbz2 -r $(TAG) $(TARFILE); \ fi; \ echo `date`: Rebuilt $(TARFILE); \ else \ echo `date`: Using existing tarball: $(TARFILE); \ fi $(PACKAGE)-opensuse.spec: $(PACKAGE)-suse.spec cp $^ $@ @echo Rebuilt $@ $(PACKAGE)-suse.spec: $(PACKAGE).spec.in GNUmakefile rm -f $@ cp $(PACKAGE).spec.in $@ sed -i.sed s:%{_docdir}/%{name}:%{_docdir}/%{name}-%{version}:g $@ sed -i.sed s:corosynclib:libcorosync:g $@ sed -i.sed s:libexecdir:libdir:g $@ sed -i.sed 's:%{name}-libs:lib%{name}3:g' $@ sed -i.sed s:heartbeat-libs:heartbeat:g $@ sed -i.sed s:cluster-glue-libs:libglue:g $@ sed -i.sed s:libselinux-devel:automake:g $@ sed -i.sed s:lm_sensors-devel:automake:g $@ sed -i.sed s:bzip2-devel:libbz2-devel:g $@ sed -i.sed s:Development/Libraries:Development/Libraries/C\ and\ C++:g $@ sed -i.sed s:System\ Environment/Daemons:Productivity/Clustering/HA:g $@ sed -i.sed s:bcond_without\ publican:bcond_with\ publican:g $@ sed -i.sed s:\#global\ py_sitedir:\%global\ py_sitedir:g $@ sed -i.sed s:docbook-style-xsl:docbook-xsl-stylesheets:g $@ sed -i.sed s:libtool-ltdl-devel::g $@ @echo Rebuilt $@ # Works for all fedora based distros $(PACKAGE)-%.spec: $(PACKAGE).spec.in rm -f $@ cp $(PACKAGE).spec.in $(PACKAGE)-$*.spec @echo Rebuilt $@ srpm-%: export $(PACKAGE)-%.spec rm -f *.src.rpm $(PACKAGE).spec cp $(PACKAGE)-$*.spec $(PACKAGE).spec if [ -e $(BUILD_COUNTER) ]; then \ echo $(COUNT) > $(BUILD_COUNTER); \ sed -i.sed 's/global\ specversion.*/global\ specversion\ $(COUNT)/' $(PACKAGE).spec; \ fi sed -i.sed 's/global\ upstream_version.*/global\ upstream_version\ $(TAG)/' $(PACKAGE).spec rpmbuild -bs --define "dist .$*" $(RPM_OPTS) $(WITH) $(PACKAGE).spec # eg. WITH="--with cman" make rpm mock-%: make srpm-$(firstword $(shell echo $(@:mock-%=%) | tr '-' ' ')) -rm -rf $(RPM_ROOT)/mock @echo "mock --root=$* --rebuild $(WITH) $(MOCK_OPTIONS) $(RPM_ROOT)/*.src.rpm" mock -q --root=$* --rebuild $(WITH) $(MOCK_OPTIONS) $(RPM_ROOT)/*.src.rpm srpm: srpm-$(DISTRO) mock: mock-$(PROFILE) rpm: srpm @echo To create custom builds, edit the flags and options in $(PACKAGE).spec first rpmbuild $(RPM_OPTS) $(WITH) --rebuild $(RPM_ROOT)/*.src.rpm scratch: make TAG=scratch mock COVERITY_DIR = $(shell pwd)/coverity-$(TAG) COVHOST ?= coverity.example.com COVPASS ?= password coverity: test -e configure || ./autogen.sh test -e Makefile || ./configure make clean rm -rf $(COVERITY_DIR) cov-build --dir $(COVERITY_DIR) make core @echo "Waiting for a Coverity license..." cov-analyze --dir $(COVERITY_DIR) --wait-for-license cov-format-errors --dir $(COVERITY_DIR) --emacs-style > $(TAG).coverity cov-format-errors --dir $(COVERITY_DIR) rsync -avzxlSD --progress $(COVERITY_DIR)/c/output/errors/ root@www.clusterlabs.org:/var/www/html/coverity/$(PACKAGE)/$(TAG) make clean # rm -rf $(COVERITY_DIR) #cov-commit-defects --host $(COVHOST) --dir $(COVERITY_DIR) --stream $(PACKAGE) --user auto --password $(COVPASS) deb: echo To make create custom builds, edit the configure flags in debian/rules first dpkg-buildpackage -rfakeroot -us -uc global: clean-generic gtags -q global-html: global htags -sanhIT global-www: global-html rsync -avzxlSD --progress HTML/ root@www.clusterlabs.org:/var/www/html/global/$(PACKAGE) changes: @printf "\n* `date +"%a %b %d %Y"` `hg showconfig ui.username` $(VERSION)-1" @printf "\n- Update source tarball to revision: `hg id`" @printf "\n- Statistics:\n" @printf " Changesets: `hg log -M --template "{desc|firstline|strip}\n" -r $(LAST_RELEASE):tip | wc -l`\n" @printf " Diff: " @hg diff -r $(LAST_RELEASE):tip | diffstat | tail -n 1 @printf "\n- Changes since $(LAST_RELEASE)\n" @hg log -M --template " + {desc|firstline|strip}\n" -r $(LAST_RELEASE):tip | grep -v -e Dev: -e Low: -e Hg: -e "Added tag.*for changeset" | sort -uf @printf "\n" +indent: + find . -name "*.c" -exec ./p-indent \{\} \; + rel-tags: tags find . -name TAGS -exec sed -i.sed 's:\(.*\)/\(.*\)/TAGS:\2/TAGS:g' \{\} \; diff --git a/p-indent b/p-indent new file mode 100755 index 0000000000..7ffcba9fe4 --- /dev/null +++ b/p-indent @@ -0,0 +1,192 @@ +#!/bin/sh +# +# This is a copy of the linux kernel's Lindent because +# we use the same formatting. No point re-inventing that +# wheel. +# +# Differences to kernel style: +# --dont-break-procedure-type -> --break-procedure-type +# + +OPTS="" +OPTS="$OPTS --linux-style" + +#OPTS="$OPTS --blank-lines-after-commas" +OPTS="$OPTS --blank-lines-after-declarations" +#OPTS="$OPTS --blank-lines-after-procedures" +#OPTS="$OPTS --blank-lines-before-block-comments" +#OPTS="$OPTS --braces-after-if-line" +#OPTS="$OPTS --braces-after-func-def-line" +#OPTS="$OPTS --brace-indent" +#OPTS="$OPTS --braces-after-struct-decl-line" +#OPTS="$OPTS --braces-on-if-line" +#OPTS="$OPTS --braces-on-func-def-line" +#OPTS="$OPTS --braces-on-struct-decl-line" +#OPTS="$OPTS --break-after-boolean-operator" +OPTS="$OPTS --break-before-boolean-operator" +#OPTS="$OPTS --break-function-decl-args" +#OPTS="$OPTS --break-function-decl-args-end" +OPTS="$OPTS --case-indentation4" +OPTS="$OPTS --case-brace-indentation4" +#OPTS="$OPTS --comment-delimiters-on-blank-lines" +#OPTS="$OPTS --comment-indentation33" +OPTS="$OPTS --continuation-indentation4" +#OPTS="$OPTS --continue-at-parentheses" +#OPTS="$OPTS --cuddle-do-while" +#OPTS="$OPTS --cuddle-else" +#OPTS="$OPTS --declaration-comment-column33" +#OPTS="$OPTS --declaration-indentation16" +#OPTS="$OPTS --dont-break-function-decl-args" +#OPTS="$OPTS --dont-break-function-decl-args-end" +#OPTS="$OPTS --dont-break-procedure-type" +#OPTS="$OPTS --dont-cuddle-do-while" +#OPTS="$OPTS --dont-cuddle-else" +#OPTS="$OPTS --dont-format-comments" +#OPTS="$OPTS --dont-format-first-column-comments" +#OPTS="$OPTS --dont-line-up-parentheses" +#OPTS="$OPTS --dont-left-justify-declarations" +#OPTS="$OPTS --dont-space-special-semicolon" +#OPTS="$OPTS --dont-star-comments" +#OPTS="$OPTS --else-endif-column1" +#OPTS="$OPTS --format-all-comments" +#OPTS="$OPTS --format-first-column-comments" +#OPTS="$OPTS --gnu-style" +#OPTS="$OPTS --honour-newlines" +#OPTS="$OPTS --ignore-newlines" +#OPTS="$OPTS --ignore-profile" +#OPTS="$OPTS --indent-label" +OPTS="$OPTS --indent-level4" +#OPTS="$OPTS --k-and-r-style" +#OPTS="$OPTS --leave-optional-blank-lines" +#OPTS="$OPTS --leave-preprocessor-space" +#OPTS="$OPTS --left-justify-declarations" +#OPTS="$OPTS --line-comments-indentation0" +OPTS="$OPTS --line-length100" +#OPTS="$OPTS --linux-style" +#OPTS="$OPTS --no-blank-lines-after-commas" +#OPTS="$OPTS --no-blank-lines-after-declarations" +#OPTS="$OPTS --no-blank-lines-after-procedures" +#OPTS="$OPTS --no-blank-lines-before-block-comments" +#OPTS="$OPTS --no-comment-delimiters-on-blank-lines" +#OPTS="$OPTS --no-space-after-casts" +#OPTS="$OPTS --no-parameter-indentation" +#OPTS="$OPTS --no-space-after-for" +#OPTS="$OPTS --no-space-after-function-call-names" +#OPTS="$OPTS --no-space-after-if" +#OPTS="$OPTS --no-space-after-parentheses" +#OPTS="$OPTS --no-space-after-while" +#OPTS="$OPTS --no-tabs" +#OPTS="$OPTS --no-verbosity" +#OPTS="$OPTS --original" +#OPTS="$OPTS --parameter-indentation0" +#OPTS="$OPTS --paren-indentation" +#OPTS="$OPTS --preserve-mtime" +#OPTS="$OPTS --preprocessor-indentation" +#OPTS="$OPTS --procnames-start-lines" +#OPTS="$OPTS --remove-preprocessor-space" +#OPTS="$OPTS --space-after-cast" +#OPTS="$OPTS --space-after-for" +#OPTS="$OPTS --space-after-if" +#OPTS="$OPTS --space-after-parentheses" +#OPTS="$OPTS --space-after-procedure-calls" +#OPTS="$OPTS --space-after-while" +#OPTS="$OPTS --space-special-semicolon" +#OPTS="$OPTS --standard-output" +#OPTS="$OPTS --start-left-side-of-comments" +#OPTS="$OPTS --struct-brace-indentation" +#OPTS="$OPTS --swallow-optional-blank-lines" +OPTS="$OPTS --tab-size8" +#OPTS="$OPTS --use-tabs" +#OPTS="$OPTS --verbose" + +indent $OPTS "$@" + +# Lookup table +# --blank-lines-after-commas -bc +# --blank-lines-after-declarations -bad +# --blank-lines-after-procedures -bap +# --blank-lines-before-block-comments -bbb +# --braces-after-if-line -bl +# --braces-after-func-def-line -blf +# --brace-indent -bli +# --braces-after-struct-decl-line -bls +# --braces-on-if-line -br +# --braces-on-func-def-line -brf +# --braces-on-struct-decl-line -brs +# --break-after-boolean-operator -nbbo +# --break-before-boolean-operator -bbo +# --break-function-decl-args -bfda +# --break-function-decl-args-end -bfde +# --case-indentation -clin +# --case-brace-indentation -cbin +# --comment-delimiters-on-blank-lines -cdb +# --comment-indentation -cn +# --continuation-indentation -cin +# --continue-at-parentheses -lp +# --cuddle-do-while -cdw +# --cuddle-else -ce +# --declaration-comment-column -cdn +# --declaration-indentation -din +# --dont-break-function-decl-args -nbfda +# --dont-break-function-decl-args-end -nbfde +# --dont-break-procedure-type -npsl +# --dont-cuddle-do-while -ncdw +# --dont-cuddle-else -nce +# --dont-format-comments -nfca +# --dont-format-first-column-comments -nfc1 +# --dont-line-up-parentheses -nlp +# --dont-left-justify-declarations -ndj +# --dont-space-special-semicolon -nss +# --dont-star-comments -nsc +# --else-endif-column -cpn +# --format-all-comments -fca +# --format-first-column-comments -fc1 +# --gnu-style -gnu +# --honour-newlines -hnl +# --ignore-newlines -nhnl +# --ignore-profile -npro +# --indent-label -iln +# --indent-level -in +# --k-and-r-style -kr +# --leave-optional-blank-lines -nsob +# --leave-preprocessor-space -lps +# --left-justify-declarations -dj +# --line-comments-indentation -dn +# --line-length -ln +# --linux-style -linux +# --no-blank-lines-after-commas -nbc +# --no-blank-lines-after-declarations -nbad +# --no-blank-lines-after-procedures -nbap +# --no-blank-lines-before-block-comments -nbbb +# --no-comment-delimiters-on-blank-lines -ncdb +# --no-space-after-casts -ncs +# --no-parameter-indentation -nip +# --no-space-after-for -nsaf +# --no-space-after-function-call-names -npcs +# --no-space-after-if -nsai +# --no-space-after-parentheses -nprs +# --no-space-after-while -nsaw +# --no-tabs -nut +# --no-verbosity -nv +# --original -orig +# --parameter-indentation -ipn +# --paren-indentation -pin +# --preserve-mtime -pmt +# --preprocessor-indentation -ppin +# --procnames-start-lines -psl +# --remove-preprocessor-space -nlps +# --space-after-cast -cs +# --space-after-for -saf +# --space-after-if -sai +# --space-after-parentheses -prs +# --space-after-procedure-calls -pcs +# --space-after-while -saw +# --space-special-semicolon -ss +# --standard-output -st +# --start-left-side-of-comments -sc +# --struct-brace-indentation -sbin +# --swallow-optional-blank-lines -sob +# --tab-size -tsn +# --use-tabs -ut +# --verbose -v +