From 1d03eedeebc2c2faa0b24baa79dde66cd80ec81a Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Thu, 25 Oct 2012 11:52:51 -0700 Subject: [PATCH] script for updating version numbers. Signed-off-by: Leonardo de Moura --- scripts/mk_make.py | 2 ++ scripts/mk_util.py | 38 ++++++++++++++++++++++++++++++++------ src/util/version.h | 12 ------------ 3 files changed, 34 insertions(+), 18 deletions(-) delete mode 100644 src/util/version.h diff --git a/scripts/mk_make.py b/scripts/mk_make.py index 419ffe221..6114fc79b 100644 --- a/scripts/mk_make.py +++ b/scripts/mk_make.py @@ -65,4 +65,6 @@ add_exe('test', ['api', 'fuzzing'], exe_name='test-z3') add_dll('api_dll', ['api', 'sat', 'extra_cmds'], 'api/dll', dll_name='z3') mk_auto_src() +update_version(4, 2, 0, 0) + mk_makefile() diff --git a/scripts/mk_util.py b/scripts/mk_util.py index a3cc84832..e3e51982b 100644 --- a/scripts/mk_util.py +++ b/scripts/mk_util.py @@ -22,6 +22,7 @@ VERBOSE=False DEBUG_MODE=False SHOW_CPPS = True VS_X64 = False +ONLY_MAKEFILES = False if os.name == 'nt': IS_WINDOW=True @@ -33,22 +34,24 @@ def display_help(): print "This script generates the Makefile for the Z3 theorem prover." print "It must be executed from the Z3 root directory." print "\nOptions:" - print " -h, --help display this message" - print " -v, --verbose be verbose" + print " -h, --help display this message." + print " -v, --verbose be verbose." print " -b , --build= subdirectory where Z3 will be built (default: build)." print " -d, --debug compile Z3 in debug mode." print " -x, --x64 create 64 binary when using Visual Studio." + print " -m, --makefiles generate only makefiles." exit(0) # Parse configuration option for mk_make script def parse_options(): - global VERBOSE, DEBUG_MODE, IS_WINDOW, VS_X64 - options, remainder = getopt.gnu_getopt(sys.argv[1:], 'b:dvxh', ['build=', + global VERBOSE, DEBUG_MODE, IS_WINDOW, VS_X64, ONLY_MAKEFILES + options, remainder = getopt.gnu_getopt(sys.argv[1:], 'b:dvxhm', ['build=', 'debug', 'verbose', 'x64', 'help' - ]) + 'makefiles' + ]) for opt, arg in options: if opt in ('-b', '--build'): if arg == 'src': @@ -64,6 +67,8 @@ def parse_options(): VS_X64 = True elif opt in ('-h', '--help'): display_help() + elif opt in ('-m', '--onlymakefiles'): + ONLY_MAKEFILES = True else: raise MKException("Invalid command line option '%s'" % opt) @@ -416,7 +421,8 @@ def mk_makefile(): # Generate automatically generated source code def mk_auto_src(): - mk_pat_db() + if not ONLY_MAKEFILES: + mk_pat_db() # TODO: delete after src/ast/pattern/expr_pattern_match # database.smt ==> database.h @@ -428,3 +434,23 @@ def mk_pat_db(): for line in fin: fout.write('"%s\\n"\n' % line.strip('\n')) fout.write(';\n') + if VERBOSE: + print "Generated '%s/database.h'" % c.src_dir + +# Update version numbers +def update_version(major, minor, build, revision): + if not ONLY_MAKEFILES: + mk_version_dot_h(major, minor, build, revision) + +# Update files with the version number +def mk_version_dot_h(major, minor, build, revision): + c = _Name2Component['util'] + fout = open('%s/version.h' % c.src_dir, 'w') + fout.write('// automatically generated file.\n') + fout.write('#define Z3_MAJOR_VERSION %s\n' % major) + fout.write('#define Z3_MINOR_VERSION %s\n' % minor) + fout.write('#define Z3_BUILD_NUMBER %s\n' % build) + fout.write('#define Z3_REVISION_NUMBER %s\n' % revision) + if VERBOSE: + print "Generated '%s/version.h'" % c.src_dir + diff --git a/src/util/version.h b/src/util/version.h deleted file mode 100644 index 3618df878..000000000 --- a/src/util/version.h +++ /dev/null @@ -1,12 +0,0 @@ -// -// DO NOT EDIT DO NOT EDIT -// -// This file is overriden by the build automation on the build machine with -// a new 'current' build number. -// -// DO NOT EDIT DO NOT EDIT -// -#define Z3_MAJOR_VERSION 4 -#define Z3_MINOR_VERSION 2 -#define Z3_BUILD_NUMBER 0 -#define Z3_REVISION_NUMBER 0