summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbuild20
1 files changed, 11 insertions, 9 deletions
diff --git a/build b/build
index 851339a..465632e 100755
--- a/build
+++ b/build
@@ -92,21 +92,23 @@ $(build_targets): configure
# These default values are in header files in gcc/config. They must be
# edited here rather than in a patch because any given GCC target
# configuration can be used by multiple ProteanOS targets.
- # XXX: These commands run once per target, but they screw up the src/
- # directory and probably make things break.
+ # These commands run once per target, but they modify files in the src/
+ # directory that other targets might also use, so backups are made.
set -e; \
. "../targets.d/$(target).sh"; \
- mv "src/gcc/config/$${gcc_config_file}" \
- "src/gcc/config/$${gcc_config_file}~"; \
+ [ -e "src/gcc/config/$${gcc_config_file}.orig" ] || \
+ mv "src/gcc/config/$${gcc_config_file}" \
+ "src/gcc/config/$${gcc_config_file}.orig"; \
define_pattern=".define $${gcc_config_interp_macro}"; \
sed "s|^\($${define_pattern}\) \".*\"$$|\1 \"$(elf_interp)\"|" \
- "src/gcc/config/$${gcc_config_file}~" \
+ "src/gcc/config/$${gcc_config_file}.orig" \
>"src/gcc/config/$${gcc_config_file}"; \
+ [ -e "src/gcc/config/$${gcc_config_fragment}.orig" ] || \
+ mv "src/gcc/config/$${gcc_config_fragment}" \
+ "src/gcc/config/$${gcc_config_fragment}.orig"; \
sed "$${gcc_config_fragment_script}" \
- "src/gcc/config/$${gcc_config_fragment}" \
- >"src/gcc/config/$${gcc_config_fragment}~"; \
- mv "src/gcc/config/$${gcc_config_fragment}~" \
- "src/gcc/config/$${gcc_config_fragment}"; \
+ "src/gcc/config/$${gcc_config_fragment}.orig" \
+ >"src/gcc/config/$${gcc_config_fragment}"; \
printf '\nMULTIARCH_DIRNAME = %s\n' "$(target)" \
>>"src/gcc/config/$${gcc_config_fragment}"
if [ "x$(target)" = 'x$(OPK_HOST_ARCH)' ]; then \