summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-07-28 05:17:10 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-07-28 05:17:10 (EDT)
commita28f2e4ccef454b74c9683e57d668741c7d8a3a4 (patch)
tree35de9d11c0df03a591f1be7e734eac8fdc15cf63
parent19967dab63b2bf7ce2e92f649e2d0da8acfa94b4 (diff)
Support multiple targets per build.
-rw-r--r--build52
-rwxr-xr-xconfig6
2 files changed, 37 insertions, 21 deletions
diff --git a/build b/build
index 6b8c8a4..ddf22c1 100644
--- a/build
+++ b/build
@@ -4,46 +4,60 @@ CFLAGS = -g -O2
configure: configure.stamp
configure.stamp:
- mkdir build
+ for target in $(PKG_TARGETS); do \
+ mkdir "build-$${target}"; \
+ done
# Generate the main makefile.
# Use shared BFD and opcodes libraries for all utilities.
# Don't enable multilib (multiarch is better).
# Enable plugins.
# Don't expect to find Gettext.
- cd build && \
- target_arch_gnu=$$(oh-getarchitecture -t gnu $(PKG_TARGET_ARCH)) && \
+ for target in $(PKG_TARGETS); do \
+ cd "build-$${target}" && \
+ target_arch_gnu=$$(oh-getarchitecture -t gnu "$${target}" && \
CFLAGS='$(CFLAGS)' ../src/configure \
- --prefix=/usr --with-sysroot=/ \
- --program-transform-name='s&^&$(PKG_TARGET_ARCH)-&' \
- --enable-shared --disable-multilib \
- --enable-plugins --disable-nls \
- --build=$(OH_BUILD_ARCH_GNU) --host=$(OH_HOST_ARCH_GNU) \
- --target=$${target_arch_gnu}
+ --prefix=/usr --with-sysroot=/ \
+ --program-transform-name="s&^&$${target}-&" \
+ --enable-shared --disable-multilib \
+ --enable-plugins --disable-nls \
+ --build=$(OH_BUILD_ARCH_GNU) --host=$(OH_HOST_ARCH_GNU) \
+ --target="$${target_arch_gnu}"; \
+ done
# Generate all the individual program makefiles.
- cd build && make configure-host
+ for target in $(PKG_TARGETS); do \
+ cd build && make configure-host; \
+ done
touch $@
build: build.stamp
build.stamp: configure
# Build BFD header files.
- cd build/bfd && make headers
+ for target in $(PKG_TARGETS); do \
+ cd "build-$${target}/bfd" && make headers; \
+ done
# Build ALL the things!
- cd build && make CFLAGS='$(CFLAGS)'
+ for target in $(PKG_TARGETS); do \
+ cd "build-$${target}" && make CFLAGS='$(CFLAGS)'; \
+ done
touch $@
install: install.stamp
install.stamp: build
# Install everything.
- cd build && \
- make CFLAGS='$(CFLAGS)' prefix="$${PWD}/../dest" install
+ for target in $(PKG_TARGETS); do \
+ cd build && \
+ make CFLAGS='$(CFLAGS)' prefix="$${PWD}/../dest" install; \
+ done
# Remove static library dependency metadata generated by libtool.
rm -f ../dest/usr/lib/*.la
# Make symbolic links to native utilities.
- if [ '$(OH_HOST_ARCH)' = '$(PKG_TARGET_ARCH)' ]; then \
- for util in ../dest/usr/bin/*; do \
- ln -sf "$(PKG_TARGET_ARCH)-$${util##*/}" "$${util}"; \
- done \
- fi
+ for target in $(PKG_TARGETS); do \
+ if [ '$(OH_HOST_ARCH)' = "$${target}" ]; then \
+ for util in "../dest/usr/bin/$${target}-"*; do \
+ ln -sf "$${util##*/}" "$${util%/*}/$${util##*/$${target}}"; \
+ done \
+ fi; \
+ done
touch $@
binary-arch: install
diff --git a/config b/config
index 750f88d..1a91a51 100755
--- a/config
+++ b/config
@@ -11,7 +11,9 @@ main()
clean
;;
*)
- configure_build
+ for arch in ${PKG_TARGETS}; do
+ PKG_TARGET_ARCH="${arch}" configure_build
+ done
;;
esac
}
@@ -27,7 +29,7 @@ configure_build()
{
# Generate a sed script to edit files.
_ss=
- for _name in TARGET_ARCH TARGET_ARCH_GNU; do
+ for _name in TARGET_ARCH; do
_ss="${_ss}s&@PKG_${_name}@&$(eval echo \$\{PKG_${_name}\})&;"
done