mirror of https://gerrit.osmocom.org/osmo-dev
gen_makefile: allow combining several .opts files
This commit is contained in:
parent
20e169f4b5
commit
450dac79c3
4
README
4
README
|
@ -8,13 +8,13 @@ more separate build trees in ./make-*.
|
||||||
Run ./gen_makefile.py with a choice of projects (2G only or also 3G?)
|
Run ./gen_makefile.py with a choice of projects (2G only or also 3G?)
|
||||||
and a choice of configure options, for example:
|
and a choice of configure options, for example:
|
||||||
|
|
||||||
./gen_makefile.py 3G+2G.deps all_enabled.opts
|
./gen_makefile.py 3G+2G.deps default.opts iu.opts
|
||||||
|
|
||||||
This generates a new dir containing a Makefile. When you run make in it, this
|
This generates a new dir containing a Makefile. When you run make in it, this
|
||||||
will clone the source trees (if not present yet) and build all of them in the
|
will clone the source trees (if not present yet) and build all of them in the
|
||||||
right order:
|
right order:
|
||||||
|
|
||||||
cd make-3G+2G.deps-all_enabled.opts/
|
cd make-3G+2G-default+iu
|
||||||
make
|
make
|
||||||
|
|
||||||
If you make modifications in one of the source trees, this Makefile will pick
|
If you make modifications in one of the source trees, this Makefile will pick
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
osmo-mgw --enable-mgcp-transcoding
|
|
||||||
osmo-msc --enable-smpp --enable-iu --enable-mgcp-transcoding --enable-external-tests
|
|
||||||
osmo-bsc --enable-osmo-bsc --enable-nat --enable-mgcp-transcoding --enable-external-tests
|
|
||||||
osmo-sgsn --enable-iu --enable-external-tests
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
osmo-msc --enable-smpp
|
||||||
|
osmo-bsc --enable-osmo-bsc --enable-nat
|
|
@ -0,0 +1,3 @@
|
||||||
|
osmo-msc --enable-external-tests
|
||||||
|
osmo-bsc --enable-external-tests
|
||||||
|
osmo-sgsn --enable-external-tests
|
|
@ -2,7 +2,7 @@
|
||||||
'''
|
'''
|
||||||
Generate a top-level makefile that builds the Osmocom 2G + 3G network components.
|
Generate a top-level makefile that builds the Osmocom 2G + 3G network components.
|
||||||
|
|
||||||
./gen_makefile.py projects.deps [configuration.opts] [-o Makefile.output]
|
./gen_makefile.py projects.deps [configure.opts [more.opts]] [-o Makefile.output]
|
||||||
|
|
||||||
Configured by text files:
|
Configured by text files:
|
||||||
|
|
||||||
|
@ -37,10 +37,10 @@ parser.add_argument('projects_and_deps_file',
|
||||||
help='''Config file containing projects to build and
|
help='''Config file containing projects to build and
|
||||||
dependencies between those''')
|
dependencies between those''')
|
||||||
|
|
||||||
parser.add_argument('configure_opts_file',
|
parser.add_argument('configure_opts_files',
|
||||||
help='''Config file containing project name and
|
help='''Config file containing project name and
|
||||||
./configure options''',
|
./configure options''',
|
||||||
default=None, nargs='?')
|
nargs='*')
|
||||||
|
|
||||||
parser.add_argument('-m', '--make-dir', dest='make_dir',
|
parser.add_argument('-m', '--make-dir', dest='make_dir',
|
||||||
help='''Place Makefile in this dir (default: create
|
help='''Place Makefile in this dir (default: create
|
||||||
|
@ -69,6 +69,27 @@ parser.add_argument('-j', '--jobs', dest='jobs', default='9',
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
class listdict(dict):
|
||||||
|
'a dict of lists { "a": [1, 2, 3], "b": [1, 2] }'
|
||||||
|
|
||||||
|
def add(self, name, item):
|
||||||
|
l = self.get(name)
|
||||||
|
if not l:
|
||||||
|
l = []
|
||||||
|
self[name] = l
|
||||||
|
l.append(item)
|
||||||
|
|
||||||
|
def extend(self, name, l):
|
||||||
|
for v in l:
|
||||||
|
self.add(name, v)
|
||||||
|
|
||||||
|
def add_dict(self, d):
|
||||||
|
for k,v in d.items():
|
||||||
|
self.add(k, v)
|
||||||
|
|
||||||
|
def extend_dict(self, d):
|
||||||
|
for k,v in d.items():
|
||||||
|
l = self.extend(k, v)
|
||||||
|
|
||||||
def read_projects_deps(path):
|
def read_projects_deps(path):
|
||||||
'Read deps config and return tuples of (project_name, which-other-to-build-first).'
|
'Read deps config and return tuples of (project_name, which-other-to-build-first).'
|
||||||
|
@ -156,11 +177,17 @@ def gen_make(proj, deps, configure_opts, jobs, make_dir, src_dir, build_dir, url
|
||||||
|
|
||||||
|
|
||||||
projects_deps = read_projects_deps(args.projects_and_deps_file)
|
projects_deps = read_projects_deps(args.projects_and_deps_file)
|
||||||
configure_opts = read_configure_opts(args.configure_opts_file)
|
configure_opts = listdict()
|
||||||
|
configure_opts_files = sorted(args.configure_opts_files or [])
|
||||||
|
for configure_opts_file in configure_opts_files:
|
||||||
|
r = read_configure_opts(configure_opts_file)
|
||||||
|
configure_opts.extend_dict(read_configure_opts(configure_opts_file))
|
||||||
|
|
||||||
make_dir = args.make_dir
|
make_dir = args.make_dir
|
||||||
if not make_dir:
|
if not make_dir:
|
||||||
make_dir = 'make-%s-%s' % (args.projects_and_deps_file, args.configure_opts_file)
|
deps_name = args.projects_and_deps_file.replace('.deps', '')
|
||||||
|
opts_names = '+'.join([f.replace('.opts', '') for f in configure_opts_files])
|
||||||
|
make_dir = 'make-%s-%s' % (deps_name, opts_names)
|
||||||
|
|
||||||
if not os.path.isdir(make_dir):
|
if not os.path.isdir(make_dir):
|
||||||
os.makedirs(make_dir)
|
os.makedirs(make_dir)
|
||||||
|
@ -187,7 +214,7 @@ regen:
|
||||||
'''.format(
|
'''.format(
|
||||||
script=os.path.relpath(sys.argv[0], make_dir),
|
script=os.path.relpath(sys.argv[0], make_dir),
|
||||||
projects_and_deps=os.path.relpath(args.projects_and_deps_file, make_dir),
|
projects_and_deps=os.path.relpath(args.projects_and_deps_file, make_dir),
|
||||||
configure_opts=os.path.relpath(args.configure_opts_file, make_dir),
|
configure_opts=' '.join([os.path.relpath(f, make_dir) for f in configure_opts_files]),
|
||||||
make_dir='.',
|
make_dir='.',
|
||||||
makefile=args.output,
|
makefile=args.output,
|
||||||
src_dir=os.path.relpath(args.src_dir, make_dir),
|
src_dir=os.path.relpath(args.src_dir, make_dir),
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
osmo-mgw --enable-mgcp-transcoding
|
||||||
|
osmo-msc --enable-mgcp-transcoding
|
Loading…
Reference in New Issue