xref: /openbmc/linux/scripts/remove-stale-files (revision 92579713)
11476fee5SMasahiro Yamada#!/bin/sh
21476fee5SMasahiro Yamada
31476fee5SMasahiro Yamadaset -e
41476fee5SMasahiro Yamada
51476fee5SMasahiro Yamada# When you move, remove or rename generated files, you probably also update
61476fee5SMasahiro Yamada# .gitignore and cleaning rules in the Makefile. This is the right thing
71476fee5SMasahiro Yamada# to do. However, people usually do 'git pull', 'git bisect', etc. without
81476fee5SMasahiro Yamada# running 'make clean'. Then, the stale generated files are left over, often
91476fee5SMasahiro Yamada# causing build issues.
101476fee5SMasahiro Yamada#
111476fee5SMasahiro Yamada# Also, 'git status' shows such stale build artifacts as untracked files.
121476fee5SMasahiro Yamada# What is worse, some people send a wrong patch to get them back to .gitignore
131476fee5SMasahiro Yamada# without checking the commit history.
141476fee5SMasahiro Yamada#
151476fee5SMasahiro Yamada# So, when you (re)move generated files, please move the cleaning rules from
161476fee5SMasahiro Yamada# the Makefile to this script. This is run before Kbuild starts building
171476fee5SMasahiro Yamada# anything, so people will not be annoyed by such garbage files.
181476fee5SMasahiro Yamada#
191476fee5SMasahiro Yamada# This script is not intended to grow endlessly. Rather, it is a temporary scrap
201476fee5SMasahiro Yamada# yard. Stale files stay in this file for a while (for some release cycles?),
211476fee5SMasahiro Yamada# then will be really dead and removed from the code base entirely.
221476fee5SMasahiro Yamada
23*92579713SMasahiro Yamadarm -f arch/powerpc/purgatory/kexec-purgatory.c
24*92579713SMasahiro Yamada
251476fee5SMasahiro Yamada# These were previously generated source files. When you are building the kernel
261476fee5SMasahiro Yamada# with O=, make sure to remove the stale files in the output tree. Otherwise,
271476fee5SMasahiro Yamada# the build system wrongly compiles the stale ones.
281476fee5SMasahiro Yamadaif [ -n "${building_out_of_srctree}" ]; then
29251cc826SMasahiro Yamada	for f in fdt_rw.c fdt_ro.c fdt_wip.c fdt.c ashldi3.S bswapsdi2.S font.c lib1funcs.S hyp-stub.S
301476fee5SMasahiro Yamada	do
311476fee5SMasahiro Yamada		rm -f arch/arm/boot/compressed/${f}
321476fee5SMasahiro Yamada	done
33f78b25eeSMasahiro Yamada
34f78b25eeSMasahiro Yamada	for f in uart-ath79.c ashldi3.c bswapdi.c bswapsi.c
35f78b25eeSMasahiro Yamada	do
36f78b25eeSMasahiro Yamada		rm -f arch/mips/boot/compressed/${f}
37f78b25eeSMasahiro Yamada	done
383cbadd20SMasahiro Yamada
393cbadd20SMasahiro Yamada	for f in firmware.c real2.S
403cbadd20SMasahiro Yamada	do
413cbadd20SMasahiro Yamada		rm -f arch/parisc/boot/compressed/${f}
423cbadd20SMasahiro Yamada	done
431476fee5SMasahiro Yamadafi
44340a0253SMasahiro Yamada
45340a0253SMasahiro Yamadarm -f scripts/extract-cert
46