From 9f4e5b4aca897841e42001af85e59fb109f9de3e Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 08 Nov 2012 01:36:25 -0500 Subject: Update build. * Use new features of opkhelper; don't use obsolete oh-* utilities. * Clean up code according to best practices and SPF 2.0 recommendations. * Read target architectures from generated configuration file. * Add a "clean" target for convenience. The "install" target has yet to be updated. --- diff --git a/build b/build index c734e1e..1326229 100755 --- a/build +++ b/build @@ -2,46 +2,44 @@ CFLAGS = -g -O2 -configure.stamp: - for target in $(PKG_TARGETS); do \ - mkdir -p "build-$${target}"; \ - done +configure: # 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. - 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=/ \ + for target in $$(cat ../targets); do \ + CFLAGS='$(CFLAGS)' oh-autoconfigure \ + -B "build-$${target}" -t "$${target}" -- \ + $$([ -n "$${OPK_SYSROOT}" ] && \ + printf "--with-sysroot='%s'" "$${OPK_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}" \ - --with-pkgversion='GNU Binutils for embedded distro' && \ - cd ..; \ + --with-pkgversion='GNU Binutils for ProteanOS' || \ + exit 1; \ done # Generate all the individual program makefiles. - for target in $(PKG_TARGETS); do \ - cd "build-$${target}" && make configure-host && cd ..; \ + for target in $$(cat ../targets); do \ + oh-autobuild -B "build-$${target}" -T configure-host || \ + exit 1; \ done touch $@ -build.stamp: configure.stamp +build: configure # Build BFD header files. - for target in $(PKG_TARGETS); do \ - cd "build-$${target}/bfd" && make headers && cd ../..; \ + for target in $$(cat ../targets); do \ + oh-autobuild -B "build-$${target}/bfd" -T headers || \ + exit 1; \ done # Build ALL the things! - for target in $(PKG_TARGETS); do \ - cd "build-$${target}" && make CFLAGS='$(CFLAGS)' && cd ..; \ + for target in $$(cat ../targets); do \ + oh-autobuild -B "build-$${target}" CFLAGS='$(CFLAGS)' || \ + exit 1; \ done touch $@ -install.stamp: build.stamp +install: build # Install everything. for target in $(PKG_TARGETS); do \ cd "build-$${target}" && \ @@ -97,19 +95,15 @@ install.stamp: build.stamp echo "/usr/lib/$(OH_HOST_ARCH)/$${target}" \ >>"dest/etc/ld.so.conf.d/bdf-$${target}"; \ done - touch $@ - -binary-arch: install.stamp + # Post-process and install everything. oh-strip oh-installfiles - oh-installdocs binutils - oh-gencontrol - oh-buildopk - -binary-indep: install.stamp - oh-installfiles - oh-installdocs binutils - oh-gencontrol - oh-buildopk + touch $@ -binary: binary-arch binary-indep +clean: + for target in $$(cat ../targets); do \ + oh-autoclean -B "build-$${target}" || \ + exit 1; \ + done + rm -f configure build + rm -Rf *.data -- cgit v0.9.1