summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-05-02 18:21:46 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-05-02 18:21:46 (EDT)
commit1f296c09e976c958a48001642250df5919396434 (patch)
tree562ec269986e34f201f047110f3d0f402e7efa7e /build
parentaf0f616a6836bb8d5193417877ef97fd28647d32 (diff)
build: Back up modified src/gcc/config/ files
Diffstat (limited to 'build')
-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 \