summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-05-18 17:12:50 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-05-18 17:12:50 (EDT)
commit39f565a7f448ab2d80ea9bb491265c827c31f717 (patch)
tree27cbcf6d90156ea908a7f713d7e7eb5c6194ca55
parent34e4159c2ef76e0240c3b47e9b377d407b9b2571 (diff)
config, build: Simplify targets
-rwxr-xr-xbuild64
-rwxr-xr-xconfig14
2 files changed, 32 insertions, 46 deletions
diff --git a/build b/build
index 1a63eb8..1fa5e2a 100755
--- a/build
+++ b/build
@@ -11,18 +11,10 @@ include ../source.mk
include ../targets.mk
# Hardcode the targets to allow only native compilers for now.
-configure_targets = configure-$(OPK_HOST_ARCH)
-build_targets = build-$(OPK_HOST_ARCH)
-buildnative_targets = buildnative-$(OPK_HOST_ARCH)
-buildcross_targets = buildcross-$(OPK_HOST_ARCH)
-install_targets = install-$(OPK_HOST_ARCH)
-installnative_targets = installnative-$(OPK_HOST_ARCH)
-installcross_targets = installcross-$(OPK_HOST_ARCH)
+targets = $(OPK_HOST_ARCH)
version = $$(printf '%s\n' '$(OPK_SOURCE_VERSION_UPSTREAM)' | sed 's/+sip.*//')
base_version = $$(printf '%s\n' '$(OPK_SOURCE)' | sed 's/^gcc-//')
-
-target = $$(printf '%s' '$@' | sed 's/^[a-z]*-//')
target_gnu = $$(oh-architecture $(target))
builddir = obj-$(target)
@@ -94,7 +86,7 @@ nop:
../local.mk:
>../local.mk
-$(configure_targets):
+configure-native configure-cross:
set -e; \
. "../targets.d/$(target).sh"; \
if [ 'x$(OPK_HOST_PLAT)' = 'xbootstrap1' ]; then \
@@ -108,12 +100,8 @@ $(configure_targets):
$${target_opts} \
$(extra_opts); \
fi
- touch $@
-configure: $(configure_targets)
- touch $@
-
-$(build_targets): configure
+build-gcc-config:
# Set the default dynamic linker path inserted into ELF INTERP fields.
# 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
@@ -137,14 +125,8 @@ $(build_targets): configure
>"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 \
- $(MAKE) -f ../build "buildnative-$(target)"; \
- else \
- $(MAKE) -f ../build "buildcross-$(target)"; \
- fi
- touch $@
-$(buildnative_targets):
+build-native: build-gcc-config
oh-autobuild -B "$(builddir)" -T $(native_target) -- \
-j $${JOBS:-$(jobs)} \
$(dir_macros)
@@ -152,22 +134,12 @@ $(buildnative_targets):
# cd "$(builddir)" && make -k check; \
#fi
-$(buildcross_targets):
+build-cross: build-gcc-config
oh-autobuild -B "$(builddir)" -T $(cross_target) -- \
-j $${JOBS:-$(jobs)} \
$(dir_macros)
-build: $(build_targets)
- touch $@
-
-$(install_targets): build
- if [ "x$(target)" = 'x$(OPK_HOST_ARCH)' ]; then \
- $(MAKE) -f ../build "installnative-$(target)"; \
- else \
- $(MAKE) -f ../build "installcross-$(target)"; \
- fi
-
-$(installnative_targets):
+install-native:
# The -T option is necessary because otherwise:
# * oh-autoinstall checks for an "install" target by running make with
# the -n option,
@@ -247,7 +219,7 @@ $(installnative_targets):
" oh-installfiles -d "$(destdir)"
oh-shlibdeps
-$(installcross_targets):
+install-cross:
oh-autoinstall -B "$(builddir)" -d "$(destdir)" -T install-gcc -- \
$(dir_macros)
# Change the target architecture prefix of files in /usr/bin.
@@ -285,4 +257,24 @@ $(installcross_targets):
" oh-installfiles -d "$(destdir)"
oh-shlibdeps
-install: $(install_targets)
+configure_$(target) build_$(target) install_$(target):
+ touch $@
+
+configure_$(target): configure-$(type)
+build_$(target): build-$(type)
+install_$(target): install-$(type)
+
+configure build install:
+ for target in $(targets); do \
+ if [ x"$${target}" = x'$(OPK_HOST_ARCH)' ]; then \
+ type='native'; \
+ else \
+ type='cross'; \
+ fi; \
+ $0 target="$${target}" type="$${type}" "$@_$${target}"; \
+ done
+ touch $@
+
+configure:
+build: configure
+install: build
diff --git a/config b/config
index 22b56f0..a44a6c3 100755
--- a/config
+++ b/config
@@ -20,17 +20,11 @@ main()
PKG_TARGET_ARCH="${arch}" configure_build
done
>targets.mk
- for stamp in configure build buildnative buildcross \
- install installnative installcross; do
- printf '%s_targets = \\\n' "${stamp}" \
- >>targets.mk
- for arch in ${PKG_TARGETS}; do
- printf '\t%s-%s \\\n' \
- "${stamp}" "${arch}" \
- >>targets.mk
- done
- printf '\n' >>targets.mk
+ printf 'targets = \\\n' >>targets.mk
+ for arch in ${PKG_TARGETS}; do
+ printf '\t%s \\\n' "${arch}" >>targets.mk
done
+ printf '\n' >>targets.mk
;;
esac
}