2021-12-14 19:22:07 +03:00
|
|
|
# $NetBSD: sys.mk,v 1.148 2021/12/14 16:22:07 christos Exp $
|
1997-03-29 11:02:45 +03:00
|
|
|
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
|
2013-01-17 19:27:50 +04:00
|
|
|
#
|
|
|
|
# This file contains the basic rules for make(1) and is read first
|
|
|
|
# Do not put conditionals that are set on different files here and
|
|
|
|
# expect them to work.
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-03-29 11:02:45 +03:00
|
|
|
unix?= We run NetBSD.
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2003-11-09 02:14:45 +03:00
|
|
|
.SUFFIXES: .a .o .ln .s .S .c .cc .cpp .cxx .C .f .F .r .p .l .y .sh
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
.LIBS: .a
|
|
|
|
|
1995-09-25 02:49:06 +03:00
|
|
|
AR?= ar
|
|
|
|
ARFLAGS?= rl
|
|
|
|
RANLIB?= ranlib
|
2019-12-20 07:04:25 +03:00
|
|
|
MV?= mv -f
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1995-09-25 02:49:06 +03:00
|
|
|
AS?= as
|
|
|
|
AFLAGS?=
|
2011-05-20 18:27:48 +04:00
|
|
|
COMPILE.s?= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} -c
|
2021-03-24 01:02:44 +03:00
|
|
|
LINK.s?= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${LDSTATIC} ${LDFLAGS}
|
2011-01-13 02:12:10 +03:00
|
|
|
_ASM_TRADITIONAL_CPP= -x assembler-with-cpp
|
2011-05-20 18:27:48 +04:00
|
|
|
COMPILE.S?= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} ${_ASM_TRADITIONAL_CPP} -c
|
2021-03-24 01:02:44 +03:00
|
|
|
LINK.S?= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${LDSTATIC} ${LDFLAGS}
|
|
|
|
COMPILE_LINK.S?=${LINK.S} ${CPPFLAGS}
|
1994-07-06 08:12:24 +04:00
|
|
|
|
1995-09-25 02:49:06 +03:00
|
|
|
CC?= cc
|
2011-10-31 18:20:11 +04:00
|
|
|
.if ${MACHINE_ARCH} == "sh3el" || ${MACHINE_ARCH} == "sh3eb"
|
2008-05-07 02:19:11 +04:00
|
|
|
# -O2 is too -falign-* zealous for low-memory sh3 machines
|
|
|
|
DBG?= -Os -freorder-blocks
|
2011-10-31 18:20:11 +04:00
|
|
|
.elif ${MACHINE_ARCH} == "m68k" || ${MACHINE_ARCH} == "m68000"
|
2014-06-29 09:20:15 +04:00
|
|
|
# -freorder-blocks (enabled by -O2) produces much bigger code
|
|
|
|
DBG?= -O2 -fno-reorder-blocks
|
2013-07-19 02:06:09 +04:00
|
|
|
.elif ${MACHINE_ARCH} == "coldfire"
|
|
|
|
DBG?= -O1
|
1998-11-22 16:48:34 +03:00
|
|
|
.else
|
2011-10-31 18:20:11 +04:00
|
|
|
DBG?= -O2
|
1998-11-22 16:48:34 +03:00
|
|
|
.endif
|
2018-02-25 21:53:23 +03:00
|
|
|
.if ${MKDTRACE:Uno} != "no"
|
|
|
|
DTRACE_OPTS?= -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-ipa-sra -fno-ipa-icf
|
|
|
|
.endif
|
2000-05-02 07:44:36 +04:00
|
|
|
CFLAGS?= ${DBG}
|
2006-06-25 19:04:31 +04:00
|
|
|
LDFLAGS?=
|
2018-02-25 21:53:23 +03:00
|
|
|
COMPILE.c?= ${CC} ${CFLAGS} ${DTRACE_OPTS} ${CPPFLAGS} -c
|
2021-03-24 01:02:44 +03:00
|
|
|
LINK.c?= ${CC} ${CFLAGS} ${LDSTATIC} ${LDFLAGS}
|
|
|
|
COMPILE_LINK.c?=${LINK.c} ${CPPFLAGS}
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2010-03-02 23:49:18 +03:00
|
|
|
# C Type Format data is required for DTrace
|
2013-03-06 15:19:08 +04:00
|
|
|
CTFFLAGS ?= -g -L VERSION
|
2015-07-06 03:21:51 +03:00
|
|
|
CTFMFLAGS ?= -t -g -L VERSION
|
2020-11-09 19:15:05 +03:00
|
|
|
OBJECT_TARGET ?= -o ${.TARGET}${defined(CTFCONVERT):?.o:}
|
2021-03-23 00:52:26 +03:00
|
|
|
EXEC_TARGET ?= -o ${.TARGET}
|
2020-11-09 19:15:05 +03:00
|
|
|
CTFCONVERT_RUN ?= ${defined(CTFCONVERT):?${CTFCONVERT} ${CTFFLAGS} -o ${.TARGET} ${.TARGET}.o && rm -f ${.TARGET}.o:}
|
2010-03-02 23:49:18 +03:00
|
|
|
|
1998-04-09 04:45:10 +04:00
|
|
|
CXX?= c++
|
2018-06-22 14:25:03 +03:00
|
|
|
# Strip flags unsupported by C++ compilers
|
|
|
|
# Remove -Wsystem-headers because C++ headers aren't clean of warnings
|
2018-06-20 05:15:13 +03:00
|
|
|
CXXFLAGS?= ${CFLAGS:N-Wno-traditional:N-Wstrict-prototypes:N-Wmissing-prototypes:N-Wno-pointer-sign:N-ffreestanding:N-std=gnu[0-9][0-9]:N-Wold-style-definition:N-Wno-format-zero-length:N-Wsystem-headers}
|
2007-01-23 00:49:07 +03:00
|
|
|
|
2018-07-10 19:53:16 +03:00
|
|
|
# Use the sources, as the seed... Normalize all paths...
|
2008-08-04 20:02:25 +04:00
|
|
|
__ALLSRC1= ${empty(DESTDIR):?${.ALLSRC}:${.ALLSRC:S|^${DESTDIR}|^destdir|}}
|
|
|
|
__ALLSRC2= ${empty(MAKEOBJDIR):?${__ALLSRC1}:${__ALLSRC1:S|^${MAKEOBJDIR}|^obj|}}
|
|
|
|
__ALLSRC3= ${empty(NETBSDSRCDIR):?${__ALLSRC2}:${__ALLSRC2:S|^${NETBSDSRCDIR}|^src|}}
|
2018-05-20 17:39:53 +03:00
|
|
|
__ALLSRC4= ${empty(X11SRCDIR):?${__ALLSRC3}:${__ALLSRC3:S|^${X11SRCDIR}|^xsrc|}}
|
2018-07-10 19:53:16 +03:00
|
|
|
# Skip paths that contain relative components and can't be normalized, sort..
|
|
|
|
__INITSEED= ${__ALLSRC4:N*/../*:O}
|
|
|
|
|
|
|
|
__BUILDSEED= ${BUILDSEED}/${__INITSEED}/${.TARGET}
|
2011-04-07 05:40:32 +04:00
|
|
|
_CXXSEED?= ${BUILDSEED:D-frandom-seed=${__BUILDSEED:hash}}
|
2008-08-04 20:02:25 +04:00
|
|
|
|
2018-08-13 16:07:04 +03:00
|
|
|
COMPILE.cc?= ${CXX} ${_CXXSEED} ${CXXFLAGS} ${DTRACE_OPTS} ${CPPFLAGS} -c
|
2021-03-24 01:02:44 +03:00
|
|
|
LINK.cc?= ${CXX} ${CXXFLAGS} ${LDSTATIC} ${LDFLAGS}
|
|
|
|
COMPILE_LINK.cc?=${LINK.cc} ${CPPFLAGS}
|
1993-06-17 07:48:59 +04:00
|
|
|
|
1997-10-28 15:40:16 +03:00
|
|
|
OBJC?= ${CC}
|
|
|
|
OBJCFLAGS?= ${CFLAGS}
|
|
|
|
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
|
2021-03-24 01:02:44 +03:00
|
|
|
LINK.m?= ${OBJC} ${OBJCFLAGS} ${LDSTATIC} ${LDFLAGS}
|
|
|
|
LINK.m?= ${LINK.m} ${CPPFLAGS}
|
1997-10-28 15:40:16 +03:00
|
|
|
|
1995-09-25 02:49:06 +03:00
|
|
|
CPP?= cpp
|
2003-07-18 08:04:03 +04:00
|
|
|
CPPFLAGS?=
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1995-09-25 02:49:06 +03:00
|
|
|
FC?= f77
|
1997-03-29 11:02:45 +03:00
|
|
|
FFLAGS?= -O
|
1995-09-25 02:49:06 +03:00
|
|
|
RFLAGS?=
|
|
|
|
COMPILE.f?= ${FC} ${FFLAGS} -c
|
2021-03-24 01:02:44 +03:00
|
|
|
LINK.f?= ${FC} ${FFLAGS} ${LDSTATIC} ${LDFLAGS}
|
|
|
|
COMPILE_LINK.f?=${LINK.f} ${CPPFLAGS}
|
1995-09-25 02:49:06 +03:00
|
|
|
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
|
2021-03-24 01:02:44 +03:00
|
|
|
LINK.F?= ${FC} ${FFLAGS} ${LDSTATIC} ${LDFLAGS}
|
|
|
|
COMPILE_LINK.F?=${LINK.F} ${CPPFLAGS}
|
1995-09-25 02:49:06 +03:00
|
|
|
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
|
2021-03-24 01:02:44 +03:00
|
|
|
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDSTATIC} ${LDFLAGS}
|
|
|
|
COMPILE_LINK.r?=${LINK.r}
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1996-10-18 06:33:38 +04:00
|
|
|
INSTALL?= install
|
|
|
|
|
2003-11-08 08:33:37 +03:00
|
|
|
LD?= ld
|
|
|
|
|
1995-09-25 02:49:06 +03:00
|
|
|
LEX?= lex
|
|
|
|
LFLAGS?=
|
|
|
|
LEX.l?= ${LEX} ${LFLAGS}
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1995-09-25 02:49:06 +03:00
|
|
|
LINT?= lint
|
2019-04-07 22:32:24 +03:00
|
|
|
LINTFLAGS?= -chapbrxzgFS
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-11-05 00:12:41 +03:00
|
|
|
LORDER?= lorder
|
|
|
|
|
1995-09-25 02:49:06 +03:00
|
|
|
MAKE?= make
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-11-05 00:12:41 +03:00
|
|
|
NM?= nm
|
|
|
|
|
1995-09-25 02:49:06 +03:00
|
|
|
PC?= pc
|
|
|
|
PFLAGS?=
|
|
|
|
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
|
|
|
|
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1995-09-25 02:49:06 +03:00
|
|
|
SHELL?= sh
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-11-05 00:12:41 +03:00
|
|
|
SIZE?= size
|
|
|
|
|
|
|
|
TSORT?= tsort -q
|
|
|
|
|
1995-09-25 02:49:06 +03:00
|
|
|
YACC?= yacc
|
1998-04-09 04:32:31 +04:00
|
|
|
YFLAGS?=
|
1995-09-25 02:49:06 +03:00
|
|
|
YACC.y?= ${YACC} ${YFLAGS}
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1994-03-24 19:01:24 +03:00
|
|
|
# C
|
1994-03-24 04:39:28 +03:00
|
|
|
.c:
|
2021-03-24 01:02:44 +03:00
|
|
|
${COMPILE_LINK.c} ${EXEC_TARGET} ${.IMPSRC} ${LDLIBS}
|
1994-03-24 19:01:24 +03:00
|
|
|
.c.o:
|
2020-11-09 19:15:05 +03:00
|
|
|
${COMPILE.c} ${.IMPSRC} ${OBJECT_TARGET}
|
|
|
|
${CTFCONVERT_RUN}
|
1994-03-24 19:01:24 +03:00
|
|
|
.c.a:
|
|
|
|
${COMPILE.c} ${.IMPSRC}
|
2003-07-27 13:35:47 +04:00
|
|
|
${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
|
|
|
|
rm -f ${.PREFIX}.o
|
1995-06-24 12:27:37 +04:00
|
|
|
.c.ln:
|
2004-01-27 06:31:48 +03:00
|
|
|
${LINT} ${LINTFLAGS} \
|
2021-12-14 19:22:07 +03:00
|
|
|
${CPPFLAGS:C/-([IDUW]) */-\1/Wg:M-[IDUW]*} \
|
2004-01-27 06:31:48 +03:00
|
|
|
-i ${.IMPSRC}
|
1994-03-24 04:39:28 +03:00
|
|
|
|
1994-03-24 19:01:24 +03:00
|
|
|
# C++
|
1999-11-13 17:53:09 +03:00
|
|
|
.cc .cpp .cxx .C:
|
2021-03-24 01:02:44 +03:00
|
|
|
${COMPILE_LINK.cc} ${EXEC_TARGET} ${.IMPSRC} ${LDLIBS}
|
1999-11-13 17:53:09 +03:00
|
|
|
.cc.o .cpp.o .cxx.o .C.o:
|
2020-11-09 19:15:05 +03:00
|
|
|
${COMPILE.cc} ${.IMPSRC} ${OBJECT_TARGET}
|
|
|
|
${CTFCONVERT_RUN}
|
1999-11-13 17:53:09 +03:00
|
|
|
.cc.a .cpp.a .cxx.a .C.a:
|
1994-03-24 19:01:24 +03:00
|
|
|
${COMPILE.cc} ${.IMPSRC}
|
2003-07-27 13:35:47 +04:00
|
|
|
${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
|
|
|
|
rm -f ${.PREFIX}.o
|
1993-12-29 21:44:36 +03:00
|
|
|
|
1994-03-24 19:01:24 +03:00
|
|
|
# Fortran/Ratfor
|
|
|
|
.f:
|
2021-03-24 01:02:44 +03:00
|
|
|
${COMPILE_LINK.f} ${EXEC_TARGET} ${.IMPSRC} ${LDLIBS}
|
1994-03-24 19:01:24 +03:00
|
|
|
.f.o:
|
2020-11-09 19:15:05 +03:00
|
|
|
${COMPILE.f} ${.IMPSRC} ${OBJECT_TARGET}
|
|
|
|
${CTFCONVERT_RUN}
|
1994-03-24 19:01:24 +03:00
|
|
|
.f.a:
|
|
|
|
${COMPILE.f} ${.IMPSRC}
|
2003-07-27 13:35:47 +04:00
|
|
|
${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
|
|
|
|
rm -f ${.PREFIX}.o
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1994-03-24 19:01:24 +03:00
|
|
|
.F:
|
2021-03-24 01:02:44 +03:00
|
|
|
${COMPILE_LINK.F} ${EXEC_TARGET} ${.IMPSRC} ${LDLIBS}
|
1994-03-24 19:01:24 +03:00
|
|
|
.F.o:
|
2020-11-09 19:15:05 +03:00
|
|
|
${COMPILE.F} ${.IMPSRC} ${OBJECT_TARGET}
|
|
|
|
${CTFCONVERT_RUN}
|
1994-03-24 19:01:24 +03:00
|
|
|
.F.a:
|
|
|
|
${COMPILE.F} ${.IMPSRC}
|
2003-07-27 13:35:47 +04:00
|
|
|
${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
|
|
|
|
rm -f ${.PREFIX}.o
|
1993-07-17 16:09:51 +04:00
|
|
|
|
1994-03-24 19:01:24 +03:00
|
|
|
.r:
|
2021-03-24 01:02:44 +03:00
|
|
|
${COMPILE_LINK.r} ${EXEC_TARGET} ${.IMPSRC} ${LDLIBS}
|
1994-03-24 19:01:24 +03:00
|
|
|
.r.o:
|
2020-11-09 19:15:05 +03:00
|
|
|
${COMPILE.r} ${.IMPSRC} ${OBJECT_TARGET}
|
|
|
|
${CTFCONVERT_RUN}
|
1994-03-24 19:01:24 +03:00
|
|
|
.r.a:
|
|
|
|
${COMPILE.r} ${.IMPSRC}
|
2003-07-27 13:35:47 +04:00
|
|
|
${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
|
|
|
|
rm -f ${.PREFIX}.o
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1994-03-24 19:01:24 +03:00
|
|
|
# Pascal
|
|
|
|
.p:
|
2021-03-24 01:02:44 +03:00
|
|
|
${COMPILE_LINK.p} ${EXEC_TARGET} ${.IMPSRC} ${LDLIBS}
|
1993-12-29 21:44:36 +03:00
|
|
|
.p.o:
|
2020-11-09 19:15:05 +03:00
|
|
|
${COMPILE.p} ${.IMPSRC} ${OBJECT_TARGET}
|
|
|
|
${CTFCONVERT_RUN}
|
1994-03-24 19:01:24 +03:00
|
|
|
.p.a:
|
|
|
|
${COMPILE.p} ${.IMPSRC}
|
2003-07-27 13:35:47 +04:00
|
|
|
${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
|
|
|
|
rm -f ${.PREFIX}.o
|
1993-12-29 21:44:36 +03:00
|
|
|
|
1994-03-24 19:01:24 +03:00
|
|
|
# Assembly
|
|
|
|
.s:
|
2021-03-24 01:02:44 +03:00
|
|
|
${COMPILE_LINK.s} ${EXEC_TARGET} ${.IMPSRC} ${LDLIBS}
|
1993-03-21 12:45:37 +03:00
|
|
|
.s.o:
|
2020-11-09 19:15:05 +03:00
|
|
|
${COMPILE.s} ${.IMPSRC} ${OBJECT_TARGET}
|
|
|
|
${CTFCONVERT_RUN}
|
1994-03-24 19:01:24 +03:00
|
|
|
.s.a:
|
|
|
|
${COMPILE.s} ${.IMPSRC}
|
2003-07-27 13:35:47 +04:00
|
|
|
${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
|
|
|
|
rm -f ${.PREFIX}.o
|
1994-03-24 19:01:24 +03:00
|
|
|
.S:
|
2021-03-24 01:02:44 +03:00
|
|
|
${COMPILE_LINK.S} ${EXEC_TARGET} ${.IMPSRC} ${LDLIBS}
|
1993-09-08 17:13:46 +04:00
|
|
|
.S.o:
|
2020-11-09 19:15:05 +03:00
|
|
|
${COMPILE.S} ${.IMPSRC} ${OBJECT_TARGET}
|
|
|
|
${CTFCONVERT_RUN}
|
1994-03-24 19:01:24 +03:00
|
|
|
.S.a:
|
|
|
|
${COMPILE.S} ${.IMPSRC}
|
2003-07-27 13:35:47 +04:00
|
|
|
${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
|
|
|
|
rm -f ${.PREFIX}.o
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1994-03-24 19:01:24 +03:00
|
|
|
# Lex
|
|
|
|
.l:
|
|
|
|
${LEX.l} ${.IMPSRC}
|
2021-03-24 01:02:44 +03:00
|
|
|
${COMPILE_LINK.c} ${EXEC_TARGET} lex.yy.c ${LDLIBS} -ll
|
1994-03-24 19:01:24 +03:00
|
|
|
rm -f lex.yy.c
|
|
|
|
.l.c:
|
|
|
|
${LEX.l} ${.IMPSRC}
|
2019-01-22 00:11:54 +03:00
|
|
|
${MV} lex.yy.c ${.TARGET}
|
1993-03-21 12:45:37 +03:00
|
|
|
.l.o:
|
1994-03-24 19:01:24 +03:00
|
|
|
${LEX.l} ${.IMPSRC}
|
2020-11-09 19:15:05 +03:00
|
|
|
${COMPILE.c} ${OBJECT_TARGET} lex.yy.c
|
|
|
|
${CTFCONVERT_RUN}
|
1993-03-21 12:45:37 +03:00
|
|
|
rm -f lex.yy.c
|
|
|
|
|
1994-03-24 19:01:24 +03:00
|
|
|
# Yacc
|
|
|
|
.y:
|
|
|
|
${YACC.y} ${.IMPSRC}
|
2021-03-24 01:02:44 +03:00
|
|
|
${COMPILE_LINK.c} ${EXEC_TARGET} y.tab.c ${LDLIBS}
|
1994-03-24 19:01:24 +03:00
|
|
|
rm -f y.tab.c
|
1993-03-21 12:45:37 +03:00
|
|
|
.y.c:
|
1994-03-24 19:01:24 +03:00
|
|
|
${YACC.y} ${.IMPSRC}
|
2019-01-22 00:11:54 +03:00
|
|
|
${MV} y.tab.c ${.TARGET}
|
1994-03-24 19:01:24 +03:00
|
|
|
.y.o:
|
|
|
|
${YACC.y} ${.IMPSRC}
|
2020-11-09 19:15:05 +03:00
|
|
|
${COMPILE.c} ${OBJECT_TARGET} y.tab.c
|
|
|
|
${CTFCONVERT_RUN}
|
1993-03-21 12:45:37 +03:00
|
|
|
rm -f y.tab.c
|
|
|
|
|
1994-03-24 19:01:24 +03:00
|
|
|
# Shell
|
|
|
|
.sh:
|
|
|
|
rm -f ${.TARGET}
|
|
|
|
cp ${.IMPSRC} ${.TARGET}
|
2003-11-08 08:33:37 +03:00
|
|
|
chmod a+x ${.TARGET}
|