#! /usr/bin/make -f CFLAGS = -g -O2 configure: configure.stamp configure.stamp: for target in $(PKG_TARGETS); do \ mkdir -p "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. 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&^&$${target}-&" \ --enable-shared --disable-multilib \ --enable-plugins --disable-nls \ --build=$(OH_BUILD_ARCH_GNU) --host=$(OH_HOST_ARCH_GNU) \ --target="$${target_arch_gnu}" && \ cd ..; \ done # Generate all the individual program makefiles. for target in $(PKG_TARGETS); do \ cd "build-$${target}" && make configure-host && cd ..; \ done touch $@ build: build.stamp build.stamp: configure # Build BFD header files. for target in $(PKG_TARGETS); do \ cd "build-$${target}/bfd" && make headers && cd ../..; \ done # Build ALL the things! for target in $(PKG_TARGETS); do \ cd "build-$${target}" && make CFLAGS='$(CFLAGS)' && cd ..; \ done touch $@ install: install.stamp install.stamp: build # Install everything. for target in $(PKG_TARGETS); do \ cd "build-$${target}" && \ make CFLAGS='$(CFLAGS)' \ prefix="$${PWD}/../dest/usr" tooldir="$${PWD}/../dest/usr/tool" \ bindir="$${PWD}/../dest/usr/bin/$(OH_HOST_ARCH)" \ libdir="$${PWD}/../dest/usr/lib/$(OH_HOST_ARCH)" \ install && \ cd ..; \ done # tooldir contains target ldscripts and hard links to tools. # Move ldscripts to where they belong and delete everything else. # ldscripts should be independent of the host architecture and therefore # coinstallable with themselves across host architectures. for target in $(PKG_TARGETS); do \ mv dest/usr/tool/lib/ldscripts "dest/usr/lib/$${target}" && \ rm -Rf dest/usr/tool; \ done # This is a kludge to put libiberty.a in the right place. # The problem is that libiberty's makefile asks GCC for a multilib # directory. for target in $(PKG_TARGETS); do \ liberty="$$(find dest/usr/lib -name libiberty.a)" && \ mv "$${liberty}" dest/usr/lib/$(OH_HOST_ARCH) && \ rmdir "$${liberty%/libiberty.a}"; \ done # Move BFD libraries and headers into multiarch locations. # This can't be done with *dir options; these paths are hardcoded in # bfd/configure. for target in $(PKG_TARGETS); do \ target_arch_gnu=$$(oh-getarchitecture -t gnu "$${target}") && \ mkdir dest/usr/include && \ mkdir dest/usr/include/$(OH_HOST_ARCH) && \ mv "dest/usr/$(OH_HOST_ARCH_GNU)/$${target_arch_gnu}/include" \ "dest/usr/include/$(OH_HOST_ARCH)/$${target}" && \ mv "dest/usr/$(OH_HOST_ARCH_GNU)/$${target_arch_gnu}/lib" \ "dest/usr/lib/$(OH_HOST_ARCH)/$${target}" && \ rmdir "dest/usr/$(OH_HOST_ARCH_GNU)/$${target_arch_gnu}" && \ rmdir "dest/usr/$(OH_HOST_ARCH_GNU)"; \ done # Remove static library dependency metadata generated by libtool. rm -f dest/usr/lib/$(OH_HOST_ARCH)/*.la # Make symbolic links to native utilities. 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 oh-strip oh-installfiles oh-installdocs binutils oh-gencontrol oh-buildopk binary-indep: install oh-installfiles oh-installdocs binutils oh-gencontrol oh-buildopk binary: binary-arch binary-indep