From ed643e634fbd98d21e22fdcdf615532cc9cf0def Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 14 Jul 2022 21:03:11 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Fix=20Warnings/settings=20force-?= =?UTF-8?q?recompile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PlatformIO/scripts/preflight-checks.py | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/preflight-checks.py b/buildroot/share/PlatformIO/scripts/preflight-checks.py index dbd0510b5d..d0f1c138c9 100644 --- a/buildroot/share/PlatformIO/scripts/preflight-checks.py +++ b/buildroot/share/PlatformIO/scripts/preflight-checks.py @@ -78,21 +78,27 @@ if pioutil.is_pio_build(): err = "ERROR: Config files found in directory %s. Please move them into the Marlin subfolder." % p raise SystemExit(err) + # + # Find the name.cpp.o or name.o and remove it + # + def rm_ofile(subdir, name): + build_dir = os.path.join(env['PROJECT_BUILD_DIR'], build_env); + for outdir in [ build_dir, os.path.join(build_dir, "debug") ]: + for ext in [ ".cpp.o", ".o" ]: + fpath = os.path.join(outdir, "src", "src", subdir, name + ext) + if os.path.exists(fpath): + os.remove(fpath) + # # Give warnings on every build # - srcpath = os.path.join(env['PROJECT_BUILD_DIR'], build_env, "src", "src") - warnfile = os.path.join(srcpath, "inc", "Warnings.cpp.o") - if os.path.exists(warnfile): - os.remove(warnfile) + rm_ofile("inc", "Warnings") # # Rebuild 'settings.cpp' for EEPROM_INIT_NOW # if 'EEPROM_INIT_NOW' in env['MARLIN_FEATURES']: - setfile = os.path.join(srcpath, "module", "settings.cpp.o") - if os.path.exists(setfile): - os.remove(setfile) + rm_ofile("module", "settings") # # Check for old files indicating an entangled Marlin (mixing old and new code)