neels has submitted this change. (
https://gerrit.osmocom.org/c/osmo-dev/+/25738 )
Change subject: gen_makefile.py: add --auto-distclean
......................................................................
gen_makefile.py: add --auto-distclean
Add a new option that avoids stopping the build with:
configure: error: source directory already configured; run "make distclean"
there first
I run into this frequently, when e.g. running './configure; make release'
inside Osmocom repositories and then attempting to build them with
osmo-dev. It is annoying as it does not fail immediatelly, and I need to
manually go to the source directories where it failed, run 'make
distclean' and then attempt to build again. Then it may fail on another
directory with the same problem.
Check for config.status, as that is also what ./configure checks for
before printing the error.
Change-Id: Iac71333e8c5da8dee4e8f34e2af8db12d2c08021
---
M gen_makefile.py
1 file changed, 15 insertions(+), 1 deletion(-)
Approvals:
pespin: Looks good to me, but someone else must approve
fixeria: Looks good to me, but someone else must approve
neels: Looks good to me, approved
diff --git a/gen_makefile.py b/gen_makefile.py
index c36b5ff..7c780a5 100755
--- a/gen_makefile.py
+++ b/gen_makefile.py
@@ -110,6 +110,9 @@
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''')
+
args = parser.parse_args()
class listdict(dict):
@@ -193,6 +196,7 @@
touch $@
.make.{proj}.autoconf: .make.{proj}.clone {src_proj}/configure.ac
+ if {distclean_cond}; then $(MAKE) {proj}-distclean; fi
@echo -e "\n\n\n===== $@\n"
-rm -f {src_proj}/.version
cd {src_proj}; autoreconf -fi
@@ -200,6 +204,7 @@
touch $@
.make.{proj}.configure: .make.{proj}.autoconf {deps_installed}
$({proj}_configure_files)
+ if {distclean_cond}; then $(MAKE) {proj}-distclean
.make.{proj}.autoconf; fi
@echo -e "\n\n\n===== $@\n"
-chmod -R ug+w {build_proj}
-rm -rf {build_proj}
@@ -209,6 +214,7 @@
touch $@
.make.{proj}.build: .make.{proj}.configure $({proj}_files)
+ if {distclean_cond}; then $(MAKE) {proj}-distclean
.make.{proj}.configure; fi
@echo -e "\n\n\n===== $@\n"
{docker_cmd}$(MAKE) -C {build_proj} -j {jobs} {check}
sync
@@ -234,6 +240,12 @@
-chmod -R ug+w {build_proj}
-rm -rf {build_proj}
-rm -rf .make.{proj}.*
+
+.PHONY: {proj}-distclean
+{proj}-distclean: {proj}-clean
+ @echo -e "\n\n\n===== $@\n"
+ $(MAKE) -C {src_proj} distclean
+
'''.format(
url=url,
push_url=push_url or url,
@@ -252,6 +264,7 @@
check='check' if make_check else '',
docker_cmd=f'{args.docker_cmd} ' if args.docker_cmd else '',
cflags='CFLAGS=-g ' if args.build_debug else '',
+ distclean_cond=f'[ -e {make_to_src_proj}/config.status ]' if
args.auto_distclean else 'false'
)
@@ -328,7 +341,7 @@
-o {makefile} \
-s {src_dir} \
-b {build_dir} \
- -u
"{url}"{push_url}{sudo_make_install}{no_ldconfig}{ldconfig_without_sudo}{make_check}{docker_cmd}{build_debug}
+ -u
"{url}"{push_url}{sudo_make_install}{no_ldconfig}{ldconfig_without_sudo}{make_check}{docker_cmd}{build_debug}{auto_distclean}
'''.format(
script=os.path.relpath(sys.argv[0], make_dir),
@@ -345,6 +358,7 @@
make_check='' if args.make_check else " \\\n\t\t--no-make-check",
docker_cmd=f' \\\n\t\t--docker-cmd "{args.docker_cmd}"' if args.docker_cmd
else '',
build_debug=f' \\\n\t\t--build-debug' if args.build_debug else '',
+ auto_distclean=' \\\n\t\t--auto-distclean' if args.auto_distclean else '',
))
# convenience target: clone all repositories first
--
To view, visit https://gerrit.osmocom.org/c/osmo-dev/+/25738
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-Change-Id: Iac71333e8c5da8dee4e8f34e2af8db12d2c08021
Gerrit-Change-Number: 25738
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <[email protected]>
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: neels <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged