login: SIGINT should interrupt motd printing
[unleashed.git] / bin / bmake / mk / own.mk
blobb9e4f99ea1f514ae808bb46346b0e49fe88fa535
1 # $Id: own.mk,v 1.32 2016/05/18 20:54:29 sjg Exp $
3 .if !target(__${.PARSEFILE}__)
4 __${.PARSEFILE}__:
6 .if !target(__init.mk__)
7 .include "init.mk"
8 .endif
10 .ifndef NOMAKECONF
11 MAKECONF?= /etc/mk.conf
12 .-include "${MAKECONF}"
13 .endif
15 .include <host-target.mk>
17 TARGET_OSNAME?= ${_HOST_OSNAME}
18 TARGET_OSREL?= ${_HOST_OSREL}
19 TARGET_OSTYPE?= ${HOST_OSTYPE}
20 TARGET_HOST?= ${HOST_TARGET}
22 # these may or may not exist
23 .-include <${TARGET_HOST}.mk>
24 .-include <config.mk>
26 RM?= rm
27 LN?= ln
28 INSTALL?= install
30 prefix?= /usr
31 .if exists(${prefix}/lib)
32 libprefix?= ${prefix}
33 .else
34 libprefix?= /usr
35 .endif
37 # FreeBSD at least does not set this
38 MACHINE_ARCH?=${MACHINE}
39 # we need to make sure these are defined too in case sys.mk fails to.
40 COMPILE.s?= ${CC} ${AFLAGS} -c
41 LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
42 COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
43 LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
44 COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
45 LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
46 CXXFLAGS?= ${CFLAGS}
47 COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
48 LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
49 COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
50 LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
51 COMPILE.f?= ${FC} ${FFLAGS} -c
52 LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
53 COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
54 LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
55 COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
56 LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
57 LEX.l?= ${LEX} ${LFLAGS}
58 COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
59 LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
60 YACC.y?= ${YACC} ${YFLAGS}
62 # for suffix rules
63 IMPFLAGS?= ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}}
64 .for s in .c .cc
65 COMPILE.$s += ${IMPFLAGS}
66 LINK.$s += ${IMPFLAGS}
67 .endfor
69 PRINT.VAR.MAKE = MAKESYSPATH=${MAKESYSPATH:U${.PARSEDIR}} ${.MAKE}
70 .if empty(.MAKEFLAGS:M-V*)
71 .if defined(MAKEOBJDIRPREFIX) || defined(MAKEOBJDIR)
72 PRINTOBJDIR= ${PRINT.VAR.MAKE} -r -V .OBJDIR -f /dev/null xxx
73 .else
74 PRINTOBJDIR= ${PRINT.VAR.MAKE} -V .OBJDIR
75 .endif
76 .else
77 PRINTOBJDIR= echo # prevent infinite recursion
78 .endif
80 # we really like to have SRCTOP and OBJTOP defined...
81 .if !defined(SRCTOP) || !defined(OBJTOP)
82 .-include <srctop.mk>
83 .endif
85 .if !defined(SRCTOP) || !defined(OBJTOP)
86 # dpadd.mk is rather pointless without these
87 OPTIONS_DEFAULT_NO+= DPADD_MK
88 .endif
90 # process options
91 OPTIONS_DEFAULT_NO+= \
92 INSTALL_AS_USER \
93 GPROF \
94 LIBTOOL \
95 LINT \
97 OPTIONS_DEFAULT_YES+= \
98 ARCHIVE \
99 AUTODEP \
100 CRYPTO \
101 DOC \
102 DPADD_MK \
103 GDB \
104 KERBEROS \
105 LINKLIB \
106 MAN \
107 NLS \
108 OBJ \
109 PIC \
110 SHARE \
111 SKEY \
112 YP \
114 OPTIONS_DEFAULT_DEPENDENT+= \
115 CATPAGES/MAN \
116 OBJDIRS/OBJ \
117 PICINSTALL/LINKLIB \
118 PICLIB/PIC \
119 PROFILE/LINKLIB \
121 .include <options.mk>
123 .if ${MK_INSTALL_AS_USER} == "yes"
124 # We ignore this if user is root.
125 _uid!= id -u
126 .if ${_uid} != 0
127 .if !defined(USERGRP)
128 USERGRP!= id -g
129 .export USERGRP
130 .endif
131 .for x in BIN CONF DOC INFO KMOD LIB MAN NLS SHARE
132 $xOWN= ${USER}
133 $xGRP= ${USERGRP}
134 $x_INSTALL_OWN=
135 .endfor
136 PROG_INSTALL_OWN=
137 .endif
138 .endif
140 # override this in sys.mk
141 ROOT_GROUP?= wheel
142 BINGRP?= ${ROOT_GROUP}
143 BINOWN?= root
144 BINMODE?= 555
145 NONBINMODE?= 444
146 DIRMODE?= 755
148 # Define MANZ to have the man pages compressed (gzip)
149 #MANZ= 1
151 MANTARGET?= cat
152 MANDIR?= ${prefix}/share/man/${MANTARGET}
153 MANGRP?= ${BINGRP}
154 MANOWN?= ${BINOWN}
155 MANMODE?= ${NONBINMODE}
157 INCLUDEDIR?= ${libprefix}/include
158 LIBDIR?= ${libprefix}/lib
159 SHLIBDIR?= ${libprefix}/lib
160 .if ${USE_SHLIBDIR:Uno} == "yes"
161 _LIBSODIR?= ${SHLIBDIR}
162 .else
163 _LIBSODIR?= ${LIBDIR}
164 .endif
165 # this is where ld.*so lives
166 SHLINKDIR?= /usr/libexec
167 LINTLIBDIR?= ${libprefix}/libdata/lint
168 LIBGRP?= ${BINGRP}
169 LIBOWN?= ${BINOWN}
170 LIBMODE?= ${NONBINMODE}
172 DOCDIR?= ${prefix}/share/doc
173 DOCGRP?= ${BINGRP}
174 DOCOWN?= ${BINOWN}
175 DOCMODE?= ${NONBINMODE}
177 NLSDIR?= ${prefix}/share/nls
178 NLSGRP?= ${BINGRP}
179 NLSOWN?= ${BINOWN}
180 NLSMODE?= ${NONBINMODE}
182 KMODDIR?= ${prefix}/lkm
183 KMODGRP?= ${BINGRP}
184 KMODOWN?= ${BINOWN}
185 KMODMODE?= ${NONBINMODE}
187 COPY?= -c
188 STRIP_FLAG?= -s
190 .if ${TARGET_OSNAME} == "NetBSD"
191 .if exists(/usr/libexec/ld.elf_so)
192 OBJECT_FMT=ELF
193 .endif
194 OBJECT_FMT?=a.out
195 .endif
196 # sys.mk should set something appropriate if need be.
197 OBJECT_FMT?=ELF
199 .if (${_HOST_OSNAME} == "FreeBSD")
200 CFLAGS+= ${CPPFLAGS}
201 .endif
203 # allow for per target flags
204 # apply the :T:R first, so the more specific :T can override if needed
205 CPPFLAGS += ${CPPFLAGS_${.TARGET:T:R}} ${CPPFLAGS_${.TARGET:T}}
206 CFLAGS += ${CFLAGS_${.TARGET:T:R}} ${CFLAGS_${.TARGET:T}}
208 # Define SYS_INCLUDE to indicate whether you want symbolic links to the system
209 # source (``symlinks''), or a separate copy (``copies''); (latter useful
210 # in environments where it's not possible to keep /sys publicly readable)
211 #SYS_INCLUDE= symlinks
213 # don't try to generate PIC versions of libraries on machines
214 # which don't support PIC.
215 .if (${MACHINE_ARCH} == "vax") || \
216 ((${MACHINE_ARCH} == "mips") && defined(STATIC_TOOLCHAIN)) || \
217 ((${MACHINE_ARCH} == "alpha") && defined(ECOFF_TOOLCHAIN))
218 MK_PIC=no
219 .endif
221 # No lint, for now.
222 NOLINT=
225 .if ${MK_LINKLIB} == "no"
226 MK_PICINSTALL= no
227 MK_PROFILE= no
228 .endif
230 .if ${MK_MAN} == "no"
231 MK_CATPAGES= no
232 .endif
234 .if ${MK_OBJ} == "no"
235 MK_OBJDIRS= no
236 MK_AUTO_OBJ= no
237 .endif
239 .if ${MK_SHARE} == "no"
240 MK_CATPAGES= no
241 MK_DOC= no
242 MK_INFO= no
243 MK_MAN= no
244 MK_NLS= no
245 .endif
247 .endif