Add mk and h files needed for cross compilation
This commit is contained in:
83
share/mk/bsd.clean.mk
Normal file
83
share/mk/bsd.clean.mk
Normal file
@@ -0,0 +1,83 @@
|
||||
# $NetBSD: bsd.clean.mk,v 1.5 2011/11/22 18:25:48 apb Exp $
|
||||
|
||||
# <bsd.clean.mk>
|
||||
#
|
||||
# Public targets:
|
||||
#
|
||||
# clean: Delete files listed in ${CLEANFILES}.
|
||||
# cleandir: Delete files listed in ${CLEANFILES} and ${CLEANDIRFILES}.
|
||||
#
|
||||
# Public variables:
|
||||
#
|
||||
# CLEANFILES Files to remove for both the clean and cleandir targets.
|
||||
#
|
||||
# CLEANDIRFILES Files to remove for the cleandir target, but not for
|
||||
# the clean target.
|
||||
#
|
||||
# MKCLEANSRC Whether or not to clean the source directory
|
||||
# in addition to the object directory.
|
||||
#
|
||||
# MKCLEANVERIFY Whether or not to verify that the file deletion worked.
|
||||
#
|
||||
|
||||
.if !defined(_BSD_CLEAN_MK_)
|
||||
_BSD_CLEAN_MK_=1
|
||||
|
||||
.include <bsd.init.mk>
|
||||
|
||||
MKCLEANSRC?= yes
|
||||
MKCLEANVERIFY?= yes
|
||||
|
||||
clean: .PHONY __doclean
|
||||
__doclean: .PHONY .MADE __cleanuse CLEANFILES
|
||||
cleandir: .PHONY clean __docleandir
|
||||
__docleandir: .PHONY .MADE __cleanuse CLEANDIRFILES
|
||||
|
||||
# __cleanuse is invoked with ${.ALLSRC} as the name of a variable
|
||||
# (such as CLEANFILES or CLEANDIRFILES), or possibly a list of
|
||||
# variable names. ${.ALLSRC:@v@${${v}}@} will be the list of
|
||||
# files to delete. (We pass the variable name, e.g. CLEANFILES,
|
||||
# instead of the file names, e.g. ${CLEANFILES}, because we don't
|
||||
# want make to replace any of the file names with the result of
|
||||
# searching .PATH.)
|
||||
#
|
||||
# If the list of files is empty, then the commands
|
||||
# reduce to "true", with an "@" prefix to prevent echoing.
|
||||
#
|
||||
# The use of :M* is needed to handle the case that CLEANFILES
|
||||
# or CLEANDIRFILES is not completely empty but contains spaces.
|
||||
# This can easily happen when CLEANFILES or CLEANDIRFILES is set
|
||||
# from other variables that happen to be empty.)
|
||||
#
|
||||
# The use of :Q is needed to handle the case that CLEANFILES
|
||||
# or CLEANDIRFILES contains quoted strings, such as
|
||||
# CLEANFILES = "filename with spaces".
|
||||
#
|
||||
__cleanuse: .USE
|
||||
.if 0 # print "# clean CLEANFILES" for debugging
|
||||
${"${.ALLSRC:@v@${${v}:M*}@:Q}" == "":?@true:${_MKMSG} \
|
||||
"clean" ${.ALLSRC} }
|
||||
.endif
|
||||
.for _d in ${"${.OBJDIR}" == "${.CURDIR}" || "${MKCLEANSRC}" == "no" \
|
||||
:? ${.OBJDIR} \
|
||||
: ${.OBJDIR} ${.CURDIR} }
|
||||
${"${.ALLSRC:@v@${${v}:M*}@:Q}" == "":?@true: \
|
||||
(cd ${_d} && rm -f ${.ALLSRC:@v@${${v}}@} || true) }
|
||||
.if "${MKCLEANVERIFY}" == "yes"
|
||||
@${"${.ALLSRC:@v@${${v}:M*}@:Q}" == "":?true: \
|
||||
bad="\$(cd ${_d} && ls -d ${.ALLSRC:@v@${${v}}@} 2>/dev/null)"; \
|
||||
if test -n "\$bad"; then \
|
||||
echo "Failed to remove files from ${_d}:" ; \
|
||||
echo "\$bad" ; \
|
||||
false ; \
|
||||
fi }
|
||||
.endif
|
||||
.endfor
|
||||
|
||||
# Don't automatically load ".depend" files during "make clean"
|
||||
# or "make cleandir".
|
||||
.if make(clean) || make(cleandir)
|
||||
.MAKE.DEPENDFILE := .depend.no-such-file
|
||||
.endif
|
||||
|
||||
.endif # !defined(_BSD_CLEAN_MK)
|
||||
57
share/mk/bsd.hostlib.mk
Normal file
57
share/mk/bsd.hostlib.mk
Normal file
@@ -0,0 +1,57 @@
|
||||
# $NetBSD: bsd.hostlib.mk,v 1.16 2011/09/10 16:57:35 apb Exp $
|
||||
|
||||
.include <bsd.init.mk>
|
||||
.include <bsd.sys.mk>
|
||||
|
||||
##### Basic targets
|
||||
|
||||
##### Default values
|
||||
CFLAGS+= ${COPTS}
|
||||
HOST_MKDEP?= CC=${HOST_CC:Q} mkdep
|
||||
MKDEP_SUFFIXES?= .o .lo
|
||||
|
||||
# Override these:
|
||||
MKDEP:= ${HOST_MKDEP}
|
||||
|
||||
.if ${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN)
|
||||
OBJHOSTMACHINE= # set
|
||||
.endif
|
||||
|
||||
##### Build rules
|
||||
.if defined(HOSTLIB)
|
||||
_YHLSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
|
||||
DPSRCS+= ${_YHLSRCS}
|
||||
CLEANFILES+= ${_YHLSRCS}
|
||||
.endif # defined(HOSTLIB)
|
||||
|
||||
.if !empty(SRCS:N*.h:N*.sh)
|
||||
OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.lo/g}
|
||||
.endif
|
||||
|
||||
.if defined(OBJS) && !empty(OBJS)
|
||||
.NOPATH: lib${HOSTLIB}.a ${OBJS} ${_YHLSRCS}
|
||||
|
||||
${OBJS}: ${DPSRCS}
|
||||
|
||||
lib${HOSTLIB}.a: ${OBJS} ${DPADD}
|
||||
${_MKTARGET_BUILD}
|
||||
rm -f ${.TARGET}
|
||||
${HOST_AR} cq ${.TARGET} ${OBJS}
|
||||
${HOST_RANLIB} ${.TARGET}
|
||||
|
||||
.endif # defined(OBJS) && !empty(OBJS)
|
||||
|
||||
realall: lib${HOSTLIB}.a
|
||||
|
||||
CLEANFILES+= a.out [Ee]rrs mklog core *.core lib${HOSTLIB}.a ${OBJS}
|
||||
|
||||
beforedepend:
|
||||
CFLAGS:= ${HOST_CFLAGS}
|
||||
CPPFLAGS:= ${HOST_CPPFLAGS}
|
||||
|
||||
##### Pull in related .mk logic
|
||||
.include <bsd.obj.mk>
|
||||
.include <bsd.dep.mk>
|
||||
.include <bsd.clean.mk>
|
||||
|
||||
${TARGETS}: # ensure existence
|
||||
165
share/mk/bsd.hostprog.mk
Normal file
165
share/mk/bsd.hostprog.mk
Normal file
@@ -0,0 +1,165 @@
|
||||
# $NetBSD: bsd.hostprog.mk,v 1.67 2012/02/29 20:07:57 tron Exp $
|
||||
# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
|
||||
|
||||
.include <bsd.init.mk>
|
||||
.include <bsd.sys.mk>
|
||||
|
||||
##### Basic targets
|
||||
|
||||
##### Default values
|
||||
LIBATF_C?= /usr/lib/libatf-c.a
|
||||
LIBATF_CXX?= /usr/lib/libatf-c++.a
|
||||
LIBBLUETOOTH?= /usr/lib/libbluetooth.a
|
||||
LIBBZ2?= /usr/lib/libbz2.a
|
||||
LIBC?= /usr/lib/libc.a
|
||||
LIBC_PIC?= /usr/lib/libc_pic.a
|
||||
LIBC_SO?= /usr/lib/libc.so
|
||||
LIBCOMPAT?= /usr/lib/libcompat.a
|
||||
LIBCRYPT?= /usr/lib/libcrypt.a
|
||||
LIBCURSES?= /usr/lib/libcurses.a
|
||||
LIBDBM?= /usr/lib/libdbm.a
|
||||
LIBDES?= /usr/lib/libdes.a
|
||||
LIBEDIT?= /usr/lib/libedit.a
|
||||
LIBEVENT?= /usr/lib/libevent.a
|
||||
LIBEXPAT?= /usr/lib/libexpat.a
|
||||
LIBFETCH?= /usr/lib/libfetch.a
|
||||
LIBFORM?= /usr/lib/libform.a
|
||||
LIBGCC?= /usr/lib/libgcc.a
|
||||
LIBGNUMALLOC?= /usr/lib/libgnumalloc.a
|
||||
LIBINTL?= /usr/lib/libintl.a
|
||||
LIBIPSEC?= /usr/lib/libipsec.a
|
||||
LIBKVM?= /usr/lib/libkvm.a
|
||||
LIBL?= /usr/lib/libl.a
|
||||
LIBLZMA?= /usr/lib/liblzma.a
|
||||
LIBM?= /usr/lib/libm.a
|
||||
LIBMAGIC?= /usr/lib/libmagic.a
|
||||
LIBMENU?= /usr/lib/libmenu.a
|
||||
LIBMP?= /usr/lib/libmp.a
|
||||
LIBNTP?= /usr/lib/libntp.a
|
||||
LIBOBJC?= /usr/lib/libobjc.a
|
||||
LIBP2K?= /usr/lib/libp2k.a
|
||||
LIBPC?= /usr/lib/libpc.a
|
||||
LIBPCAP?= /usr/lib/libpcap.a
|
||||
LIBPCI?= /usr/lib/libpci.a
|
||||
LIBPLOT?= /usr/lib/libplot.a
|
||||
LIBPOSIX?= /usr/lib/libposix.a
|
||||
LIBPUFFS?= /usr/lib/libpuffs.a
|
||||
LIBQUOTA?= /usr/lib/libquota.a
|
||||
LIBRESOLV?= /usr/lib/libresolv.a
|
||||
LIBRPCSVC?= /usr/lib/librpcsvc.a
|
||||
LIBRUMP?= /usr/lib/librump.a
|
||||
LIBRUMPCLIENT?= /usr/lib/librumpclient.a
|
||||
LIBRUMPNET?= /usr/lib/librumpnet.a
|
||||
LIBRUMPUSER?= /usr/lib/librumpuser.a
|
||||
LIBRUMPVFS?= /usr/lib/librumpvfs.a
|
||||
LIBSKEY?= /usr/lib/libskey.a
|
||||
LIBSQLITE3?= /usr/lib/libsqlite3.a
|
||||
LIBSSP?= /usr/lib/libssp.a
|
||||
LIBSTDCXX?= /usr/lib/libstdc++.a
|
||||
LIBSUPCXX?= /usr/lib/libsupc++.a
|
||||
LIBTERMINFO?= /usr/lib/libterminfo.a
|
||||
LIBUTIL?= /usr/lib/libutil.a
|
||||
LIBWRAP?= /usr/lib/libwrap.a
|
||||
LIBUKFS?= /usr/lib/libukfs.a
|
||||
LIBY?= /usr/lib/liby.a
|
||||
LIBZ?= /usr/lib/libz.a
|
||||
|
||||
##### rump file system modules
|
||||
LIBRUMPFS_CD9660FS?= /usr/lib/librumpfs_cd9660fs.a
|
||||
LIBRUMPFS_EFS?= /usr/lib/librumpfs_efs.a
|
||||
LIBRUMPFS_EXT2FS?= /usr/lib/librumpfs_ext2fs.a
|
||||
LIBRUMPFS_FFS?= /usr/lib/librumpfs_ffs.a
|
||||
LIBRUMPFS_HFS?= /usr/lib/librumpfs_hfs.a
|
||||
LIBRUMPFS_LFS?= /usr/lib/librumpfs_lfs.a
|
||||
LIBRUMPFS_MSDOSFS?= /usr/lib/librumpfs_msdosfs.a
|
||||
LIBRUMPFS_NTFS?= /usr/lib/librumpfs_ntfs.a
|
||||
LIBRUMPFS_SYSPUFFS?= /usr/lib/librumpfs_syspuffs.a
|
||||
LIBRUMPFS_TMPFS?= /usr/lib/librumpfs_tmpfs.a
|
||||
LIBRUMPFS_UDF?= /usr/lib/librumpfs_udf.a
|
||||
LIBRUMPFS_UFS?= /usr/lib/librumpfs_ufs.a
|
||||
|
||||
HOST_MKDEP?= CC=${HOST_CC:Q} mkdep
|
||||
MKDEP_SUFFIXES?= .lo .ln
|
||||
|
||||
# Override these:
|
||||
INSTALL:= ${INSTALL:NSTRIP=*}
|
||||
MKDEP:= ${HOST_MKDEP}
|
||||
|
||||
.if ${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN)
|
||||
OBJHOSTMACHINE= # set
|
||||
.endif
|
||||
|
||||
##### Build rules
|
||||
.if defined(HOSTPROG_CXX)
|
||||
HOSTPROG= ${HOSTPROG_CXX}
|
||||
.endif
|
||||
|
||||
.if defined(HOSTPROG)
|
||||
SRCS?= ${HOSTPROG}.c
|
||||
|
||||
_YHPSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
|
||||
DPSRCS+= ${_YHPSRCS}
|
||||
CLEANFILES+= ${_YHPSRCS}
|
||||
|
||||
.if !empty(SRCS:N*.h:N*.sh)
|
||||
OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.lo/g}
|
||||
LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
|
||||
.endif
|
||||
|
||||
.if defined(OBJS) && !empty(OBJS)
|
||||
.NOPATH: ${OBJS} ${HOSTPROG} ${_YHPSRCS}
|
||||
|
||||
${OBJS} ${LOBJS}: ${DPSRCS}
|
||||
${HOSTPROG}: ${OBJS} ${DPADD}
|
||||
${_MKTARGET_LINK}
|
||||
${HOST_LINK.c} ${HOST_LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}
|
||||
|
||||
.endif # defined(OBJS) && !empty(OBJS)
|
||||
|
||||
.if !defined(MAN)
|
||||
MAN= ${HOSTPROG}.1
|
||||
.endif # !defined(MAN)
|
||||
.endif # defined(HOSTPROG)
|
||||
|
||||
realall: ${HOSTPROG}
|
||||
|
||||
CLEANFILES+= a.out [Ee]rrs mklog core *.core ${HOSTPROG} ${OBJS} ${LOBJS}
|
||||
|
||||
beforedepend:
|
||||
CFLAGS:= ${HOST_CFLAGS}
|
||||
CPPFLAGS:= ${HOST_CPPFLAGS:N-Wp,-iremap,*}
|
||||
|
||||
lint: ${LOBJS}
|
||||
.if defined(LOBJS) && !empty(LOBJS)
|
||||
${LINT} ${LINTFLAGS} ${LDFLAGS:C/-L[ ]*/-L/Wg:M-L*} ${LOBJS} ${LDADD}
|
||||
.endif
|
||||
|
||||
##### Pull in related .mk logic
|
||||
LINKSMODE?= ${BINMODE}
|
||||
.include <bsd.man.mk>
|
||||
.include <bsd.nls.mk>
|
||||
.include <bsd.files.mk>
|
||||
.include <bsd.inc.mk>
|
||||
.include <bsd.links.mk>
|
||||
.include <bsd.dep.mk>
|
||||
.include <bsd.clean.mk>
|
||||
|
||||
${TARGETS}: # ensure existence
|
||||
|
||||
# Override YACC/LEX rules so nbtool_config.h can be forced as the 1st include
|
||||
.l.c:
|
||||
${_MKTARGET_LEX}
|
||||
${LEX.l} -o${.TARGET} ${.IMPSRC}
|
||||
echo '#if HAVE_NBTOOL_CONFIG_H' > ${.TARGET}.1
|
||||
echo '#include "nbtool_config.h"' >> ${.TARGET}.1
|
||||
echo '#endif' >> ${.TARGET}.1
|
||||
cat ${.TARGET} >> ${.TARGET}.1
|
||||
mv ${.TARGET}.1 ${.TARGET}
|
||||
.y.c:
|
||||
${_MKTARGET_YACC}
|
||||
${YACC.y} -o ${.TARGET} ${.IMPSRC}
|
||||
echo '#if HAVE_NBTOOL_CONFIG_H' > ${.TARGET}.1
|
||||
echo '#include "nbtool_config.h"' >> ${.TARGET}.1
|
||||
echo '#endif' >> ${.TARGET}.1
|
||||
cat ${.TARGET} >> ${.TARGET}.1
|
||||
mv ${.TARGET}.1 ${.TARGET}
|
||||
26
share/mk/bsd.kernobj.mk
Normal file
26
share/mk/bsd.kernobj.mk
Normal file
@@ -0,0 +1,26 @@
|
||||
# $NetBSD: bsd.kernobj.mk,v 1.13 2010/01/25 00:43:00 christos Exp $
|
||||
|
||||
# KERNSRCDIR Is the location of the top of the kernel src.
|
||||
# It defaults to `${NETBSDSRCDIR}/sys'.
|
||||
#
|
||||
# KERNARCHDIR Is the location of the machine dependent kernel sources.
|
||||
# It defaults to `arch/${MACHINE}', but may be overridden
|
||||
# in case ${MACHINE} is not correct.
|
||||
#
|
||||
# KERNCONFDIR Is where the configuration files for kernels are found.
|
||||
# It defaults to `${KERNSRCDIR}/${KERNARCHDIR}/conf'.
|
||||
#
|
||||
# KERNOBJDIR Is the kernel build directory. The kernel GENERIC for
|
||||
# instance will be compiled in ${KERNOBJDIR}/GENERIC.
|
||||
# The default is the .OBJDIR of
|
||||
# `${KERNSRCDIR}/${KERNARCHDIR}/compile'.
|
||||
#
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
KERNSRCDIR?= ${NETBSDSRCDIR}/sys
|
||||
KERNARCHDIR?= arch/${MACHINE}
|
||||
KERNCONFDIR?= ${KERNSRCDIR}/${KERNARCHDIR}/conf
|
||||
.if !defined(KERNOBJDIR) && exists(${KERNSRCDIR}/${KERNARCHDIR}/compile)
|
||||
KERNOBJDIR!= cd "${KERNSRCDIR}/${KERNARCHDIR}/compile" && ${PRINTOBJDIR}
|
||||
.endif
|
||||
71
share/mk/bsd.nls.mk
Normal file
71
share/mk/bsd.nls.mk
Normal file
@@ -0,0 +1,71 @@
|
||||
# $NetBSD: bsd.nls.mk,v 1.47 2011/09/10 16:57:35 apb Exp $
|
||||
|
||||
.include <bsd.init.mk>
|
||||
|
||||
##### Basic targets
|
||||
realinstall: nlsinstall
|
||||
|
||||
##### Default values
|
||||
NLSNAME?= ${PROG:Ulib${LIB}}
|
||||
|
||||
NLS?=
|
||||
|
||||
##### Build rules
|
||||
.if ${MKNLS} != "no"
|
||||
|
||||
NLSALL= ${NLS:.msg=.cat}
|
||||
|
||||
realall: ${NLSALL}
|
||||
.NOPATH: ${NLSALL}
|
||||
|
||||
.SUFFIXES: .cat .msg
|
||||
|
||||
.msg.cat:
|
||||
@rm -f ${.TARGET}
|
||||
${_MKTARGET_CREATE}
|
||||
${TOOL_GENCAT} ${.TARGET} ${.IMPSRC}
|
||||
|
||||
.endif # ${MKNLS} != "no"
|
||||
|
||||
##### Install rules
|
||||
nlsinstall:: # ensure existence
|
||||
.PHONY: nlsinstall
|
||||
|
||||
.if ${MKNLS} != "no"
|
||||
|
||||
__nlsinstall: .USE
|
||||
${_MKTARGET_INSTALL}
|
||||
${INSTALL_FILE} -o ${NLSOWN} -g ${NLSGRP} -m ${NLSMODE} \
|
||||
${.ALLSRC} ${.TARGET}
|
||||
|
||||
.for F in ${NLSALL:O:u}
|
||||
_F:= ${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat # installed path
|
||||
|
||||
.if ${MKUPDATE} == "no"
|
||||
${_F}! ${F} __nlsinstall # install rule
|
||||
.if !defined(BUILD) && !make(all) && !make(${F})
|
||||
${_F}! .MADE # no build at install
|
||||
.endif
|
||||
.else
|
||||
${_F}: ${F} __nlsinstall # install rule
|
||||
.if !defined(BUILD) && !make(all) && !make(${F})
|
||||
${_F}: .MADE # no build at install
|
||||
.endif
|
||||
.endif
|
||||
|
||||
nlsinstall:: ${_F}
|
||||
.PRECIOUS: ${_F} # keep if install fails
|
||||
.endfor
|
||||
|
||||
.undef _F
|
||||
.endif # ${MKNLS} != "no"
|
||||
|
||||
##### Clean rules
|
||||
.if ${MKNLS} != "no" && !empty(NLS)
|
||||
CLEANDIRFILES+= ${NLSALL}
|
||||
.endif
|
||||
|
||||
##### Pull in related .mk logic
|
||||
.include <bsd.obj.mk>
|
||||
.include <bsd.sys.mk>
|
||||
.include <bsd.clean.mk>
|
||||
Reference in New Issue
Block a user