1999-08-28 00:22:10 +00:00
|
|
|
# $FreeBSD$
|
1996-05-25 23:09:49 +00:00
|
|
|
#
|
|
|
|
# The include file <bsd.dep.mk> handles Makefile dependencies.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# +++ variables +++
|
|
|
|
#
|
2002-10-17 13:48:13 +00:00
|
|
|
# CTAGS A tags file generation program [gtags]
|
|
|
|
#
|
|
|
|
# CTAGSFLAGS Options for ctags(1) [not set]
|
|
|
|
#
|
1996-05-25 23:09:49 +00:00
|
|
|
# DEPENDFILE dependencies file [.depend]
|
|
|
|
#
|
2002-10-17 13:48:13 +00:00
|
|
|
# GTAGSFLAGS Options for gtags(1) [-o]
|
|
|
|
#
|
|
|
|
# HTAGSFLAGS Options for htags(1) [not set]
|
|
|
|
#
|
1996-05-25 23:09:49 +00:00
|
|
|
# MKDEP Options for ${MKDEPCMD} [not set]
|
|
|
|
#
|
|
|
|
# MKDEPCMD Makefile dependency list program [mkdep]
|
2005-01-06 11:12:43 +00:00
|
|
|
#
|
1996-05-25 23:09:49 +00:00
|
|
|
# SRCS List of source files (c, c++, assembler)
|
|
|
|
#
|
2004-01-13 17:37:45 +00:00
|
|
|
# DPSRCS List of source files which are needed for generating
|
|
|
|
# dependencies, ${SRCS} are always part of it.
|
1996-05-25 23:09:49 +00:00
|
|
|
#
|
|
|
|
# +++ targets +++
|
|
|
|
#
|
|
|
|
# cleandepend:
|
|
|
|
# Remove depend and tags file
|
|
|
|
#
|
|
|
|
# depend:
|
|
|
|
# Make the dependencies for the source files, and store
|
|
|
|
# them in the file ${DEPENDFILE}.
|
|
|
|
#
|
|
|
|
# tags:
|
2002-10-17 13:48:13 +00:00
|
|
|
# In "ctags" mode, create a tags file for the source files.
|
|
|
|
# In "gtags" mode, create a (GLOBAL) gtags file for the
|
|
|
|
# source files. If HTML is defined, htags(1) is also run
|
|
|
|
# after gtags(1).
|
1996-05-25 23:09:49 +00:00
|
|
|
|
2002-04-22 10:04:41 +00:00
|
|
|
.if !target(__<bsd.init.mk>__)
|
|
|
|
.error bsd.dep.mk cannot be included directly.
|
|
|
|
.endif
|
1996-04-01 18:58:28 +00:00
|
|
|
|
2002-10-17 13:48:13 +00:00
|
|
|
CTAGS?= gtags
|
|
|
|
CTAGSFLAGS?=
|
|
|
|
GTAGSFLAGS?= -o
|
|
|
|
HTAGSFLAGS?=
|
|
|
|
|
2002-04-15 15:23:45 +00:00
|
|
|
.if ${CC} != "cc"
|
2014-10-21 19:56:45 +00:00
|
|
|
MKDEPCMD?= CC='${CC} ${DEPFLAGS}' mkdep
|
2002-04-15 15:23:45 +00:00
|
|
|
.else
|
|
|
|
MKDEPCMD?= mkdep
|
|
|
|
.endif
|
1996-04-01 18:58:28 +00:00
|
|
|
DEPENDFILE?= .depend
|
1994-08-04 21:10:08 +00:00
|
|
|
|
2002-10-17 13:48:13 +00:00
|
|
|
# Keep `tags' here, before SRCS are mangled below for `depend'.
|
2004-12-21 09:43:25 +00:00
|
|
|
.if !target(tags) && defined(SRCS) && !defined(NO_TAGS)
|
2002-10-17 13:48:13 +00:00
|
|
|
tags: ${SRCS}
|
2010-01-18 15:58:02 +00:00
|
|
|
.if ${CTAGS:T} == "gtags"
|
2002-10-17 13:48:13 +00:00
|
|
|
@cd ${.CURDIR} && ${CTAGS} ${GTAGSFLAGS} ${.OBJDIR}
|
|
|
|
.if defined(HTML)
|
|
|
|
@cd ${.CURDIR} && htags ${HTAGSFLAGS} -d ${.OBJDIR} ${.OBJDIR}
|
|
|
|
.endif
|
2010-01-18 15:58:02 +00:00
|
|
|
.else
|
|
|
|
@${CTAGS} ${CTAGSFLAGS} -f /dev/stdout \
|
|
|
|
${.ALLSRC:N*.h} | sed "s;${.CURDIR}/;;" > ${.TARGET}
|
2002-10-17 13:48:13 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
1998-05-11 15:37:13 +00:00
|
|
|
.if defined(SRCS)
|
|
|
|
CLEANFILES?=
|
|
|
|
|
2004-01-17 18:51:55 +00:00
|
|
|
.if !exists(${.OBJDIR}/${DEPENDFILE})
|
2014-08-11 21:42:06 +00:00
|
|
|
.for _S in ${SRCS:N*.[dhly]}
|
2004-01-17 18:51:55 +00:00
|
|
|
${_S:R}.o: ${_S}
|
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
|
2014-07-05 20:08:35 +00:00
|
|
|
# Lexical analyzers
|
1998-05-11 15:37:13 +00:00
|
|
|
.for _LSRC in ${SRCS:M*.l:N*/*}
|
2004-01-12 15:29:47 +00:00
|
|
|
.for _LC in ${_LSRC:R}.c
|
1998-05-11 15:37:13 +00:00
|
|
|
${_LC}: ${_LSRC}
|
2014-07-20 14:49:24 +00:00
|
|
|
${LEX} ${LFLAGS} -o${.TARGET} ${.ALLSRC}
|
2004-01-17 18:51:55 +00:00
|
|
|
.if !exists(${.OBJDIR}/${DEPENDFILE})
|
|
|
|
${_LC:R}.o: ${_LC}
|
|
|
|
.endif
|
1998-05-11 15:37:13 +00:00
|
|
|
SRCS:= ${SRCS:S/${_LSRC}/${_LC}/}
|
2004-01-12 15:29:47 +00:00
|
|
|
CLEANFILES+= ${_LC}
|
1998-05-11 15:37:13 +00:00
|
|
|
.endfor
|
|
|
|
.endfor
|
|
|
|
|
2014-07-05 20:08:35 +00:00
|
|
|
# Yacc grammars
|
1998-05-11 15:37:13 +00:00
|
|
|
.for _YSRC in ${SRCS:M*.y:N*/*}
|
2004-01-12 15:29:47 +00:00
|
|
|
.for _YC in ${_YSRC:R}.c
|
1998-05-11 15:37:13 +00:00
|
|
|
SRCS:= ${SRCS:S/${_YSRC}/${_YC}/}
|
2004-01-12 15:29:47 +00:00
|
|
|
CLEANFILES+= ${_YC}
|
2004-01-27 23:22:15 +00:00
|
|
|
.if !empty(YFLAGS:M-d) && !empty(SRCS:My.tab.h)
|
1998-05-11 15:37:13 +00:00
|
|
|
.ORDER: ${_YC} y.tab.h
|
|
|
|
${_YC} y.tab.h: ${_YSRC}
|
|
|
|
${YACC} ${YFLAGS} ${.ALLSRC}
|
|
|
|
cp y.tab.c ${_YC}
|
2004-01-12 15:29:47 +00:00
|
|
|
CLEANFILES+= y.tab.c y.tab.h
|
2004-01-27 23:22:15 +00:00
|
|
|
.elif !empty(YFLAGS:M-d)
|
2004-01-12 15:29:47 +00:00
|
|
|
.for _YH in ${_YC:R}.h
|
2012-08-22 19:25:57 +00:00
|
|
|
${_YH}: ${_YC}
|
|
|
|
${_YC}: ${_YSRC}
|
1998-05-11 15:37:13 +00:00
|
|
|
${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC}
|
2004-01-12 15:29:47 +00:00
|
|
|
SRCS+= ${_YH}
|
|
|
|
CLEANFILES+= ${_YH}
|
1998-05-11 15:37:13 +00:00
|
|
|
.endfor
|
|
|
|
.else
|
|
|
|
${_YC}: ${_YSRC}
|
|
|
|
${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC}
|
|
|
|
.endif
|
2004-01-17 18:51:55 +00:00
|
|
|
.if !exists(${.OBJDIR}/${DEPENDFILE})
|
|
|
|
${_YC:R}.o: ${_YC}
|
|
|
|
.endif
|
1998-05-11 15:37:13 +00:00
|
|
|
.endfor
|
|
|
|
.endfor
|
2014-07-05 20:08:35 +00:00
|
|
|
|
|
|
|
# DTrace probe definitions
|
2014-07-12 00:54:34 +00:00
|
|
|
.if ${SRCS:M*.d}
|
2014-09-02 23:43:06 +00:00
|
|
|
CFLAGS+= -I${.OBJDIR}
|
2014-07-12 00:54:34 +00:00
|
|
|
.endif
|
2014-07-05 20:08:35 +00:00
|
|
|
.for _DSRC in ${SRCS:M*.d:N*/*}
|
2014-07-12 00:54:34 +00:00
|
|
|
.for _D in ${_DSRC:R}
|
2014-08-13 01:27:51 +00:00
|
|
|
DHDRS+= ${_D}.h
|
2014-07-12 00:54:34 +00:00
|
|
|
${_D}.h: ${_DSRC}
|
2015-04-08 02:43:05 +00:00
|
|
|
${DTRACE} ${DTRACEFLAGS} -h -s ${.ALLSRC}
|
2014-10-21 04:30:00 +00:00
|
|
|
SRCS:= ${SRCS:S/^${_DSRC}$//}
|
2014-07-12 01:06:29 +00:00
|
|
|
OBJS+= ${_D}.o
|
2014-08-10 06:43:40 +00:00
|
|
|
CLEANFILES+= ${_D}.h ${_D}.o
|
2014-10-21 04:30:00 +00:00
|
|
|
${_D}.o: ${_DSRC} ${OBJS:S/^${_D}.o$//}
|
2015-04-08 02:43:05 +00:00
|
|
|
${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC}
|
2014-08-10 06:43:40 +00:00
|
|
|
.if defined(LIB)
|
|
|
|
CLEANFILES+= ${_D}.So ${_D}.po
|
2014-10-21 04:30:00 +00:00
|
|
|
${_D}.So: ${_DSRC} ${SOBJS:S/^${_D}.So$//}
|
2015-04-08 02:43:05 +00:00
|
|
|
${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC}
|
2014-10-21 04:30:00 +00:00
|
|
|
${_D}.po: ${_DSRC} ${POBJS:S/^${_D}.po$//}
|
2015-04-08 02:43:05 +00:00
|
|
|
${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC}
|
2014-07-12 00:54:34 +00:00
|
|
|
.endif
|
2014-07-05 20:08:35 +00:00
|
|
|
.endfor
|
|
|
|
.endfor
|
2014-08-13 01:27:51 +00:00
|
|
|
beforedepend: ${DHDRS}
|
|
|
|
beforebuild: ${DHDRS}
|
1998-05-11 15:37:13 +00:00
|
|
|
.endif
|
|
|
|
|
2012-08-22 19:25:57 +00:00
|
|
|
.if ${MK_META_MODE} == "yes"
|
|
|
|
.include <meta.autodep.mk>
|
|
|
|
# this depend: bypasses that below
|
|
|
|
# the dependency helps when bootstrapping
|
|
|
|
depend: beforedepend ${DPSRCS} ${SRCS} afterdepend
|
|
|
|
beforedepend:
|
|
|
|
afterdepend: beforedepend
|
|
|
|
.endif
|
|
|
|
|
1994-08-04 21:10:08 +00:00
|
|
|
.if !target(depend)
|
|
|
|
.if defined(SRCS)
|
2002-04-23 09:03:56 +00:00
|
|
|
depend: beforedepend ${DEPENDFILE} afterdepend
|
1996-04-01 18:58:28 +00:00
|
|
|
|
2012-08-22 19:25:57 +00:00
|
|
|
# Tell bmake not to look for generated files via .PATH
|
|
|
|
.NOPATH: ${DEPENDFILE}
|
|
|
|
|
1998-03-07 13:57:37 +00:00
|
|
|
# Different types of sources are compiled with slightly different flags.
|
|
|
|
# Split up the sources, and filter out headers and non-applicable flags.
|
2012-08-23 17:03:33 +00:00
|
|
|
MKDEP_CFLAGS= ${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BIDU]*} ${CFLAGS:M-std=*} \
|
|
|
|
${CFLAGS:M-ansi}
|
|
|
|
MKDEP_CXXFLAGS= ${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BIDU]*} \
|
|
|
|
${CXXFLAGS:M-std=*} ${CXXFLAGS:M-ansi} ${CXXFLAGS:M-stdlib=*}
|
This are the build infrastructure changes to allow to use the
Intel C/C++ compiler (lang/icc) to build the kernel.
The icc CPUTYPE CFLAGS use icc v7 syntax, icc v8 moans about them, but
doesn't abort. They also produce CPU specific code (new instructions
of the CPU, not only CPU specific scheduling), so if you get coredumps
with signal 4 (SIGILL, illegal instruction) you've used the wrong
CPUTYPE.
Incarnations of this patch survive gcc compiles and my make universe.
I use it on my desktop.
To use it update share/mk, add
/usr/local/intel/compiler70/ia32/bin (icc v7, works)
or
/usr/local/intel_cc_80/bin (icc v8, doesn't work)
to your PATH, make sure you have a new kernel compile directory
(e.g. MYKERNEL_icc) and run
CFLAGS="-O2 -ip" CC=icc make depend
CFLAGS="-O2 -ip" CC=icc make
in it.
Don't compile with -ipo, the build infrastructure uses ld directly to
link the kernel and the modules, but -ipo needs the link step to be
performed with Intel's linker.
Problems with icc v8:
- panic: npx0 cannot be emulated on an SMP system
- UP: first start of /bin/sh results in a FP exception
Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.
Reviewed by: silence on -arch
Submitted by: netchild
2004-03-12 21:36:12 +00:00
|
|
|
|
2004-01-13 17:37:45 +00:00
|
|
|
DPSRCS+= ${SRCS}
|
|
|
|
${DEPENDFILE}: ${DPSRCS}
|
1996-04-01 18:58:28 +00:00
|
|
|
rm -f ${DEPENDFILE}
|
2004-01-27 23:22:15 +00:00
|
|
|
.if !empty(DPSRCS:M*.[cS])
|
1998-03-07 13:57:37 +00:00
|
|
|
${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
|
This are the build infrastructure changes to allow to use the
Intel C/C++ compiler (lang/icc) to build the kernel.
The icc CPUTYPE CFLAGS use icc v7 syntax, icc v8 moans about them, but
doesn't abort. They also produce CPU specific code (new instructions
of the CPU, not only CPU specific scheduling), so if you get coredumps
with signal 4 (SIGILL, illegal instruction) you've used the wrong
CPUTYPE.
Incarnations of this patch survive gcc compiles and my make universe.
I use it on my desktop.
To use it update share/mk, add
/usr/local/intel/compiler70/ia32/bin (icc v7, works)
or
/usr/local/intel_cc_80/bin (icc v8, doesn't work)
to your PATH, make sure you have a new kernel compile directory
(e.g. MYKERNEL_icc) and run
CFLAGS="-O2 -ip" CC=icc make depend
CFLAGS="-O2 -ip" CC=icc make
in it.
Don't compile with -ipo, the build infrastructure uses ld directly to
link the kernel and the modules, but -ipo needs the link step to be
performed with Intel's linker.
Problems with icc v8:
- panic: npx0 cannot be emulated on an SMP system
- UP: first start of /bin/sh results in a FP exception
Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.
Reviewed by: silence on -arch
Submitted by: netchild
2004-03-12 21:36:12 +00:00
|
|
|
${MKDEP_CFLAGS} ${.ALLSRC:M*.[cS]}
|
1996-04-01 18:58:28 +00:00
|
|
|
.endif
|
2004-01-27 23:22:15 +00:00
|
|
|
.if !empty(DPSRCS:M*.cc) || !empty(DPSRCS:M*.C) || !empty(DPSRCS:M*.cpp) || \
|
|
|
|
!empty(DPSRCS:M*.cxx)
|
1996-04-01 18:58:28 +00:00
|
|
|
${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
|
This are the build infrastructure changes to allow to use the
Intel C/C++ compiler (lang/icc) to build the kernel.
The icc CPUTYPE CFLAGS use icc v7 syntax, icc v8 moans about them, but
doesn't abort. They also produce CPU specific code (new instructions
of the CPU, not only CPU specific scheduling), so if you get coredumps
with signal 4 (SIGILL, illegal instruction) you've used the wrong
CPUTYPE.
Incarnations of this patch survive gcc compiles and my make universe.
I use it on my desktop.
To use it update share/mk, add
/usr/local/intel/compiler70/ia32/bin (icc v7, works)
or
/usr/local/intel_cc_80/bin (icc v8, doesn't work)
to your PATH, make sure you have a new kernel compile directory
(e.g. MYKERNEL_icc) and run
CFLAGS="-O2 -ip" CC=icc make depend
CFLAGS="-O2 -ip" CC=icc make
in it.
Don't compile with -ipo, the build infrastructure uses ld directly to
link the kernel and the modules, but -ipo needs the link step to be
performed with Intel's linker.
Problems with icc v8:
- panic: npx0 cannot be emulated on an SMP system
- UP: first start of /bin/sh results in a FP exception
Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.
Reviewed by: silence on -arch
Submitted by: netchild
2004-03-12 21:36:12 +00:00
|
|
|
${MKDEP_CXXFLAGS} \
|
1998-06-05 18:38:55 +00:00
|
|
|
${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cpp} ${.ALLSRC:M*.cxx}
|
1996-04-01 18:58:28 +00:00
|
|
|
.endif
|
1997-04-09 16:10:27 +00:00
|
|
|
.if target(_EXTRADEPEND)
|
2002-04-17 05:42:18 +00:00
|
|
|
_EXTRADEPEND: .USE
|
2002-04-16 12:27:07 +00:00
|
|
|
${DEPENDFILE}: _EXTRADEPEND
|
1997-04-09 16:10:27 +00:00
|
|
|
.endif
|
1996-04-01 18:58:28 +00:00
|
|
|
|
1997-10-05 09:40:24 +00:00
|
|
|
.ORDER: ${DEPENDFILE} afterdepend
|
1994-08-04 21:10:08 +00:00
|
|
|
.else
|
2002-04-23 09:03:56 +00:00
|
|
|
depend: beforedepend afterdepend
|
1994-08-04 21:10:08 +00:00
|
|
|
.endif
|
|
|
|
.if !target(beforedepend)
|
|
|
|
beforedepend:
|
1997-10-05 09:40:24 +00:00
|
|
|
.else
|
|
|
|
.ORDER: beforedepend ${DEPENDFILE}
|
|
|
|
.ORDER: beforedepend afterdepend
|
1994-08-04 21:10:08 +00:00
|
|
|
.endif
|
|
|
|
.if !target(afterdepend)
|
|
|
|
afterdepend:
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
1996-06-24 04:26:21 +00:00
|
|
|
.if !target(cleandepend)
|
2002-04-23 09:03:56 +00:00
|
|
|
cleandepend:
|
1997-08-26 16:54:33 +00:00
|
|
|
.if defined(SRCS)
|
2010-01-18 15:58:02 +00:00
|
|
|
.if ${CTAGS:T} == "gtags"
|
2002-10-17 13:48:13 +00:00
|
|
|
rm -f ${DEPENDFILE} GPATH GRTAGS GSYMS GTAGS
|
1997-04-13 06:44:25 +00:00
|
|
|
.if defined(HTML)
|
2002-10-17 13:48:13 +00:00
|
|
|
rm -rf HTML
|
|
|
|
.endif
|
2010-01-18 15:41:55 +00:00
|
|
|
.else
|
2010-01-18 15:58:02 +00:00
|
|
|
rm -f ${DEPENDFILE} tags
|
1997-04-13 06:44:25 +00:00
|
|
|
.endif
|
1996-06-24 04:26:21 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
2002-07-03 12:44:06 +00:00
|
|
|
|
|
|
|
.if !target(checkdpadd) && (defined(DPADD) || defined(LDADD))
|
2014-09-10 07:55:51 +00:00
|
|
|
_LDADD_FROM_DPADD= ${DPADD:R:T:C;^lib(.*)$;-l\1;g}
|
|
|
|
# Ignore -Wl,--start-group/-Wl,--end-group as it might be required in the
|
|
|
|
# LDADD list due to unresolved symbols
|
|
|
|
_LDADD_CANONICALIZED= ${LDADD:N:R:T:C;^lib(.*)$;-l\1;g:N-Wl,--[es]*-group}
|
2002-07-03 12:44:06 +00:00
|
|
|
checkdpadd:
|
2003-07-03 11:43:57 +00:00
|
|
|
.if ${_LDADD_FROM_DPADD} != ${_LDADD_CANONICALIZED}
|
|
|
|
@echo ${.CURDIR}
|
|
|
|
@echo "DPADD -> ${_LDADD_FROM_DPADD}"
|
|
|
|
@echo "LDADD -> ${_LDADD_CANONICALIZED}"
|
|
|
|
.endif
|
2002-07-03 12:44:06 +00:00
|
|
|
.endif
|