Skip to content

Commit a50bb96

Browse files
committed
🔨 Fix Warnings.cpp force-recompile
1 parent 653f0ab commit a50bb96

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

buildroot/share/PlatformIO/scripts/preflight-checks.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,27 @@ def sanity_check_target():
7878
err = "ERROR: Config files found in directory %s. Please move them into the Marlin subfolder." % p
7979
raise SystemExit(err)
8080

81+
#
82+
# Find the name.cpp.o or name.o and remove it
83+
#
84+
def rm_ofile(subdir, name):
85+
build_dir = os.path.join(env['PROJECT_BUILD_DIR'], build_env);
86+
for outdir in [ build_dir, os.path.join(build_dir, "debug") ]:
87+
for ext in [ ".cpp.o", ".o" ]:
88+
fpath = os.path.join(outdir, "src", "src", subdir, name + ext)
89+
if os.path.exists(fpath):
90+
os.remove(fpath)
91+
8192
#
8293
# Give warnings on every build
8394
#
84-
build_dir = os.path.join(env['PROJECT_BUILD_DIR'], build_env);
85-
for outdir in [ build_dir, os.path.join(build_dir, "debug") ]:
86-
for wext in [ ".cpp", "" ]:
87-
warnfile = os.path.join(outdir, "src", "src", "inc", "Warnings" + wext + ".o")
88-
if os.path.exists(warnfile):
89-
os.remove(warnfile)
95+
rm_ofile("inc", "Warnings")
9096

9197
#
9298
# Rebuild 'settings.cpp' for EEPROM_INIT_NOW
9399
#
94100
if 'EEPROM_INIT_NOW' in env['MARLIN_FEATURES']:
95-
setfile = os.path.join(srcpath, "module", "settings.cpp.o")
96-
if os.path.exists(setfile):
97-
os.remove(setfile)
101+
rm_ofile("module", "settings")
98102

99103
#
100104
# Check for old files indicating an entangled Marlin (mixing old and new code)

0 commit comments

Comments
 (0)