[BACK]Return to Makefile.cross CVS log [TXT][DIR] Up to [local] / src

Annotation of src/Makefile.cross, Revision 1.16

1.16    ! miod        1: # $OpenBSD: Makefile.cross,v 1.15 2006/04/19 18:32:39 miod Exp $
1.1       espie       2:
                      3: cross-tools:   cross-includes cross-binutils cross-gcc cross-lib
                      4: cross-distrib: cross-tools cross-bin cross-etc-root-var
                      5:
1.11      miod        6: # Have to compute TARGET_ARCH directly in the Makefile, for .if tests involving
                      7: # this variable to work.
                      8: .if    (${TARGET} == "cats" || ${TARGET} == "zaurus")
                      9: TARGET_ARCH=   arm
                     10: .elif  (${TARGET} == "hp300" || ${TARGET} == "mac68k" || \
                     11:         ${TARGET} == "mvme68k")
                     12: TARGET_ARCH=   m68k
                     13: .elif  (${TARGET} == "luna88k" || ${TARGET} == "mvme88k")
                     14: TARGET_ARCH=   m88k
                     15: .elif  (${TARGET} == "sgi")
                     16: TARGET_ARCH=   mips64
                     17: .elif  (${TARGET} == "macppc" || ${TARGET} == "mvmeppc")
                     18: TARGET_ARCH=   powerpc
                     19: .else
                     20: TARGET_ARCH=   ${TARGET}
                     21: .endif
                     22:
1.1       espie      23: CROSSCPPFLAGS?=        -nostdinc -I${CROSSDIR}/usr/include
                     24: CROSSLDFLAGS?= -nostdlib -L${CROSSDIR}/usr/lib -static
                     25: CROSSCFLAGS?=  ${CROSSCPPFLAGS}
                     26: CROSSCXXFLAGS?=        ${CROSSCPPFLAGS}
                     27: LDSTATIC?=     -static
                     28:
                     29: CROSSDIR=      ${DESTDIR}/usr/cross/${TARGET}
                     30: CROSSENV=      AR=${CROSSDIR}/usr/bin/ar AS=${CROSSDIR}/usr/bin/as \
                     31:                CC=${CROSSDIR}/usr/bin/cc CPP=${CROSSDIR}/usr/bin/cpp \
                     32:                CXX=${CROSSDIR}/usr/bin/c++ \
1.5       grange     33:                LD=${CROSSDIR}/usr/bin/ld \
1.1       espie      34:                LORDER=/usr/bin/lorder RANLIB=${CROSSDIR}/usr/bin/ranlib \
1.5       grange     35:                STRIP=${CROSSDIR}/usr/bin/strip \
1.1       espie      36:                HOSTCC=\"${CC}\" HOSTCXX=\"${CXX}\" NOMAN= DESTDIR=${CROSSDIR} \
                     37:                HOSTCFLAGS=\"${CFLAGS}\" HOSTCXXFLAGS=\"${CXXFLAGS}\" \
1.11      miod       38:                HOSTLDFLAGS=\"${LDFLAGS}\" \
1.1       espie      39:                CFLAGS=\"${CROSSCFLAGS}\" CPPFLAGS=\"${CROSSCPPFLAGS}\" \
                     40:                CXXFLAGS=\"${CROSSCXXFLAGS}\" \
                     41:                LDFLAGS=\"${CROSSLDFLAGS}\"
                     42: CROSSPATH=     ${PATH}:${CROSSDIR}/usr/bin
                     43: CROSSLANGS?=   c c++
                     44:
1.2       espie      45: TARGET_CANON=`cat ${CROSSDIR}/TARGET_CANON`
                     46:
1.1       espie      47: CROSSDIRS=     ${CROSSDIR}/.dirs_done
                     48: CROSSOBJ=      ${CROSSDIR}/usr/obj/.obj_done
                     49: CROSSINCLUDES= ${CROSSDIR}/usr/include/.includes_done
                     50: CROSSBINUTILS= ${CROSSDIR}/usr/bin/.binutils_done
                     51: CROSSGCC=      ${CROSSDIR}/usr/bin/.gcc_done
                     52: NO_CROSS=      isakmpd tn3270 less sudo openssl libkeynote libssl \
