URLs and the email address are currently spread out over multiple
files. This commit cleans up the mess by defining everything in
Makefile and adjusting other places to use the information from there.
We use the opportunity to add a link to the author's home page.
version-gen.sh is made generic, i.e., it does not refer to tfortune
any more.
SAY = @echo '$(strip $(1))'
endif
SAY = @echo '$(strip $(1))'
endif
+PACKAGE := tfortune
+SLOGAN := fortune cookies with tags
+EMAIL := maan@tuebingen.mpg.de
-CLONE_URL := git://git.tuebingen.mpg.de/tfortune
-GITWEB_URL := http://git.tuebingen.mpg.de/tfortune.git
+PACKAGE_HOMEPAGE := http://people.tuebingen.mpg.de/maan/$(PACKAGE)/
+CLONE_URL := git://git.tuebingen.mpg.de/$(PACKAGE)/
+GITWEB_URL := http://git.tuebingen.mpg.de/$(PACKAGE).git
LICENSE := GNU GPL version 3
LICENSE_URL := https://www.gnu.org/licenses/gpl-3.0-standalone.html
LICENSE := GNU GPL version 3
LICENSE_URL := https://www.gnu.org/licenses/gpl-3.0-standalone.html
+HOME_URL := http://people.tuebingen.mpg.de/maan/
define DESCRIPTION1 :=
Like fortune(1), tfortune is a Unix command line utility which prints
define DESCRIPTION1 :=
Like fortune(1), tfortune is a Unix command line utility which prints
that enables bash command line completion is also included.
endef
LOGLEVELS := LL_DEBUG,LL_INFO,LL_NOTICE,LL_WARNING,LL_ERROR,LL_CRIT,LL_EMERG
that enables bash command line completion is also included.
endef
LOGLEVELS := LL_DEBUG,LL_INFO,LL_NOTICE,LL_WARNING,LL_ERROR,LL_CRIT,LL_EMERG
-GIT_VERSION := $(shell ./version-gen.sh)
+GIT_VERSION := $(shell ./version-gen.sh $(PACKAGE) version.c)
cc_version := $(shell $(CC) --version | head -n 1)
build_date := $(shell date)
uname_rs := $(shell uname -rs)
cc_version := $(shell $(CC) --version | head -n 1)
build_date := $(shell date)
uname_rs := $(shell uname -rs)
index.html tfortune.suite: %: %.m4
$(call SAY, M4 $<)
$(M4) -D "AUTHOR=$(AUTHOR)" -D "COPYRIGHT_YEAR=$(COPYRIGHT_YEAR)" \
index.html tfortune.suite: %: %.m4
$(call SAY, M4 $<)
$(M4) -D "AUTHOR=$(AUTHOR)" -D "COPYRIGHT_YEAR=$(COPYRIGHT_YEAR)" \
- -D "PACKAGE_BUGREPORT=$(PACKAGE_BUGREPORT)" \
+ -D "PACKAGE=$(PACKAGE)" \
+ -D "SLOGAN=$(SLOGAN)" \
+ -D "EMAIL=$(EMAIL)" \
-D "PACKAGE_URL=$(PACKAGE_URL)" \
-D "PACKAGE_URL=$(PACKAGE_URL)" \
+ -D "PACKAGE_HOMEPAGE=$(PACKAGE_HOMEPAGE)" \
-D "CLONE_URL=$(CLONE_URL)" \
-D "GITWEB_URL=$(GITWEB_URL)" \
-D "CLONE_URL=$(CLONE_URL)" \
-D "GITWEB_URL=$(GITWEB_URL)" \
+ -D "HOME_URL=$(HOME_URL)" \
-D "LICENSE=$(LICENSE)" \
-D "LICENSE_URL=$(LICENSE_URL)" \
-D "DESCRIPTION1=$(DESCRIPTION1)" \
-D "LICENSE=$(LICENSE)" \
-D "LICENSE_URL=$(LICENSE_URL)" \
-D "DESCRIPTION1=$(DESCRIPTION1)" \
TF_CPPFLAGS += -Wunused-macros
TF_CPPFLAGS += -DCOPYRIGHT_YEAR='"$(COPYRIGHT_YEAR)"'
TF_CPPFLAGS += -Wunused-macros
TF_CPPFLAGS += -DCOPYRIGHT_YEAR='"$(COPYRIGHT_YEAR)"'
+TF_CPPFLAGS += -DPACKAGE='"$(PACKAGE)"'
TF_CPPFLAGS += -DAUTHOR='"$(AUTHOR)"'
TF_CPPFLAGS += -DAUTHOR='"$(AUTHOR)"'
+TF_CPPFLAGS += -DEMAIL='"$(EMAIL)"'
+TF_CPPFLAGS += -DPACKAGE_HOMEPAGE='"$(PACKAGE_HOMEPAGE)"'
+TF_CPPFLAGS += -DCLONE_URL='"$(CLONE_URL)"'
+TF_CPPFLAGS += -DGITWEB_URL='"$(GITWEB_URL)"'
+TF_CPPFLAGS += -DHOME_URL='"$(HOME_URL)"'
+TF_CPPFLAGS += -DGET_VERSION='$(PACKAGE)_version'
TF_CPPFLAGS += -DLOGLEVELS='$(LOGLEVELS)'
TF_CPPFLAGS += -DBUILD_DATE='"$(build_date)"'
TF_CPPFLAGS += -DCC_VERSION='"$(cc_version)"'
TF_CPPFLAGS += -DLOGLEVELS='$(LOGLEVELS)'
TF_CPPFLAGS += -DBUILD_DATE='"$(build_date)"'
TF_CPPFLAGS += -DCC_VERSION='"$(cc_version)"'
$(INSTALL_DATA) tfortune.1 $(DESTDIR)$(mandir)
define README :=
$(INSTALL_DATA) tfortune.1 $(DESTDIR)$(mandir)
define README :=
-tfortune - fortune cookies with tags
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$(DESCRIPTION1)
$(DESCRIPTION2)
$(DESCRIPTION1)
$(DESCRIPTION2)
+| web page: $(PACKAGE_HOMEPAGE)
| git clone URL: $(CLONE_URL)
| git clone URL: $(CLONE_URL)
-| web page: $(PACKAGE_URL)
-| email: $(AUTHOR) <$(PACKAGE_BUGREPORT)>
+| gitweb: $(GITWEB_URL)
+| author's home page: $(HOME_URL)
+| Send feedback to: $(AUTHOR) <$(EMAIL)>
Documentation
~~~~~~~~~~~~~
Documentation
~~~~~~~~~~~~~
bindir := @bindir@
datarootdir := @datarootdir@
bindir := @bindir@
datarootdir := @datarootdir@
-PACKAGE_TARNAME := @PACKAGE_TARNAME@
-PACKAGE_VERSION := @PACKAGE_VERSION@
-PACKAGE_BUGREPORT := @PACKAGE_BUGREPORT@
-PACKAGE_URL := @PACKAGE_URL@
-
FLEX := @FLEX@
BISON := @BISON@
M4 := @M4@
FLEX := @FLEX@
BISON := @BISON@
M4 := @M4@
# SPDX-License-Identifier: GPL-3.0-only
AC_PREREQ([2.61])
# SPDX-License-Identifier: GPL-3.0-only
AC_PREREQ([2.61])
-AC_INIT([tfortune], [m4_esyscmd_s(./version-gen.sh)],
- [maan@tuebingen.mpg.de], [], [http://people.tuebingen.mpg.de/maan/tfortune/])
+# only for configure -h, see Makefile
+AC_INIT([software], [packages])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([config.mak])
AC_USE_SYSTEM_EXTENSIONS
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([config.mak])
AC_USE_SYSTEM_EXTENSIONS
<li>
gitweb: <a href="GITWEB_URL()">GITWEB_URL()</a>
</li>
<li>
gitweb: <a href="GITWEB_URL()">GITWEB_URL()</a>
</li>
- <li>
- Email: AUTHOR() <<a
- href="mailto:PACKAGE_BUGREPORT()">PACKAGE_BUGREPORT()</a>>
- </li>
+ <li> The author's <a href="HOME_URL()">home page</a> </li>
+ <li> Send feedback to <a href="mailto:EMAIL()">AUTHOR()</a> </li>
}
EXPORT_CMD_HANDLER(help);
}
EXPORT_CMD_HANDLER(help);
+const char *GET_VERSION(void);
static void handle_help_and_version(void)
{
int i;
static void handle_help_and_version(void)
{
int i;
const struct lls_command *cmd;
if (OPT_GIVEN(TFORTUNE, VERSION)) {
const struct lls_command *cmd;
if (OPT_GIVEN(TFORTUNE, VERSION)) {
"Copyright (C) " COPYRIGHT_YEAR " " AUTHOR ".\n"
"Copyright (C) " COPYRIGHT_YEAR " " AUTHOR ".\n"
- "License " LICENSE ": <" LICENSE_URL ">.\n"
+ "License: " LICENSE ": <" LICENSE_URL ">.\n"
"This is free software: you are free to change and redistribute it.\n"
"There is NO WARRANTY, to the extent permitted by law.\n"
"This is free software: you are free to change and redistribute it.\n"
"There is NO WARRANTY, to the extent permitted by law.\n"
- "Report bugs to " AUTHOR " <" PACKAGE_BUGREPORT ">.\n"
+ "\n"
+ "Web page: " PACKAGE_HOMEPAGE "\n"
+ "Clone URL: " CLONE_URL "\n"
+ "Gitweb: " GITWEB_URL "\n"
+ "Author's Home Page: " HOME_URL "\n"
+ "Send feedback to: " AUTHOR " <" EMAIL ">\n"
[suite tfortune]
caption = Subcommands
[supercommand tfortune]
[suite tfortune]
caption = Subcommands
[supercommand tfortune]
- purpose = fortune cookies with tags
[description]
DESCRIPTION1()
[description]
DESCRIPTION1()
This is free software: you are free to change and redistribute it.
.br
There is NO WARRANTY, to the extent permitted by law.
This is free software: you are free to change and redistribute it.
.br
There is NO WARRANTY, to the extent permitted by law.
+ .P
+ Web page:
+ .UR PACKAGE_HOMEPAGE()
+ .UE
+ .br
+ Git clone URL:
+ .UR CLONE_URL()
+ .UE
+ .br
+ Gitweb:
+ .UR GITWEB_URL()
+ .UE
+ .br
+ Author's home page:
+ .UR HOME_URL()
+ .UE
- .MT <PACKAGE_BUGREPORT()>
- .br
- Homepage:
- .UR PACKAGE_URL()
- .UE
[/section]
[section see also]
.BR fortune (6)
[/section]
[section see also]
.BR fortune (6)
# SPDX-License-Identifier: GPL-3.0-only
# SPDX-License-Identifier: GPL-3.0-only
-version_file='version.c'
+package="$1"
+version_file="$2"
+
ver='unnamed_version'
# First try git, then gitweb, then default.
if [ -e '.git' -o -e '../.git' ]; then
ver='unnamed_version'
# First try git, then gitweb, then default.
if [ -e '.git' -o -e '../.git' ]; then
# if there are differences (exit code 1), the working tree is dirty
git diff-index --quiet HEAD || git_ver=$git_ver-dirty
ver=$git_ver
# if there are differences (exit code 1), the working tree is dirty
git diff-index --quiet HEAD || git_ver=$git_ver-dirty
ver=$git_ver
-elif [ "${PWD%%-*}" = 'tfortune-' ]; then
- ver=${PWD##*/tfortune-}
+elif [ "${PWD%%-*}" = $package- ]; then
+ ver=${PWD##*/$package-}
fi
ver=${ver#v}
echo "$ver"
fi
ver=${ver#v}
echo "$ver"
+[ -z "${version_file}" ] && exit 0
# update version file if necessary
# update version file if necessary
-content="const char *tf_version(void) {return \"$ver\";};"
+content="const char *${package}_version(void) {return \"$ver\";};"
[ -r "$version_file" ] && echo "$content" | cmp -s - $version_file && exit 0
[ -r "$version_file" ] && echo "$content" | cmp -s - $version_file && exit 0
-echo >&2 "new git version: $ver"
echo "$content" > $version_file
echo "$content" > $version_file