summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbuild74
1 files changed, 35 insertions, 39 deletions
diff --git a/build b/build
index b229d27..5b66800 100755
--- a/build
+++ b/build
@@ -146,6 +146,16 @@ build-cross: build-gcc-config
-j $${JOBS:-$(jobs)} \
$(dir_macros)
+inst = set -e; \
+ inst() { \
+ i=0; for d in "$${@}"; do : $$((i += 1)); done; \
+ mkdir -p "$(destdir)$$(printf '%s\n' $${d} | sed 's|/.*$$||')";\
+ for s in "$${@}"; do [ $$((i -= 1)) -eq 0 ] && break; \
+ rm -Rf "$(destdir)$${d}"; \
+ mv "$(destdir)$${s}" "$(destdir)$${d}"; \
+ done; \
+ }; inst
+
install-native:
# The -T option is necessary because otherwise:
# * oh-autoinstall checks for an "install" target by running make with
@@ -168,44 +178,32 @@ install-native:
$(destdir)/usr/bin/$(target)-c++-$(base_version)
# Move files into ProteanOS-style directories.
# gcc programs:
- mkdir -p $(destdir)$(gccexedir)
- mv \
- $(destdir)$(libsubdir)/cc1* \
- $(destdir)$(libsubdir)/collect2 \
- $(destdir)$(libsubdir)/lto* \
- $(destdir)$(gccexedir)
+ $(inst) $(libsubdir)/cc1* \
+ $(libsubdir)/collect2 \
+ $(libsubdir)/lto* \
+ $(gccexedir)
# Start files and gcc libraries:
- mkdir -p $(destdir)$(tgtlibdir)
- mv \
- $(destdir)$(libsubdir)/*.o \
- $(destdir)$(libsubdir)/*.a \
- $(destdir)$(libsubdir)/*.so* \
- $(destdir)$(tgtlibdir)
+ $(inst) $(libsubdir)/*.o \
+ $(libsubdir)/*.a \
+ $(libsubdir)/*.so* \
+ $(tgtlibdir)
# C++ headers:
- mkdir -p \
- $(destdir)$(gcc_gcc_include_dir) \
- $(destdir)$(gcc_fixed_include_dir) \
- $(destdir)$(gcc_gxx_include_dir) \
- $(destdir)$(gcc_gxx_tool_include_dir) \
- $(destdir)$(gcc_gxx_backward_include_dir)
- mv $(destdir)$(def_gcc_gcc_include_dir)/* \
- $(destdir)$(gcc_gcc_include_dir)
- mv $(destdir)$(def_gcc_fixed_include_dir)/* \
- $(destdir)$(gcc_fixed_include_dir)
+ $(inst) $(def_gcc_gcc_include_dir) \
+ $(gcc_gcc_include_dir)
+ $(inst) $(def_gcc_fixed_include_dir) \
+ $(gcc_fixed_include_dir)
# def_gcc_gxx_tool_include_dir and def_gcc_gxx_backward_include_dir are
# subdirectories of def_gcc_gxx_include_dir, so move them first.
- mv $(destdir)$(def_gcc_gxx_tool_include_dir)/* \
- $(destdir)$(gcc_gxx_tool_include_dir)
- mv $(destdir)$(def_gcc_gxx_backward_include_dir)/* \
- $(destdir)$(gcc_gxx_backward_include_dir)
- mv $(destdir)$(def_gcc_gxx_include_dir)/* \
- $(destdir)$(gcc_gxx_include_dir)
+ $(inst) $(def_gcc_gxx_tool_include_dir) \
+ $(gcc_gxx_tool_include_dir)
+ $(inst) $(def_gcc_gxx_backward_include_dir) \
+ $(gcc_gxx_backward_include_dir)
+ $(inst) $(def_gcc_gxx_include_dir) \
+ $(gcc_gxx_include_dir)
# Target-arch libraries:
- mkdir -p $(destdir)$(libdir)
- mv $(destdir)$(libdir)/$(libsuffix)/* $(destdir)$(libdir)
+ $(inst) $(libdir)/$(libsuffix) $(libdir)
# Put libgcc_s.so.* under /lib.
- mkdir -p $(destdir)/lib/$(OPK_HOST_ARCH)
- mv $(destdir)$(libdir)/libgcc_s.so.* $(destdir)/lib/$(OPK_HOST_ARCH)
+ $(inst) $(libdir)/libgcc_s.so.* /lib/$(OPK_HOST_ARCH)
# Put *.so links in a versioned directory. We want links to
# libfoo.so.x, not libfoo.x.y.z as libtool generates.
set -e; \
@@ -216,7 +214,7 @@ install-native:
ln -sf ../../$${lib} $(destdir)$(tgtlibdir)/$${link}; \
done
# Put *.o and *.spec files in a versioned directory.
- mv $(destdir)$(libdir)/*.o $(destdir)$(libdir)/*.spec \
+ $(inst) $(destdir)$(libdir)/*.o $(destdir)$(libdir)/*.spec \
$(destdir)$(tgtlibdir)
# Remove libitm files.
rm -f $(destdir)$(libdir)/libitm.*
@@ -270,12 +268,10 @@ install-cross:
ln -s $(target)-g++-$(base_version) \
$(destdir)/usr/bin/$(target)-c++-$(base_version)
# Move files into ProteanOS-style directories.
- mkdir -p $(destdir)$(gccexedir)
- mv \
- $(destdir)$(libsubdir)/cc1* \
- $(destdir)$(libsubdir)/collect2 \
- $(destdir)$(libsubdir)/lto* \
- $(destdir)$(gccexedir)
+ $(inst) $(libsubdir)/cc1* \
+ $(libsubdir)/collect2 \
+ $(libsubdir)/lto* \
+ $(gccexedir)
rm -Rf \
$(destdir)$(libsubdir)/*.o \
$(destdir)$(libsubdir)/include* \