1.14      mickey     53:                keynote sectok ssh
1.1       espie      54:
1.2       espie      55: # no libcrypto.... these won't build
1.8       martin     56: NO_CROSS+=     dc login_krb5 login_krb5-or-pwd passwd ppp tcpdump telnet
1.2       espie      57: # need host setup for ydr
                     58: NO_CROSS+=afs
                     59: # explicit cross-compile
                     60: NO_CROSS+=bind
                     61:
1.1       espie      62: cross-dirs:    ${CROSSDIRS}
                     63: cross-obj:     ${CROSSOBJ}
                     64: cross-includes:        ${CROSSINCLUDES}
                     65: cross-binutils:        ${CROSSBINUTILS}
                     66: cross-gcc:     ${CROSSGCC}
                     67:
                     68: cross-env:
                     69:        @echo ${CROSSENV} MACHINE=${TARGET} \
                     70:            MACHINE_ARCH=`cat ${CROSSDIR}/TARGET_ARCH`
                     71:
                     72: ${CROSSDIRS}:
                     73:        @-mkdir -p ${CROSSDIR}
1.11      miod       74:        @echo ${TARGET_ARCH} > ${CROSSDIR}/TARGET_ARCH
1.1       espie      75:        @echo TARGET_ARCH is `cat ${CROSSDIR}/TARGET_ARCH`
                     76:        @eval `grep '^osr=' sys/conf/newvers.sh`; \
                     77:           sed "s/\$$/-unknown-openbsd$$osr/" ${CROSSDIR}/TARGET_ARCH > \
                     78:           ${CROSSDIR}/TARGET_CANON
                     79:        @-mkdir -p ${CROSSDIR}
1.2       espie      80:        @-mkdir -p ${CROSSDIR}/usr/${TARGET_CANON}
1.1       espie      81:        @ln -sf ${CROSSDIR}/usr/include \
1.2       espie      82:            ${CROSSDIR}/usr/${TARGET_CANON}/include
1.1       espie      83:        @ln -sf ${CROSSDIR}/usr/lib \
1.2       espie      84:            ${CROSSDIR}/usr/${TARGET_CANON}/lib
                     85:        @-mkdir -p ${CROSSDIR}/usr/${TARGET_CANON}/bin
1.1       espie      86:        @(cd ${.CURDIR}/etc && DESTDIR=${CROSSDIR} ${MAKE} distrib-dirs)
                     87:        @touch ${CROSSDIRS}
                     88:
                     89: ${CROSSOBJ}:   ${CROSSDIRS}
                     90:        @-mkdir -p ${CROSSDIR}/usr/obj
                     91:        @(cd ${.CURDIR} && \
                     92:            BSDOBJDIR=${CROSSDIR}/usr/obj \
                     93:            MACHINE=${TARGET} \
1.2       espie      94:            MACHINE_ARCH=${TARGET_ARCH} \
1.1       espie      95:            BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
                     96:            ${MAKE} obj)
                     97:        @touch ${CROSSOBJ}
                     98:
                     99: ${CROSSINCLUDES}:      ${CROSSOBJ}
                    100:        @-mkdir -p ${CROSSDIR}/usr/include
                    101:        @(cd ${.CURDIR}/include && \
1.2       espie     102:            MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \
1.1       espie     103:            MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
1.4       grange    104:            TARGET_ARCH=${TARGET_ARCH} \
1.1       espie     105:            ${MAKE} prereq && \
1.2       espie     106:            MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \
1.1       espie     107:            MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
1.4       grange    108:            TARGET_ARCH=${TARGET_ARCH} \
1.1       espie     109:            ${MAKE} DESTDIR=${CROSSDIR} includes)
                    110:        @touch ${CROSSINCLUDES}
                    111:
1.11      miod      112: .if (${TARGET_ARCH} == "m68k" || ${TARGET_ARCH} == "m88k" || \
                    113:      ${TARGET_ARCH} == "vax")
