summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-07-25 20:58:05 +0300
committerSergey Poznyakoff <gray@gnu.org>2018-07-25 21:12:46 +0300
commitc1550a832516200f7181d9addd235aa7737dba46 (patch)
tree29b897f0f6c655fa9e6f0a2e8352c41f8878576a
parentd28617d1442a7bd21d938edde539b56f3b5e7638 (diff)
downloadmailutils-c1550a832516200f7181d9addd235aa7737dba46.tar.gz
mailutils-c1550a832516200f7181d9addd235aa7737dba46.tar.bz2
Add maintainer's makefiles
-rw-r--r--GNUmakefile11
-rw-r--r--README-hacking24
-rw-r--r--maint/bootstrap.mk15
-rw-r--r--maint/flowgraph.mk81
-rw-r--r--maint/release.mk34
5 files changed, 150 insertions, 15 deletions
diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644
index 000000000..514646926
--- /dev/null
+++ b/GNUmakefile
@@ -0,0 +1,11 @@
+# Maintainer's make file for mailutils.
+#
+ifneq (,$(wildcard Makefile))
+ include Makefile
+ include maint/flowgraph.mk
+ include maint/release.mk
+else
+$(if $(MAKECMDGOALS),$(MAKECMDGOALS),all):
+ $(MAKE) -f maint/bootstrap.mk
+ $(MAKE) $(MAKECMDGOALS)
+endif
diff --git a/README-hacking b/README-hacking
index 49e0d267a..9be311cdc 100644
--- a/README-hacking
+++ b/README-hacking
@@ -22,7 +22,11 @@ version.
Obviously, if you are reading these notes, you did manage to clone
Mailutils from Git. The next step is to get other files needed to build,
-which are extracted from other source packages:
+which are extracted from other source packages.
+
+If you use GNU make, you can just type 'make' and the package will be
+bootstrapped, configured and built automatically. Otherwise, please
+follow the steps below:
1. Change to the source tree directory
@@ -51,31 +55,21 @@ For more information about `bootstrap', run `bootstrap --help'.
* Flowgraphs
-To obtain flowgraphs, you need GNU cflow v.1.3 or higher.
+To obtain flowgraphs, you need GNU cflow v.1.3 or higher. The
+discussion below assumes you are using GNU make.
To create or update all flowgraphs, run the following command
from the source tree root directory:
- make -f maint.mk
+ make flowgraph
The flowgraphs will be created in the subdirectories and
named COMP.cflow, where COMP is the name of the corresponding
Mailutils component.
-To create or update the flowgraph for a given component, change
-into this component's subdirectory and run
-
- make -f ../maint.mk flowgraph
-
-If the component in question has its own maint.mk, run
-
- make -f maint.mk flowgraph
-
-instead.
-
To clean all flowgraphs, run (from the source tree root directory):
- make -f maint.mk maintclean-recursive
+ make flowclean
* Copyright information
diff --git a/maint/bootstrap.mk b/maint/bootstrap.mk
new file mode 100644
index 000000000..f6ac8ded4
--- /dev/null
+++ b/maint/bootstrap.mk
@@ -0,0 +1,15 @@
+# SYNOPSIS
+# make bootstrap
+#
+# DESRIPTION
+# Bootstrap a freshly cloned copy of mailutils.
+#
+
+ChangeLog: Makefile
+ $(MAKE) ChangeLog
+
+Makefile: Makefile.am configure
+ ./configure
+
+configure: configure.ac
+ ./bootstrap
diff --git a/maint/flowgraph.mk b/maint/flowgraph.mk
new file mode 100644
index 000000000..7e9ac4197
--- /dev/null
+++ b/maint/flowgraph.mk
@@ -0,0 +1,81 @@
+# SYNOPSIS
+# make flowgraph
+# make flowclean
+# DESCRIPTION
+# Creates or cleans up flowgraphs in each source directory.
+# Flowgraphs are created using GNU cflow.
+# PREREQUISITES
+# Main Makefile from the Mailutils top-level source directory must be
+# included atop of this one.
+#
+CFLOW_FLAGS=-i^s --brief \
+ --define '__attribute__\(c\)'\
+ --symbol __inline:=inline\
+ --symbol __inline__:=inline\
+ --symbol __const__:=const\
+ --symbol __const:=const\
+ --symbol __restrict:=restrict\
+ --symbol __extension__:qualifier\
+ --symbol __asm__:wrapper\
+ --symbol __nonnull:wrapper\
+ --symbol __wur:wrapper
+
+FLOWCLEAN_FILES=
+
+define flowgraph_tmpl
+$(if $($(2)_OBJECTS),
+FLOWCLEAN_FILES += $(1).cflow
+$(2)_CFLOW_INPUT=$$($(2)_OBJECTS:.$(3)=.c)
+$(1).cflow: $$($(2)_CFLOW_INPUT) Makefile
+ $$(AM_V_GEN)cflow -o$$@ $$(CFLOW_FLAGS) $$(DEFS) \
+ $$(DEFAULT_INCLUDES) $$(INCLUDES) $$(AM_CPPFLAGS) \
+ $$(CPPFLAGS) \
+ $$($(2)_CFLOW_INPUT)
+,
+$(1).cflow:;
+)
+endef
+
+$(foreach prog,$(bin_PROGRAMS) $(sbin_PROGRAMS),\
+$(eval $(call flowgraph_tmpl,$(prog),$(subst -,_,$(prog)),$(OBJEXT))))
+
+$(foreach prog,$(lib_LTLIBRARIES),\
+$(eval $(call flowgraph_tmpl,$(prog),$(subst .,_,$(prog)),lo)))
+
+flowgraph-local: $(foreach prog,$(bin_PROGRAMS) $(sbin_PROGRAMS) $(lib_LTLIBRARIES),$(prog).cflow)
+
+flowclean-local:
+ -@test -n "$(FLOWCLEAN_FILES)" && rm -f $(FLOWCLEAN_FILES)
+
+##
+
+MAINT_MK = $(abspath $(firstword $(MAKEFILE_LIST)))
+MAINT_INC = $(dir $(MAINT_MK))
+LOCAL_MK = $(notdir $(firstword $(MAKEFILE_LIST)))
+
+flowgraph flowclean:
+ @$(MAKE) -f $(MAINT_MK) $@-recursive
+
+flowgraph-recursive flowclean-recursive:
+ failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ target=`echo $@ | sed s/-recursive/-local/`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ continue; \
+ fi; \
+ if test -f $$subdir/$(LOCAL_MK); then \
+ makefile='$(LOCAL_MK)'; \
+ else \
+ makefile="$(MAINT_MK)"; \
+ fi; \
+ $(MAKE) -C $$subdir -f $$makefile -I $(MAINT_INC) $$target \
+ || eval $$failcom; \
+ done; \
+ test -z "$$fail"
diff --git a/maint/release.mk b/maint/release.mk
new file mode 100644
index 000000000..5afe14068
--- /dev/null
+++ b/maint/release.mk
@@ -0,0 +1,34 @@
+# SYNOPSIS
+# make release
+#
+# DESRIPTION
+# Publishes a new release. The version number is determined by
+# analyzing gitinfo.pl output. The destination upload server is
+# determined depending on the version number. Two-part version
+# number is considered to be a stable release. A three (or more)-part
+# version number is an alpha version
+#
+# PREREQUISITES
+# Main Makefile from the Mailutils top-level source directory must be
+# included atop of this one.
+
+release:
+ @set -- `$(GITINFO) -H'$$refversion{?$$refdist>0??-$$refdist?} $$upload_dest'`;\
+ $(MAKE) -f $(firstword $(MAKEFILE_LIST)) DIST_ARCHIVES="$(subst -$(VERSION),-$$1,$(DIST_ARCHIVES))" UPLOAD_TO=$$2 distdir=$(PACKAGE)-$$1 release_archives
+
+GNUPLOAD_OPT=\
+ --to $(UPLOAD_TO).gnu.org:mailutils\
+ --to download.gnu.org.ua:$(UPLOAD_TO)/mailutils\
+ --symlink-regex
+
+release_archives: $(DIST_ARCHIVES)
+ @case "$(UPLOAD_TO)" in \
+ alpha|ftp) ;; \
+ *) echo >&2 "Don't use make release_archives, use make release instead";\
+ exit 1; \
+ esac; \
+ echo "Releasing $(DIST_ARCHIVES) to $(UPLOAD_TO)"; \
+ gnupload $(GNUPLOAD_OPT) $(DIST_ARCHIVES)
+
+%.tar.gz:
+ test -f $@ || $(MAKE) distcheck distdir=$*

Return to:

Send suggestions and report system problems to the System administrator.