# Makefile for top level of mmh distribution
#
-# mmh version
-VERSION = @VERSION@
-
SHELL = /bin/sh
@SET_MAKE@
srcdir = @srcdir@
VPATH = @srcdir@
+# mmh version
+VERSION = `sed q $(srcdir)/VERSION`
+
# ========== USER CONFIGURATION SECTION ==========
#
# If `make' is executed in the directory containing this Makefile,
# Makefile for config subdirectory
#
-# nmh version
-VERSION = @VERSION@
-
SHELL = /bin/sh
top_srcdir = @top_srcdir@
SRCS = config.c
# object files
-OBJS = config.o version.o
+OBJS = config.o
# ========= DEPENDENCIES FOR BUILDING ==========
all: $(OBJS)
-version.c:
- ${srcdir}/version.sh $(VERSION) > version.c
-
config.o: config.c
$(COMPILE2) $(srcdir)/config.c
rm -f *.o *~
clean: mostlyclean
- rm -f version.c
distclean: clean
rm -f Makefile
+++ /dev/null
-#!/bin/sh
-#
-# version.sh -- script to create version string(s) for mmh.
-#
-# You need to pass the script the version number to use.
-#
-
-if [ -z "$1" ]; then
- echo "usage: version.sh VERSION" 1>&2
- exit 1
-fi
-
-VERSION=$1
-
-git_info="$(git show --pretty'=format: [%h -- %cD]' HEAD | head -n1)"
-
-echo "char *version_str = \"mmh-${VERSION}${git_info}\";"
-echo "char *version_num = \"mmh-$VERSION\";"
extern char *seq_neg;
extern char *trashfolder;
extern char *usequence;
-extern char *version_num;
-extern char *version_str;
+extern char *version;
+extern char *lib_version;
extern char *whatnowproc;
#include <h/prototypes.h>
# Makefile for man subdirectory
#
-VERSION = @VERSION@
DATE = @DATE@
SHELL = /bin/sh
srcdir = @srcdir@
VPATH = @srcdir@
+VERSION = `$(top_srcdir)/version.sh $(top_srcdir)`
+
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
# create the sed file for building man pages
man.sed: Makefile titles
@echo 's,%nmhwarning%,THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT.,g' > $@
- @echo 's,%nmhversion%,mmh-$(VERSION),g' >> $@
+ @echo 's,%nmhversion%,'$(VERSION)',g' >> $@
@echo 's,%nmhdate%,$(DATE),g' >> $@
@echo 's,%bindir%,$(bindir),g' >> $@
@echo 's,%etcdir%,$(etcdir),g' >> $@
srcdir = @srcdir@
VPATH = @srcdir@
+VERSION = `$(top_srcdir)/version.sh $(top_srcdir)`
+
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CFLAGS)
-LOCALLIBS = ../config/version.o ../config/config.o
+LOCALLIBS = ../config/config.o
.SUFFIXES:
.SUFFIXES: .c .o
pidstatus.o: sigmsg.h
-libmh.a: $(OBJS) $(LOCALLIBS)
+libmh.a: $(OBJS) $(LOCALLIBS) version.c
rm -f $@
+ $(COMPILE) -DVERSION="\"$(VERSION)\"" -o version.o $(srcdir)/version.c
if test x$(LIBTOOL) != x -a x$(GNU_LIBTOOL) = x ; then \
- $(LIBTOOL) -static -c -o libmh.a $(OBJS) $(LOCALLIBS) ; \
+ $(LIBTOOL) -static -c -o libmh.a $(OBJS) $(LOCALLIBS) version.o; \
else \
- ar cr libmh.a `$(LORDER) $(OBJS) $(LOCALLIBS) | $(TSORT) 2>/dev/null` ; \
+ ar cr libmh.a `$(LORDER) $(OBJS) $(LOCALLIBS) version.o | $(TSORT) 2>/dev/null` ; \
$(RANLIB) libmh.a ; \
fi
+ rm -f version.o
install:
void
print_version(char *invo_name)
{
- printf("%s -- %s\n", invo_name, version_str);
+ printf("%s -- %s\n", invo_name, version);
+ if (strcmp(version, lib_version)!=0) {
+ printf("libversion: %s\n", lib_version);
+ }
}
--- /dev/null
+#include <h/mh.h>
+
+char *lib_version = VERSION;
srcdir = @srcdir@
VPATH = @srcdir@
+VERSION = `$(top_srcdir)/version.sh $(top_srcdir)`
+
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
TERMLIB = @TERMLIB@
LEXLIB = @LEXLIB@
-COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CFLAGS)
+COMPILE = $(CC) -c $(DEFS) -DVERSION="\"$(VERSION)\"" $(INCLUDES) $(CFLAGS)
LINK = $(CC) $(LDFLAGS) -o $@
LN = ln
{ NULL, 0 }
};
+char *version=VERSION;
+
static int pos = 1;
extern struct aka *akahead;
{ NULL, 0 }
};
+char *version=VERSION;
+
/*
** static prototypes
*/
{ NULL, 0 }
};
+char *version=VERSION;
+
static struct format *fmt;
static int dat[5];
{ NULL, 0 }
};
+char *version=VERSION;
+
static char delim3[] = "-------";
struct smsg {
{ NULL, 0 }
};
+char *version=VERSION;
int
main(int argc, char **argv)
{ NULL, 0 }
};
+char *version=VERSION;
int
main(int argc, char **argv)
{ NULL, 0 }
};
+char *version=VERSION;
+
static struct format *fmt;
static int dat[5];
{ NULL, 0 }
};
+char *version=VERSION;
+
struct Folder {
char *name; /* name of folder */
int priority;
{ NULL, 0 }
};
+char *version=VERSION;
+
/* for assignlabel */
static struct format *lvec[128];
static int lused = 0;
{ NULL, 0 }
};
+char *version=VERSION;
+
static int fshort = 0; /* output only folder names */
static int fcreat = 0; /* should we ask to create new folders? */
static int fpack = 0; /* are we packing the folder? */
{ NULL, 0 }
};
+char *version=VERSION;
+
static char drft[BUFSIZ];
static struct msgs *mp = NULL;
{ NULL, 0 },
};
+char *version=VERSION;
+
/*
** This is an attempt to simplify things by putting all the
** privilege ops into macros.
{ NULL, 0 }
};
+char *version=VERSION;
+
/*
** static prototypes
*/
{ NULL, 0 }
};
+char *version=VERSION;
/*
** Directory to place tmp files. This must
{ NULL, 0 }
};
+char *version=VERSION;
+
#define NOCOMPONENT 0x000001 /* don't show component name */
#define UPPERCASE 0x000002 /* display in all upper case */
#define CENTER 0x000004 /* center line */
{ NULL, 0 }
};
+char *version=VERSION;
/* mhparse.c */
extern char *tmp; /* directory to place temp files */
{ NULL, 0 }
};
+char *version=VERSION;
+
static char tmpfil[BUFSIZ];
/*
{ NULL, 0 }
};
+char *version=VERSION;
+
struct proc {
char *p_name;
char **p_field;
*/
static struct proc procs [] = {
{ "#--Version--", &empty },
- { "version", &version_num },
- { "version-str", &version_str },
+ { "version", &version },
+ { "lib-version", &lib_version },
{ "#--Path-and-File-Names--", &empty },
{ "mypath", &mypath },
{ NULL, 0 }
};
+char *version=VERSION;
+
int
main(int argc, char **argv)
{
{ NULL, 0 }
};
+char *version=VERSION;
/* mhparse.c */
extern char *tmp; /* directory to place temp files */
{ NULL, 0 }
};
+char *version=VERSION;
/* mhparse.c */
extern char *tmp; /* directory to place temp files */
{ NULL, 0 }
};
+char *version=VERSION;
/* mhparse.c */
extern char *tmp; /* directory to place temp files */
{ NULL, 0 }
};
+char *version=VERSION;
+
static enum { NEW, FNEXT, FPREV, UNSEEN } run_mode = NEW;
/*
{ NULL, 0 }
};
+char *version=VERSION;
int
main(int argc, char **argv)
{ NULL, 0 }
};
+char *version=VERSION;
+
/*
** static prototypes
*/
{ NULL, 0 }
};
+char *version=VERSION;
volatile sig_atomic_t wtuser = 0;
volatile sig_atomic_t sigint = 0;
{ NULL, 0 }
};
+char *version=VERSION;
+
static char backup[BUFSIZ] = "";
static char drft[BUFSIZ] = "";
static char tmpfil[BUFSIZ] = "";
{ NULL, 0 }
};
+char *version=VERSION;
int
main(int argc, char **argv)
{ NULL, 0 }
};
+char *version=VERSION;
/*
** name of temporary file to store incoming message
{ NULL, 0 }
};
+char *version=VERSION;
+
static char maildir[BUFSIZ];
struct st_fold {
{ NULL, 0 }
};
+char *version=VERSION;
+
static struct swit ccswitches[] = {
#define CTOSW 0
{ "to", 0 },
{ NULL, 0 }
};
+char *version=VERSION;
+
/*
** static prototypes
*/
{ NULL, 0 }
};
+char *version=VERSION;
int
main(int argc, char **argv)
{ NULL, 0 }
};
+char *version=VERSION;
int
main(int argc, char **argv)
{ NULL, 0 }
};
+char *version=VERSION;
int
main(int argc, char **argv)
{ NULL, 0 }
};
+char *version=VERSION;
static int globbed = 0; /* have we built "vars" table yet? */
static int parsed = 0; /* have we built header field table yet */
{ NULL, 0 }
};
+char *version=VERSION;
+
struct smsg {
int s_msg;
time_t s_clock;
{ NULL, 0 }
};
+char *version=VERSION;
/* flags for headers->flags */
#define HNOP 0x0000 /* just used to keep .set around */
{ NULL, 0 }
};
+char *version=VERSION;
+
/*
** Options at the "whatnow" prompt
*/
{ NULL, 0 }
};
+char *version=VERSION;
#define NFILES 32
--- /dev/null
+#!/bin/sh
+#
+# version.sh -- script to create version string(s) for mmh.
+#
+# You can pass the top soucre directory to the script.
+#
+
+if [ -d "$1" ]
+then
+ cd "$1"
+fi
+
+if [ ! -f VERSION ]
+then
+ echo "No version file found" 1>&2
+ echo "usage: $0 [mmh-sourcedir]" 1>&2
+ exit 1
+fi
+
+version="`sed q VERSION`"
+
+git_info=""
+
+if [ -d ".git" ]; then
+ current=`git log -n 1 --pretty=format:+%h HEAD`
+ release=`git log -n 1 --pretty=format:+%h "mmh-$version"`
+ if [ "$current" != "$release" ]
+ then
+ git_info="$current"
+ fi
+fi
+
+echo mmh-"$version""$git_info"