1.1       espie     114: BINUTILS=      ar as ld nm ranlib objcopy objdump strings strip
                    115: NEW_BINUTILS?= No
                    116: .else
                    117: BINUTILS=      ar as gasp ld nm objcopy objdump ranlib readelf size \
                    118:                strings strip
                    119: NEW_BINUTILS?= Yes
                    120: .endif
                    121:
                    122: ${CROSSBINUTILS}:      ${CROSSINCLUDES}
                    123:        (cd ${.CURDIR}/gnu/usr.bin/binutils; \
                    124:            MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
1.16    ! miod      125:            USING_NEW_BINUTILS=${NEW_BINUTILS} \
1.2       espie     126:            TARGET_ARCH=${TARGET_ARCH} \
1.1       espie     127:            ${MAKE} -f Makefile.bsd-wrapper depend && \
                    128:            MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
1.16    ! miod      129:            USING_NEW_BINUTILS=${NEW_BINUTILS} \
1.2       espie     130:            TARGET_ARCH=${TARGET_ARCH} \
1.1       espie     131:            ${MAKE} -f Makefile.bsd-wrapper all && \
                    132:            DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
1.16    ! miod      133:            USING_NEW_BINUTILS=${NEW_BINUTILS} \
1.1       espie     134:            ${MAKE} -f Makefile.bsd-wrapper install)
1.16    ! miod      135: .if ${NEW_BINUTILS:L} != "yes"
1.1       espie     136:        (cd ${.CURDIR}/gnu/usr.bin/gas; \
1.2       espie     137:            TARGET_MACHINE_ARCH=${TARGET_ARCH} \
1.1       espie     138:            MAKEOBJDIR=obj.${MACHINE}.${TARGET} ${MAKE} depend all; \
1.2       espie     139:            TARGET_MACHINE_ARCH=${TARGET_ARCH} \
1.1       espie     140:            DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
                    141:            ${MAKE} NOMAN= install)
                    142:        ln -sf ${CROSSDIR}/usr/bin/as \
1.10      miod      143:            ${CROSSDIR}/usr/${TARGET_CANON}/bin/as
1.1       espie     144:        (cd ${.CURDIR}/gnu/usr.bin/ld; \
1.2       espie     145:            TARGET_MACHINE_ARCH=${TARGET_ARCH} \
1.1       espie     146:            MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
                    147:            ${MAKE} NOPIC= NOMAN= depend all; \
1.2       espie     148:            TARGET_MACHINE_ARCH=${TARGET_ARCH} \
1.1       espie     149:            DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
                    150:            ${MAKE} NOPIC= NOMAN= install)
                    151:        ln -sf ${CROSSDIR}/usr/bin/ld \
1.2       espie     152:            ${CROSSDIR}/usr/${TARGET_CANON}/bin/ld
1.1       espie     153:        (cd ${.CURDIR}/usr.bin/ar; \
1.15      miod      154:            ELF_TOOLCHAIN=no \
1.1       espie     155:            MAKEOBJDIR=obj.${MACHINE}.${TARGET} ${MAKE} NOMAN= depend all; \
1.15      miod      156:            ELF_TOOLCHAIN=no \
1.1       espie     157:            DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
                    158:            ${MAKE} NOMAN= install)
                    159:        ln -sf ${CROSSDIR}/usr/bin/ar \
1.2       espie     160:            ${CROSSDIR}/usr/${TARGET_CANON}/bin/ar
1.1       espie     161:        (cd ${.CURDIR}/usr.bin/ranlib; \
1.15      miod      162:            ELF_TOOLCHAIN=no \
1.1       espie     163:            MAKEOBJDIR=obj.${MACHINE}.${TARGET} ${MAKE} NOMAN= depend all; \
1.15      miod      164:            ELF_TOOLCHAIN=no \
1.1       espie     165:            DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
                    166:            ${MAKE} NOMAN= install)
                    167:        ln -sf ${CROSSDIR}/usr/bin/ranlib \
1.2       espie     168:            ${CROSSDIR}/usr/${TARGET_CANON}/bin/ranlib
1.1       espie     169:        (cd ${.CURDIR}/usr.bin/strip; \
                    170:            MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
1.2       espie     171:            ${MAKE} TARGET_MACHINE_ARCH=${TARGET_ARCH} \
1.1       espie     172:            NOMAN= depend all; \
                    173:            DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
1.2       espie     174:            ${MAKE} TARGET_MACHINE_ARCH=${TARGET_ARCH} \
1.1       espie     175:            NOMAN= install)
                    176:        ln -sf ${CROSSDIR}/usr/bin/strip \
