Add source-file-specific variables in <bsd.lib.mk> and <bsd.prog.mk>:
COPTS.<fn> Additional flags to the compiler when creating the C objects for <fn>. CPUFLAGS.<fn> Additional flags to the compiler/assembler for <fn>. CPPFLAGS.<fn> Additional flags to the C pre-processor for <fn>. (For <fn>.[ly], "<fn>.c" must be used.)
This commit is contained in:
parent
ed5f36a260
commit
29c0479a2a
@ -1,4 +1,4 @@
|
||||
# $NetBSD: bsd.README,v 1.124 2003/07/22 04:23:28 lukem Exp $
|
||||
# $NetBSD: bsd.README,v 1.125 2003/07/22 06:53:21 lukem Exp $
|
||||
# @(#)bsd.README 8.2 (Berkeley) 4/2/94
|
||||
|
||||
This is the README file for the new make "include" files for the BSD
|
||||
@ -700,11 +700,21 @@ CLEANFILES Additional files to remove for the clean and cleandir targets.
|
||||
|
||||
COPTS Additional flags to the compiler when creating C objects.
|
||||
|
||||
COPTS.<fn> Additional flags to the compiler when creating the
|
||||
C objects for <fn>.
|
||||
For <fn>.[ly], "<fn>.c" must be used.
|
||||
|
||||
CPUFLAGS Additional flags to the compiler/assembler to select
|
||||
CPU instruction set options, CPU tuning options, etc.
|
||||
|
||||
CPUFLAGS.<fn> Additional flags to the compiler/assembler for <fn>.
|
||||
For <fn>.[ly], "<fn>.c" must be used.
|
||||
|
||||
CPPFLAGS Additional flags to the C pre-processor.
|
||||
|
||||
CPPFLAGS.<fn> Additional flags to the C pre-processor for <fn>.
|
||||
For <fn>.[ly], "<fn>.c" must be used.
|
||||
|
||||
GDBINIT List of GDB initialization files to add to "source"
|
||||
directives in the .gdbinit file that is created in the
|
||||
objdir.
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: bsd.lib.mk,v 1.223 2003/07/20 17:01:58 lukem Exp $
|
||||
# $NetBSD: bsd.lib.mk,v 1.224 2003/07/22 06:53:22 lukem Exp $
|
||||
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
|
||||
|
||||
.include <bsd.init.mk>
|
||||
@ -162,36 +162,36 @@ FFLAGS+= ${FOPTS}
|
||||
|
||||
.c.o:
|
||||
.if defined(COPTS) && !empty(COPTS:M*-g*)
|
||||
${COMPILE.c} ${.IMPSRC}
|
||||
${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
|
||||
.else
|
||||
@echo ${COMPILE.c:Q} ${.IMPSRC}
|
||||
@${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o
|
||||
@echo ${COMPILE.c:Q} ${COPTS.${.IMPSRC:T}:Q} ${CPUFLAGS.${.IMPSRC:T}:Q} ${CPPFLAGS.${.IMPSRC:T}:Q} ${.IMPSRC}
|
||||
@${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}.o
|
||||
@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
|
||||
@rm -f ${.TARGET}.o
|
||||
.endif
|
||||
|
||||
.c.po:
|
||||
.if defined(COPTS) && !empty(COPTS:M*-g*)
|
||||
${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}
|
||||
${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
|
||||
.else
|
||||
@echo ${COMPILE.c:Q} -pg ${.IMPSRC} -o ${.TARGET}
|
||||
@${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}.o
|
||||
@echo ${COMPILE.c:Q} ${COPTS.${.IMPSRC:T}:Q} ${CPUFLAGS.${.IMPSRC:T}:Q} ${CPPFLAGS.${.IMPSRC:T}:Q} -pg ${.IMPSRC} -o ${.TARGET}
|
||||
@${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}.o
|
||||
@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
|
||||
@rm -f ${.TARGET}.o
|
||||
.endif
|
||||
|
||||
.c.so:
|
||||
.if defined(COPTS) && !empty(COPTS:M*-g*)
|
||||
${COMPILE.c} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
|
||||
${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
|
||||
.else
|
||||
@echo ${COMPILE.c:Q} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
|
||||
@${COMPILE.c} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}.o
|
||||
@echo ${COMPILE.c:Q} ${COPTS.${.IMPSRC:T}:Q} ${CPUFLAGS.${.IMPSRC:T}:Q} ${CPPFLAGS.${.IMPSRC:T}:Q} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
|
||||
@${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}.o
|
||||
@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
|
||||
@rm -f ${.TARGET}.o
|
||||
.endif
|
||||
|
||||
.c.ln:
|
||||
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
|
||||
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} ${CPPFLAGS.${.IMPSRC:T}:M-[-IDU]*} -i ${.IMPSRC}
|
||||
|
||||
.cc.o .cpp.o .cxx.o .C.o:
|
||||
.if defined(COPTS) && !empty(COPTS:M*-g*)
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: bsd.sys.mk,v 1.92 2003/07/20 14:36:12 lukem Exp $
|
||||
# $NetBSD: bsd.sys.mk,v 1.93 2003/07/22 06:53:23 lukem Exp $
|
||||
#
|
||||
# Build definitions used for NetBSD source tree builds.
|
||||
|
||||
@ -130,7 +130,15 @@ TOOL_UUDECODE?= uudecode
|
||||
TOOL_VGRIND?= vgrind -f
|
||||
TOOL_ZIC?= zic
|
||||
|
||||
.SUFFIXES: .m .o .ln .lo
|
||||
.SUFFIXES: .c .m .o .ln .lo
|
||||
|
||||
# C
|
||||
.c:
|
||||
${LINK.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
|
||||
.c.o:
|
||||
${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
|
||||
.c.ln:
|
||||
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} ${CPPFLAGS.${.IMPSRC:T}:M-[IDU]*} -i ${.IMPSRC}
|
||||
|
||||
# Objective C
|
||||
# (Defined here rather than in <sys.mk> because `.m' is not just
|
||||
@ -154,7 +162,7 @@ LFLAGS+= -P${LPREFIX}
|
||||
.l.o: # remove to force use of .l.c->.c.o transforms
|
||||
.l:
|
||||
${LEX.l} -o${.TARGET:R}.${LPREFIX}.c ${.IMPSRC}
|
||||
${LINK.c} -o ${.TARGET} ${.TARGET:R}.${LPREFIX}.c ${LDLIBS} -ll
|
||||
${LINK.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}}-o ${.TARGET} ${.TARGET:R}.${LPREFIX}.c ${LDLIBS} -ll
|
||||
rm -f ${.TARGET:R}.${LPREFIX}.c
|
||||
.l.c:
|
||||
${LEX.l} -o${.TARGET} ${.IMPSRC}
|
||||
@ -165,7 +173,7 @@ YFLAGS+= ${YPREFIX:D-p${YPREFIX}} ${YHEADER:D-d}
|
||||
.y.o: # remove to force use of .y.c->.c.o transforms
|
||||
.y:
|
||||
${YACC.y} -b ${.TARGET:R} ${.IMPSRC}
|
||||
${LINK.c} -o ${.TARGET} ${.TARGET:R}.tab.c ${LDLIBS}
|
||||
${LINK.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}}-o ${.TARGET} ${.TARGET:R}.tab.c ${LDLIBS}
|
||||
rm -f ${.TARGET:R}.tab.[ch]
|
||||
.y.c:
|
||||
${YACC.y} -o ${.TARGET} ${.IMPSRC}
|
||||
|
Loading…
Reference in New Issue
Block a user