Allow gdb to be cross-compiled.
[dragonfly.git] / gnu / usr.bin / gdb / libbfd / Makefile
index 96ab77b..21952ae 100644 (file)
@@ -1,4 +1,4 @@
-# $DragonFly: src/gnu/usr.bin/gdb/libbfd/Makefile,v 1.2 2008/01/14 21:36:38 corecode Exp $
+# $DragonFly: src/gnu/usr.bin/gdb/libbfd/Makefile,v 1.3 2008/07/28 22:33:21 corecode Exp $
 
 .include "../Makefile.inc"
 
@@ -30,7 +30,39 @@ elf32-target.h: elfxx-target.h
 elf64-target.h: elfxx-target.h
        sed -e s/NN/64/g < ${CONTRIBDIR}/elfxx-target.h > ${.TARGET}
 
-.include "Makefile.${MACHINE_ARCH}"
+TARGET_ARCH?=  ${MACHINE_ARCH}
+.include "Makefile.${TARGET_ARCH}"
+
+SRCS+=         bfd.h bfdver.h
+CLEANFILES+=   bfd.h bfdver.h
+
+# Used to do keyword replacement in bfd-X.h
+#
+BFD_ARCH_SIZE?=64
+BFD_HOST_64_BIT_DEFINED?=1
+BFD_HOST_LONG_LONG?=1
+.include "Makefile.host.${MACHINE_ARCH}"
+
+bfd.h:         ${CONTRIBDIR}/bfd-in2.h
+       sed -e "s/@wordsize@/${BFD_ARCH_SIZE}/g" \
+           -e "s/@bfd_default_target_size@/${BFD_DEFAULT_TARGET_SIZE}/g" \
+           -e "s/@BFD_HOST_64BIT_LONG@/${BFD_HOST_64BIT_LONG}/g" \
+           -e "s/@BFD_HOST_64BIT_LONG_LONG@/${BFD_HOST_64BIT_LONG_LONG}/g" \
+           -e "s/@BFD_HOST_64_BIT@/${BFD_HOST_64_BIT}/g" \
+           -e "s/@BFD_HOST_U_64_BIT@/${BFD_HOST_U_64_BIT}/g" \
+           -e "s/@BFD_HOST_64_BIT_DEFINED@/${BFD_HOST_64_BIT_DEFINED}/g" \
+           -e "s/@BFD_HOST_LONG_LONG@/${BFD_HOST_LONG_LONG}/g" \
+           -e "s/@bfd_file_ptr@/${BFD_HOST_64_BIT}/g" \
+           -e "s/@BFD_HOSTPTR_T@/${BFD_HOSTPTR_T}/g" \
+           < ${CONTRIBDIR}/bfd-in2.h > bfd.h.new
+       mv -f bfd.h.new bfd.h
+
+bfdver.h: ${CONTRIBDIR}/version.h
+       sed -e "s/@bfd_version_string@/\"2.18.50.20070907\"/g" \
+           -e "s/@bfd_version_package@/\"(GNU Binutils, GDB packaged)\"/g" \
+           -e "s/@bfd_version@/218500000/g" \
+           < ${CONTRIBDIR}/version.h > bfdver.h.new
+       mv -f bfdver.h.new bfdver.h
 
 SRCS+=         bfd_stdint.h
 CLEANFILES+=   bfd_stdint.h