1 # $NetBSD: sys.mk,v 1.128 2015/07/06 00:21:51 chs Exp $
2 # @(#)sys.mk 8.2 (Berkeley) 3/21/94
4 # This file contains the basic rules for make(1) and is read first
5 # Do not put conditionals that are set on different files here and
8 # This variable should be used to differentiate Minix builds in Makefiles.
14 .SUFFIXES
: .a .o .ln .s .S .c .
cc .
cpp .
cxx .C .f .F .r .p .l .y .sh
18 .SUFFIXES
: .a .o .bc .ln .s .S .c .
cc .
cpp .
cxx .C .f .F .r .p .l .y .sh
20 .if
${MKSMALL
:U
} == "yes"
25 .if
${MKMAGIC
:Uno
} == "yes" ||
${MKASR
:Uno
} == "yes"
26 CPPFLAGS
+= -D_MINIX_MAGIC
=1
31 #LSC: Be a bit smarter about the default compiler
32 .if exists
(/usr
/pkg
/bin
/clang
) || exists
(/usr
/bin
/clang
)
36 .if exists
(/usr
/pkg
/bin
/gcc
) || exists
(/usr
/bin
/gcc
)
39 .
endif # defined(__MINIX)
49 COMPILE.s?
= ${CC} ${AFLAGS} ${AFLAGS.
${<:T
}} -c
50 LINK.s?
= ${CC} ${AFLAGS} ${AFLAGS.
${<:T
}} ${LDFLAGS}
51 _ASM_TRADITIONAL_CPP
= -x assembler-with-cpp
52 COMPILE.S?
= ${CC} ${AFLAGS} ${AFLAGS.
${<:T
}} ${CPPFLAGS} ${_ASM_TRADITIONAL_CPP} -c
53 LINK.S?
= ${CC} ${AFLAGS} ${AFLAGS.
${<:T
}} ${CPPFLAGS} ${LDFLAGS}
56 .if
${MACHINE_ARCH} == "sh3el" ||
${MACHINE_ARCH} == "sh3eb"
57 # -O2 is too -falign-* zealous for low-memory sh3 machines
58 DBG?
= -Os
-freorder-blocks
59 .elif
${MACHINE_ARCH} == "m68k" ||
${MACHINE_ARCH} == "m68000"
60 # -freorder-blocks (enabled by -O2) produces much bigger code
61 DBG?
= -O2
-fno-reorder-blocks
62 .elif
${MACHINE_ARCH} == "coldfire"
64 .elif
!empty
(MACHINE_ARCH
:Maarch64
*)
65 DBG?
= -O2
${"${.TARGET:M*.po}" == "":?
-fomit-frame-pointer
:}
66 .elif
${MACHINE_ARCH} == "vax"
67 DBG?
= -O1
-fgcse
-fstrength-reduce
-fgcse-after-reload
75 .
endif # !defined(__MINIX)
77 COMPILE.c?
= ${CC} ${CFLAGS} ${CPPFLAGS} -c
78 LINK.c?
= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
80 # C Type Format data is required for DTrace
81 CTFFLAGS ?
= -g
-L VERSION
82 CTFMFLAGS ?
= -t
-g
-L VERSION
85 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
}
87 __ALLSRC1
= ${empty
(DESTDIR
):?
${.ALLSRC
}:${.ALLSRC
:S|^
${DESTDIR}|^destdir|
}}
88 __ALLSRC2
= ${empty
(MAKEOBJDIR
):?
${__ALLSRC1}:${__ALLSRC1
:S|^
${MAKEOBJDIR}|^obj|
}}
89 __ALLSRC3
= ${empty
(NETBSDSRCDIR
):?
${__ALLSRC2}:${__ALLSRC2
:S|^
${NETBSDSRCDIR}|^src|
}}
90 __BUILDSEED
= ${BUILDSEED}/${__ALLSRC3
:O
}/${.TARGET
}
91 _CXXSEED?
= ${BUILDSEED
:D-frandom-seed
=${__BUILDSEED
:hash
}}
93 COMPILE.
cc?
= ${CXX} ${_CXXSEED} ${CXXFLAGS} ${CPPFLAGS} -c
94 LINK.
cc?
= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
98 COMPILE.m?
= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
99 LINK.m?
= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
107 COMPILE.f?
= ${FC} ${FFLAGS} -c
108 LINK.f?
= ${FC} ${FFLAGS} ${LDFLAGS}
109 COMPILE.F?
= ${FC} ${FFLAGS} ${CPPFLAGS} -c
110 LINK.F?
= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
111 COMPILE.r?
= ${FC} ${FFLAGS} ${RFLAGS} -c
112 LINK.r?
= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
120 LEX.l?
= ${LEX} ${LFLAGS}
123 LINTFLAGS?
= -chapbxzgFS
133 COMPILE.p?
= ${PC} ${PFLAGS} ${CPPFLAGS} -c
134 LINK.p?
= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
144 YACC.y?
= ${YACC} ${YFLAGS}
148 ${LINK.c
} -o
${.TARGET
} ${.IMPSRC
} ${LDLIBS}
149 # XXX: disable for now
150 # ${defined(CTFCONVERT):?${CTFCONVERT} ${CTFFLAGS} ${.TARGET}:}
152 ${COMPILE.c
} ${.IMPSRC
}
153 ${defined
(CTFCONVERT
):?
${CTFCONVERT} ${CTFFLAGS} ${.TARGET
}:}
155 ${COMPILE.c
} ${.IMPSRC
}
156 ${AR} ${ARFLAGS} ${.TARGET
} ${.PREFIX
}.o
159 ${LINT} ${LINTFLAGS} \
160 ${CPPFLAGS
:C
/-([IDU
])[ ]*/-\
1/Wg
:M-
[IDU
]*} \
165 ${LINK.
cc} -o
${.TARGET
} ${.IMPSRC
} ${LDLIBS}
166 .
cc.o .
cpp.o .
cxx.o .C.o
:
167 ${COMPILE.
cc} ${.IMPSRC
}
168 .
cc.a .
cpp.a .
cxx.a .C.a
:
169 ${COMPILE.
cc} ${.IMPSRC
}
170 ${AR} ${ARFLAGS} ${.TARGET
} ${.PREFIX
}.o
175 ${LINK.f
} -o
${.TARGET
} ${.IMPSRC
} ${LDLIBS}
177 ${COMPILE.f
} ${.IMPSRC
}
178 ${defined
(CTFCONVERT
):?
${CTFCONVERT} ${CTFFLAGS} ${.TARGET
}:}
180 ${COMPILE.f
} ${.IMPSRC
}
181 ${AR} ${ARFLAGS} ${.TARGET
} ${.PREFIX
}.o
185 ${LINK.F
} -o
${.TARGET
} ${.IMPSRC
} ${LDLIBS}
186 ${defined
(CTFCONVERT
):?
${CTFCONVERT} ${CTFFLAGS} ${.TARGET
}:}
188 ${COMPILE.F
} ${.IMPSRC
}
189 ${defined
(CTFCONVERT
):?
${CTFCONVERT} ${CTFFLAGS} ${.TARGET
}:}
191 ${COMPILE.F
} ${.IMPSRC
}
192 ${AR} ${ARFLAGS} ${.TARGET
} ${.PREFIX
}.o
196 ${LINK.r
} -o
${.TARGET
} ${.IMPSRC
} ${LDLIBS}
198 ${COMPILE.r
} ${.IMPSRC
}
199 ${defined
(CTFCONVERT
):?
${CTFCONVERT} ${CTFFLAGS} ${.TARGET
}:}
201 ${COMPILE.r
} ${.IMPSRC
}
202 ${AR} ${ARFLAGS} ${.TARGET
} ${.PREFIX
}.o
207 ${LINK.p
} -o
${.TARGET
} ${.IMPSRC
} ${LDLIBS}
208 ${defined
(CTFCONVERT
):?
${CTFCONVERT} ${CTFFLAGS} ${.TARGET
}:}
210 ${COMPILE.p
} ${.IMPSRC
}
211 ${defined
(CTFCONVERT
):?
${CTFCONVERT} ${CTFFLAGS} ${.TARGET
}:}
213 ${COMPILE.p
} ${.IMPSRC
}
214 ${AR} ${ARFLAGS} ${.TARGET
} ${.PREFIX
}.o
219 ${LINK.s
} -o
${.TARGET
} ${.IMPSRC
} ${LDLIBS}
220 ${defined
(CTFCONVERT
):?
${CTFCONVERT} ${CTFFLAGS} ${.TARGET
}:}
222 ${COMPILE.s
} ${.IMPSRC
}
223 ${defined
(CTFCONVERT
):?
${CTFCONVERT} ${CTFFLAGS} ${.TARGET
}:}
225 ${COMPILE.s
} ${.IMPSRC
}
226 ${AR} ${ARFLAGS} ${.TARGET
} ${.PREFIX
}.o
229 ${LINK.S
} -o
${.TARGET
} ${.IMPSRC
} ${LDLIBS}
230 ${defined
(CTFCONVERT
):?
${CTFCONVERT} ${CTFFLAGS} ${.TARGET
}:}
232 ${COMPILE.S
} ${.IMPSRC
}
233 ${defined
(CTFCONVERT
):?
${CTFCONVERT} ${CTFFLAGS} ${.TARGET
}:}
235 ${COMPILE.S
} ${.IMPSRC
}
236 ${AR} ${ARFLAGS} ${.TARGET
} ${.PREFIX
}.o
242 ${LINK.c
} -o
${.TARGET
} lex.yy.c
${LDLIBS} -ll
246 mv
lex.yy.c
${.TARGET
}
249 ${COMPILE.c
} -o
${.TARGET
} lex.yy.c
250 ${defined
(CTFCONVERT
):?
${CTFCONVERT} ${CTFFLAGS} ${.TARGET
}:}
256 ${LINK.c
} -o
${.TARGET
} y.tab.c
${LDLIBS}
260 mv y.tab.c
${.TARGET
}
263 ${COMPILE.c
} -o
${.TARGET
} y.tab.c
264 ${defined
(CTFCONVERT
):?
${CTFCONVERT} ${CTFFLAGS} ${.TARGET
}:}
270 cp
${.IMPSRC
} ${.TARGET
}