[BUILD] centralize version and date into one file for each
The version does not appear anymore in the Makefiles nor in the include files. It was a nightmare to maintain. Now there is a VERSION file which contains the major version, a VERDATE file which contains the date for this version and a SUBVERS file which may contain a sub-version. A "make version" target has been added to all makefiles to check the version. The GNU Makefile also has an update-version target to update those files. This should never be used. It is still possible to override those values by specifying them in the equivalent make variables. By default, the GNU makefile tries to detect a GIT repository and always uses the version and date from the current repository. This can be disabled by setting IGNOREGIT to a non-void value.
This commit is contained in:
parent
031a26b4a7
commit
ec69256382
35
Makefile
35
Makefile
@ -113,19 +113,24 @@ DEFINE = -DTPROXY
|
||||
# Now let's determine the version, sub-version and release date.
|
||||
# If we're in the GIT tree, we can use the last commit's version and date.
|
||||
ifeq ($(IGNOREGIT),)
|
||||
VERSION := $(shell [ -d .git/. ] && ref=`git-describe --tags 2>/dev/null` && ref=$${ref%-g*} && echo "$${ref\#v}" )
|
||||
endif
|
||||
|
||||
VERSION := $(shell [ -d .git/. ] && ref=`(git-describe --tags) 2>/dev/null` && ref=$${ref%-g*} && echo "$${ref\#v}")
|
||||
ifneq ($(VERSION),)
|
||||
# OK git is there and works.
|
||||
SUBVERS := $(shell comms=`git-log --no-merges v$(VERSION).. 2>/dev/null |grep -c ^commit `; [ $$comms -gt 0 ] && echo "-$$comms" )
|
||||
VERDATE := $(shell date +%Y/%m/%d -d "`git-log HEAD^.. 2>/dev/null | grep -m 1 ^Date: | cut -f2- -d: | cut -f1 -d+`" )
|
||||
else
|
||||
endif
|
||||
endif
|
||||
|
||||
# Otherwise, use the hard-coded version of last tag, number of changes
|
||||
# since last tag, and release date.
|
||||
VERSION := 1.3.12
|
||||
SUBVERS :=
|
||||
VERDATE := 2007/06/17
|
||||
ifeq ($(VERSION),)
|
||||
VERSION := $(shell cat VERSION 2>/dev/null || touch VERSION)
|
||||
endif
|
||||
ifeq ($(SUBVERS),)
|
||||
SUBVERS := $(shell cat SUBVERS 2>/dev/null || touch SUBVERS)
|
||||
endif
|
||||
ifeq ($(VERDATE),)
|
||||
VERDATE := $(shell cat VERDATE 2>/dev/null || touch VERDATE)
|
||||
endif
|
||||
|
||||
#### build options
|
||||
@ -256,3 +261,19 @@ tar: clean
|
||||
|
||||
git-tar: clean
|
||||
git-tar-tree HEAD haproxy-$(VERSION) | gzip -9 > haproxy-$(VERSION)$(SUBVERS).tar.gz
|
||||
|
||||
version:
|
||||
@echo "VERSION: $(VERSION)"
|
||||
@echo "SUBVERS: $(SUBVERS)"
|
||||
@echo "VERDATE: $(VERDATE)"
|
||||
|
||||
# never use this one if you don't know what it is used for.
|
||||
update-version:
|
||||
@echo "Ready to update the following versions :"
|
||||
@echo "VERSION: $(VERSION)"
|
||||
@echo "SUBVERS: $(SUBVERS)"
|
||||
@echo "VERDATE: $(VERDATE)"
|
||||
@echo "Press [ENTER] to continue or Ctrl-C to abort now.";read
|
||||
echo "$(VERSION)" > VERSION
|
||||
echo "$(SUBVERS)" > SUBVERS
|
||||
echo "$(VERDATE)" > VERDATE
|
||||
|
20
Makefile.bsd
20
Makefile.bsd
@ -7,8 +7,6 @@
|
||||
# make TARGET=freebsd CPU=i686 DLMALLOC_SRC=/usr/local/src/dlmalloc.c \
|
||||
# OPT_OBJS=src/dlmalloc.o
|
||||
|
||||
VERSION := 1.3.12
|
||||
|
||||
# Select target OS. TARGET must match a system for which COPTS and LIBS are
|
||||
# correctly defined below.
|
||||
TARGET = openbsd
|
||||
@ -87,10 +85,17 @@ TARGET_OPTS=$(COPTS.$(TARGET))
|
||||
REGEX_OPTS=$(COPTS.$(REGEX))
|
||||
CPU_OPTS=$(COPTS.$(CPU))
|
||||
|
||||
COPTS=-Iinclude $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) $(SMALL_OPTS) $(DEFINE)
|
||||
LIBS=$(LIBS.$(TARGET)) $(LIBS.$(REGEX)) $(ADDLIB)
|
||||
VERSION != cat VERSION 2>/dev/null || touch VERSION
|
||||
SUBVERS != cat SUBVERS 2>/dev/null || touch SUBVERS
|
||||
VERDATE != cat VERDATE 2>/dev/null || touch VERDATE
|
||||
|
||||
CFLAGS = -Wall $(COPTS) $(DEBUG)
|
||||
VER_OPTS := -DCONFIG_HAPROXY_VERSION=\"$(VERSION)$(SUBVERS)\" \
|
||||
-DCONFIG_HAPROXY_DATE=\"$(VERDATE)\"
|
||||
|
||||
COPTS = -Iinclude $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) \
|
||||
$(SMALL_OPTS) $(VER_OPTS) $(DEFINE)
|
||||
LIBS = $(LIBS.$(TARGET)) $(LIBS.$(REGEX)) $(ADDLIB)
|
||||
CFLAGS = -Wall $(COPTS) $(DEBUG)
|
||||
LDFLAGS = -g
|
||||
|
||||
OBJS = src/haproxy.o src/sessionhash.o src/base64.o \
|
||||
@ -118,3 +123,8 @@ clean:
|
||||
rm -f *.[oas] src/*.[oas] core haproxy test
|
||||
for dir in . src include/* doc; do rm -f $$dir/*~ $$dir/*.rej;done
|
||||
rm -f haproxy-$(VERSION).tar.gz haproxy-$(VERSION) nohup.out gmon.out
|
||||
|
||||
version:
|
||||
@echo "VERSION: $(VERSION)"
|
||||
@echo "SUBVERS: $(SUBVERS)"
|
||||
@echo "VERDATE: $(VERDATE)"
|
||||
|
20
Makefile.osx
20
Makefile.osx
@ -7,8 +7,6 @@
|
||||
# make DLMALLOC_SRC=/usr/local/src/dlmalloc.c \
|
||||
# OPT_OBJS=src/dlmalloc.o
|
||||
|
||||
VERSION := 1.3.12
|
||||
|
||||
# Select target OS. TARGET must match a system for which COPTS and LIBS are
|
||||
# correctly defined below.
|
||||
TARGET = generic
|
||||
@ -84,10 +82,17 @@ TARGET_OPTS=$(COPTS.$(TARGET))
|
||||
REGEX_OPTS=$(COPTS.$(REGEX))
|
||||
CPU_OPTS=$(COPTS.$(CPU))
|
||||
|
||||
COPTS=-Iinclude $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) $(SMALL_OPTS) $(DEFINE)
|
||||
LIBS=$(LIBS.$(TARGET)) $(LIBS.$(REGEX)) $(ADDLIB)
|
||||
VERSION != cat VERSION 2>/dev/null || touch VERSION
|
||||
SUBVERS != cat SUBVERS 2>/dev/null || touch SUBVERS
|
||||
VERDATE != cat VERDATE 2>/dev/null || touch VERDATE
|
||||
|
||||
CFLAGS = -Wall $(COPTS) $(DEBUG) -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386
|
||||
VER_OPTS := -DCONFIG_HAPROXY_VERSION=\"$(VERSION)$(SUBVERS)\" \
|
||||
-DCONFIG_HAPROXY_DATE=\"$(VERDATE)\"
|
||||
|
||||
COPTS = -Iinclude $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) \
|
||||
$(SMALL_OPTS) $(VER_OPTS) $(DEFINE)
|
||||
LIBS = $(LIBS.$(TARGET)) $(LIBS.$(REGEX)) $(ADDLIB)
|
||||
CFLAGS = -Wall $(COPTS) $(DEBUG) -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386
|
||||
LDFLAGS = -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386
|
||||
|
||||
OBJS = src/haproxy.o src/sessionhash.o src/base64.o \
|
||||
@ -115,3 +120,8 @@ clean:
|
||||
rm -f *.[oas] src/*.[oas] core haproxy test
|
||||
for dir in . src include/* doc; do rm -f $$dir/*~ $$dir/*.rej;done
|
||||
rm -f haproxy-$(VERSION).tar.gz haproxy-$(VERSION) nohup.out gmon.out
|
||||
|
||||
version:
|
||||
@echo "VERSION: $(VERSION)"
|
||||
@echo "SUBVERS: $(SUBVERS)"
|
||||
@echo "VERDATE: $(VERDATE)"
|
||||
|
@ -57,13 +57,13 @@
|
||||
#ifdef CONFIG_HAPROXY_VERSION
|
||||
#define HAPROXY_VERSION CONFIG_HAPROXY_VERSION
|
||||
#else
|
||||
#define HAPROXY_VERSION "1.3.12"
|
||||
#error "Must define CONFIG_HAPROXY_VERSION"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAPROXY_DATE
|
||||
#define HAPROXY_DATE CONFIG_HAPROXY_DATE
|
||||
#else
|
||||
#define HAPROXY_DATE "2007/06/17"
|
||||
#error "Must define CONFIG_HAPROXY_DATE"
|
||||
#endif
|
||||
|
||||
#endif /* _COMMON_VERSION_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user