1.2       espie     177:            ${CROSSDIR}/usr/${TARGET_CANON}/bin/strip
1.1       espie     178: .endif
                    179:        @for cmd in ${BINUTILS}; do \
                    180:         if [ ! -e ${CROSSDIR}/usr/bin/$$cmd -a \
1.2       espie     181:         -e ${CROSSDIR}/usr/bin/${TARGET_CANON}-$$cmd ]; then \
                    182:            ln -sf ${TARGET_CANON}-$$cmd ${CROSSDIR}/usr/bin/$$cmd ;\
1.1       espie     183:         elif [ -e ${CROSSDIR}/usr/bin/$$cmd -a \
1.2       espie     184:         ! -e ${CROSSDIR}/usr/bin/${TARGET_CANON}-$$cmd ]; then \
                    185:            ln -sf $$cmd ${CROSSDIR}/usr/bin/${TARGET_CANON}-$$cmd; \
1.1       espie     186:         fi ;\
                    187:         if [ -e ${CROSSDIR}/usr/bin/$$cmd -a \
1.2       espie     188:         ! -e ${CROSSDIR}/usr/${TARGET_CANON}/bin/$$cmd ]; then \
1.1       espie     189:            ln -sf ${CROSSDIR}/usr/bin/$$cmd \
1.2       espie     190:                ${CROSSDIR}/usr/${TARGET_CANON}/bin/$$cmd; \
1.1       espie     191:         fi ;\
                    192:        done
                    193:        @touch ${CROSSBINUTILS}
                    194:
                    195: # bsd.own.mk can't do it for us
1.11      miod      196: .if ${TARGET_ARCH} == "alpha" || \
                    197:     ${TARGET_ARCH} == "m68k" || ${TARGET_ARCH} == "m88k" || \
                    198:     ${TARGET_ARCH} == "sparc" || ${TARGET_ARCH} == "vax"
1.6       mickey    199: TARGET_USE_GCC3=No
                    200: .else
1.3       espie     201: TARGET_USE_GCC3=Yes
1.1       espie     202: .endif
                    203:
                    204: ${CROSSGCC}:           ${CROSSBINUTILS}
1.3       espie     205: .if ${TARGET_USE_GCC3:L} == "yes"
1.1       espie     206:        (cd ${.CURDIR}/gnu/usr.bin/gcc; \
                    207:            MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
1.2       espie     208:            TARGET_ARCH=${TARGET_ARCH} CROSSDIR=${CROSSDIR} \
1.1       espie     209:            ${MAKE} -f Makefile.bsd-wrapper depend && \
                    210:            MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
1.2       espie     211:            TARGET_ARCH=${TARGET_ARCH} CROSSDIR=${CROSSDIR} \
1.1       espie     212:            ${MAKE} -f Makefile.bsd-wrapper all && \
                    213:            DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
                    214:            ${MAKE} -f Makefile.bsd-wrapper install)
1.2       espie     215:        ln -sf ${TARGET_CANON}-g++ ${CROSSDIR}/usr/bin/c++
1.1       espie     216:        ln -sf ${CROSSDIR}/usr/libexec/cpp \
                    217:            ${CROSSDIR}/usr/bin/cpp
                    218: .else
                    219:        (cd ${CROSSDIR}/usr/obj/gnu/egcs/gcc; \
                    220:            /bin/sh ${.CURDIR}/gnu/egcs/gcc/configure \
                    221:            --with-gnu-as --with-gnu-ld --prefix ${CROSSDIR}/usr \
1.2       espie     222:            --target ${TARGET_CANON} \
1.1       espie     223:            --enable-languages="c,c++" --enable-cpp --disable-nls \
                    224:            --with-gxx-include-dir=${CROSSDIR}/usr/include/g++ && \
                    225:            PATH=${CROSSPATH} ${MAKE} BISON=yacc LANGUAGES="${CROSSLANGS}" \
                    226:            CFLAGS="${CFLAGS} -I${.CURDIR}/gnu/lib/libiberty/include" \
                    227:            LIBIBERTY_INCLUDES=${.CURDIR}/gnu/lib/libiberty/include \
                    228:            DEMANGLER_PROG= DEMANGLE_H= LDFLAGS="${LDSTATIC}" build_infodir=. \
                    229:            GCC_FOR_TARGET="./xgcc -B./ -I${CROSSDIR}/usr/include" && \
                    230:            ${MAKE} BISON=yacc LANGUAGES="${CROSSLANGS}" LDFLAGS="${LDSTATIC}" \
                    231:            GCC_FOR_TARGET="./xgcc -B./ -I${CROSSDIR}/usr/include" \
                    232:            CFLAGS="${CFLAGS} -I${.CURDIR}/gnu/lib/libiberty/include" \
                    233:            LIBIBERTY_INCLUDES=${.CURDIR}/gnu/lib/libiberty/include \
                    234:            build_infodir=. INSTALL_MAN= INSTALL_HEADERS_DIR= install)
