Change in osmo-dev[master]: gen_makefile.py: add make rules for all projects

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

osmith gerrit-no-reply at lists.osmocom.org
Thu Jul 29 13:07:23 UTC 2021


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-dev/+/25098 )


Change subject: gen_makefile.py: add make rules for all projects
......................................................................

gen_makefile.py: add make rules for all projects

Allow to easily build any Osmocom project in a build directory generated
by osmo-dev, even if it is not listed in the specified .deps file. This
avoids the need to set up a new build directory and build common
dependencies (e.g. libosmocore) again.

All rules that act on multiple projects (default make target "all",
"clone", "clean" "all-install") will still only take the selected
projects into account.

The idea is to extend deps.all on demand. Currently it contains
everything from 3G+2G.deps plus:
- osmo-bts
- osmo-gbproxy
- osmo-pcap
- osmo-pcu

Change-Id: Ibb932f36a9f97d6e9f3d69f4ce63b738fbb640fe
---
M 2G.deps
M 3G+2G.deps
A all.deps
M gen_makefile.py
4 files changed, 59 insertions(+), 10 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-dev refs/changes/98/25098/1

diff --git a/2G.deps b/2G.deps
index c090b6e..2d0745b 100644
--- a/2G.deps
+++ b/2G.deps
@@ -1,3 +1,4 @@
+# Note: Add new projects to all.deps too
 # project	build these first
 libosmocore
 libosmo-abis	libosmocore
diff --git a/3G+2G.deps b/3G+2G.deps
index b4372fd..7f9009e 100644
--- a/3G+2G.deps
+++ b/3G+2G.deps
@@ -1,3 +1,4 @@
+# Note: Add new projects to all.deps too
 # project	build these first
 libosmocore
 libosmo-abis	libosmocore
diff --git a/all.deps b/all.deps
new file mode 100644
index 0000000..7685ed5
--- /dev/null
+++ b/all.deps
@@ -0,0 +1,26 @@
+# List of *all* Osmocom projects that one might want to build with osmo-dev.
+# Make targets get created for these projects, even if they are not in the
+# .deps file passed to gen_makefile.py, so they can be conveniently built from
+# any build dir generated by osmo-dev.
+
+# project	build these first
+libasn1c
+libosmo-abis	libosmocore
+libosmo-netif	libosmo-abis
+libosmo-sccp	libosmo-netif
+libosmocore
+libsmpp34
+osmo-bsc	libosmo-sccp osmo-mgw
+osmo-bts	libosmocore, libosmo-abis
+osmo-gbproxy	libosmocore
+osmo-ggsn	libosmocore
+osmo-hlr	libosmo-abis
+osmo-iuh	libosmo-sccp libasn1c
+osmo-mgw	libosmo-netif
+osmo-msc	osmo-iuh osmo-mgw libsmpp34 osmo-hlr
+osmo-pcap	libosmocore
+osmo-pcu	libosmocore
+osmo-sgsn	osmo-iuh osmo-ggsn osmo-hlr
+osmo-sip-connector	libosmocore
+osmo-smlc	libosmo-sccp
+osmo-trx	libosmocore
diff --git a/gen_makefile.py b/gen_makefile.py
index ad42978..fb81aac 100755
--- a/gen_makefile.py
+++ b/gen_makefile.py
@@ -148,7 +148,9 @@
     return {}
   return dict(read_projects_deps(path))
 
-def gen_make(proj, deps, configure_opts, jobs, make_dir, src_dir, build_dir, url, push_url, sudo_make_install, no_ldconfig, ldconfig_without_sudo, make_check):
+def gen_make(proj, deps, configure_opts, jobs, make_dir, src_dir, build_dir,
+             url, push_url, sudo_make_install, no_ldconfig,
+             ldconfig_without_sudo, make_check, deps_file):
   src_proj = os.path.join(src_dir, proj)
   if proj == 'openbsc':
     src_proj = os.path.join(src_proj, 'openbsc')
@@ -165,7 +167,7 @@
     configure_opts_str = ''
 
   return r'''
-### {proj} ###
+### {proj} ({deps_file}) ###
 
 {proj}_configure_files := $(shell find {src_proj} -name "Makefile.am" -or -name "*.in" -and -not -name "Makefile.in" -and -not -name "config.h.in" )
 {proj}_files := $(shell find {src_proj} -name "*.[hc]" -or -name "*.py" -or -name "*.cpp" -or -name "*.tpl" -or -name "*.map")
@@ -228,6 +230,7 @@
     src_proj=make_to_src_proj,
     build_proj=make_to_build_proj,
     build_to_src=build_to_src,
+    deps_file=deps_file,
     deps_installed=' '.join(['.make.%s.install' % d for d in deps]),
     deps_reinstall=' '.join(['%s-reinstall' %d for d in deps]),
     configure_opts=configure_opts_str,
@@ -312,13 +315,31 @@
 
   out.write('all-install: \\\n\t' + ' \\\n\t'.join([ '.make.%s.install' % p for p, d in projects_deps ]) + '\n\n')
 
-  for proj, deps in projects_deps:
-    all_config_opts = []
-    all_config_opts.extend(configure_opts.get('ALL') or [])
-    all_config_opts.extend(configure_opts.get(proj) or [])
-    out.write(gen_make(proj, deps, all_config_opts, args.jobs,
-                       make_dir, args.src_dir, build_dir, args.url, args.push_url,
-                       args.sudo_make_install, args.no_ldconfig,
-                       args.ldconfig_without_sudo, args.make_check))
+  # iterate over projects in the selected projects_deps file (e.g. 2G.deps)
+  # first, then iterate over all projects (all.deps) and add missing ones. this
+  # allows overriding projects and dependencies in the selected file, but also
+  # having make rules for all projects available to quickly build them without
+  # setting up a new build directory first.
+  projects = [x[0] for x in projects_deps]
+  for is_all in [False, True]:
+    deps_file = args.projects_and_deps_file
+    proj_deps = projects_deps
+
+    if is_all:
+      deps_file = "all.deps"
+      deps_file_path = os.path.join(os.path.dirname(__file__), deps_file)
+      proj_deps = read_projects_deps(deps_file_path)
+
+    for proj, deps in proj_deps:
+      if is_all and proj in projects:
+        continue
+      all_config_opts = []
+      all_config_opts.extend(configure_opts.get('ALL') or [])
+      all_config_opts.extend(configure_opts.get(proj) or [])
+      out.write(gen_make(proj, deps, all_config_opts, args.jobs,
+                         make_dir, args.src_dir, build_dir, args.url, args.push_url,
+                         args.sudo_make_install, args.no_ldconfig,
+                         args.ldconfig_without_sudo, args.make_check,
+                         deps_file))
 
 # vim: expandtab tabstop=2 shiftwidth=2

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-dev/+/25098
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-Change-Id: Ibb932f36a9f97d6e9f3d69f4ce63b738fbb640fe
Gerrit-Change-Number: 25098
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210729/82e50f5a/attachment.htm>


More information about the gerrit-log mailing list