osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-dev/+/40355?usp=email )
Change subject: gen_makefile: remove --auto-distclean parameter ...................................................................... gen_makefile: remove --auto-distclean parameter The purpose of this parameter was to run "make distclean" automatically if a source directory was already configured for an in-tree build. osmo-dev always does out-of-tree builds and so ./configure complains: configure: error: source directory already configured; run "make distclean" there first --auto-distclean worked most of the time, but not always. The --autoreconf-in-src-copy (-A) parameter makes this obsolete as it solves the same problem but with a better method. When -A is set, autoreconf and configure run in a copy of the source directory which avoids all conflicts with an in-tree build in the original source directory without the need to remove artifacts from the in-tree build. This has been in use by testenv in osmo-ttcn3-hacks for a while and is working reliably. Change-Id: I28378e6d2cafd209adcfae6b85a032d73ed14cce --- M gen_makefile.py 1 file changed, 3 insertions(+), 25 deletions(-) Approvals: pespin: Looks good to me, but someone else must approve osmith: Looks good to me, approved Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve diff --git a/gen_makefile.py b/gen_makefile.py index 1640735..80ecfa0 100755 --- a/gen_makefile.py +++ b/gen_makefile.py @@ -116,9 +116,6 @@ parser.add_argument('-g', '--build-debug', dest='build_debug', default=False, action='store_true', help='''set 'CFLAGS=-g' when calling src/configure''') -parser.add_argument('-a', '--auto-distclean', action='store_true', - help='''run "make distclean" automatically if source directory already configured''') - parser.add_argument('-i', '--install-prefix', default='/usr/local', help='''install there instead of /usr/local''') @@ -252,13 +249,12 @@ touch $@ ''' -def gen_makefile_autoconf(proj, src_proj, src_proj_copy, distclean_cond, update_src_copy_cmd): +def gen_makefile_autoconf(proj, src_proj, src_proj_copy, update_src_copy_cmd): buildsystem = projects_buildsystems.get(proj, "autotools") if buildsystem == "autotools": return f''' .make.{proj}.autoconf: .make.{proj}.clone {src_proj}/configure.ac - if {distclean_cond}; then $(MAKE) {proj}-distclean; fi @echo "\\n\\n\\n===== $@\\n" {update_src_copy_cmd} -rm -f {src_proj_copy}/.version @@ -272,14 +268,13 @@ assert False, f"unknown buildsystem: {buildsystem}" -def gen_makefile_configure(proj, deps_installed, distclean_cond, build_proj, +def gen_makefile_configure(proj, deps_installed, build_proj, cflags, docker_cmd, build_to_src, configure_opts, update_src_copy_cmd): buildsystem = projects_buildsystems.get(proj, "autotools") if buildsystem == "autotools": return f''' .make.{proj}.configure: .make.{proj}.autoconf {deps_installed} $({proj}_configure_files) - if {distclean_cond}; then $(MAKE) {proj}-distclean .make.{proj}.autoconf; fi @echo "\\n\\n\\n===== $@\\n" {update_src_copy_cmd} -chmod -R ug+w {build_proj} @@ -308,7 +303,7 @@ else: assert False, f"unknown buildsystem: {buildsystem}" -def gen_makefile_build(proj, distclean_cond, build_proj, docker_cmd, +def gen_makefile_build(proj, build_proj, docker_cmd, src_proj, update_src_copy_cmd): buildsystem = projects_buildsystems.get(proj, "autotools") check = "check" if args.make_check else "" @@ -316,7 +311,6 @@ if buildsystem == "autotools": return f''' .make.{proj}.build: .make.{proj}.configure $({proj}_files) - if {distclean_cond}; then $(MAKE) {proj}-distclean .make.{proj}.configure; fi @echo "\\n\\n\\n===== $@\\n" {update_src_copy_cmd} {docker_cmd}$(MAKE) -C {build_proj} -j {args.jobs} {check} @@ -404,14 +398,6 @@ -rm -rf .make.{proj}.* ''' -def gen_makefile_distclean(proj, src_proj): - return f''' -.PHONY: {proj}-distclean -{proj}-distclean: {proj}-clean - @echo "\\n\\n\\n===== $@\\n" - $(MAKE) -C {src_proj} distclean - ''' - def is_src_copy_needed(proj): if not args.autoreconf_in_src_copy: return False @@ -456,7 +442,6 @@ else: configure_opts_str = '' - distclean_cond = f'[ -e {src_proj}/config.status ]' if args.auto_distclean else 'false' deps_installed = ' '.join(['.make.%s.install' % d for d in deps]) deps_reinstall = ' '.join(['%s-reinstall' %d for d in deps]) cflags = 'CFLAGS=-g ' if args.build_debug else '' @@ -490,12 +475,10 @@ {gen_makefile_autoconf(proj, src_proj, src_proj_copy, - distclean_cond, update_src_copy_cmd)} {gen_makefile_configure(proj, deps_installed, - distclean_cond, build_proj, cflags, docker_cmd, @@ -504,7 +487,6 @@ update_src_copy_cmd)} {gen_makefile_build(proj, - distclean_cond, build_proj, docker_cmd, src_proj_copy, @@ -520,8 +502,6 @@ {gen_makefile_clean(proj, build_proj)} -{gen_makefile_distclean(proj, src_proj)} - .PHONY: {proj} {proj}: .make.{proj}.install ''' @@ -649,8 +629,6 @@ content += f" --push-url {shlex.quote(args.docker_cmd)} \\\n" if args.build_debug: content += " --build-debug \\\n" -if args.auto_distclean: - content += " --auto-distclean \\\n" if args.autoreconf_in_src_copy: content += " --autoreconf-in-src-copy \\\n" content += " $(NULL)\n" -- To view, visit https://gerrit.osmocom.org/c/osmo-dev/+/40355?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-dev Gerrit-Branch: master Gerrit-Change-Id: I28378e6d2cafd209adcfae6b85a032d73ed14cce Gerrit-Change-Number: 40355 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osm...@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanits...@sysmocom.de> Gerrit-Reviewer: neels <nhofm...@sysmocom.de> Gerrit-Reviewer: osmith <osm...@sysmocom.de> Gerrit-Reviewer: pespin <pes...@sysmocom.de>