1.2       espie     235:        ln -sf ${TARGET_CANON}-gcc ${CROSSDIR}/usr/bin/cc
                    236:        ln -sf ${TARGET_CANON}-g++ ${CROSSDIR}/usr/bin/c++
1.1       espie     237:        ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
                    238:            ${CROSSDIR}/usr/obj/gnu/egcs/gcc/cpp \
                    239:            ${CROSSDIR}/usr/libexec/cpp
                    240:        sed -e 's#/usr/libexec/cpp#${CROSSDIR}/usr/libexec/cpp#' \
                    241:            -e 's#/usr/include#${CROSSDIR}/usr/include#' \
1.9       miod      242:            -e 's/@dollaropt@/-$$/' \
1.1       espie     243:            ${.CURDIR}/usr.bin/cpp/cpp.sh > ${CROSSDIR}/usr/bin/cpp
                    244:        chmod ${BINMODE} ${CROSSDIR}/usr/bin/cpp
                    245:        chown ${BINOWN}:${BINGRP} ${CROSSDIR}/usr/bin/cpp
                    246: .endif
                    247:        @touch ${CROSSGCC}
                    248:
                    249: # XXX MAKEOBJDIR maybe should be obj.${TARGET} here, revisit later
                    250: cross-lib:     ${CROSSGCC}
1.2       espie     251:        MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH}; \
1.1       espie     252:        export MACHINE MACHINE_ARCH; \
                    253:        (cd ${.CURDIR}/lib; \
                    254:            for lib in csu libc; do \
                    255:            (cd $$lib; \
                    256:                eval ${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
1.13      grange    257:                    ${MAKE} WANTLINT=no depend all install); \
1.1       espie     258:            done; \
                    259:            eval ${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
                    260:                SKIPDIR=\"${NO_CROSS} libocurses/PSD.doc\" \
1.13      grange    261:                ${MAKE} WANTLINT=no depend all install)
1.1       espie     262:
                    263: cross-bin:     ${CROSSOBJ}
1.2       espie     264:        MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH}; \
1.1       espie     265:        export MACHINE MACHINE_ARCH; \
                    266:        for i in libexec bin sbin usr.bin usr.sbin; do \
                    267:        (cd ${.CURDIR}/$$i; \
                    268:            eval ${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
                    269:                SKIPDIR=\"${BINUTILS} ${NO_CROSS}\" \
                    270:                ${MAKE} depend all install); \
                    271:        done
                    272:
                    273: cross-etc-root-var:    ${CROSSOBJ}
                    274:        (cd ${.CURDIR}/etc && \
1.12      drahn     275:            MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \
1.1       espie     276:            DESTDIR=${CROSSDIR} ${MAKE} distribution-etc-root-var)
                    277:
                    278: cross-depend:
                    279:        @(cd ${.CURDIR} && \
                    280:            BSDOBJDIR=${CROSSDIR}/usr/obj \
                    281:            BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
                    282:            SKIPDIR="${NO_CROSS}" \
                    283:            ${MAKE} depend)
                    284:
                    285: cross-clean:
                    286:        @(cd ${.CURDIR} && \
                    287:            BSDOBJDIR=${CROSSDIR}/usr/obj \
                    288:            BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
                    289:            SKIPDIR="${NO_CROSS}" \
                    290:            ${MAKE} clean)
                    291:
                    292: cross-cleandir:
                    293:        @(cd ${.CURDIR} && \
                    294:            BSDOBJDIR=${CROSSDIR}/usr/obj \
                    295:            BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
                    296:            SKIPDIR="${NO_CROSS}" \
                    297:            ${MAKE} cleandir)