Annotation of src/share/mk/bsd.own.mk, Revision 1.437
1.437 ! christos 1: # $NetBSD: bsd.own.mk,v 1.436 2005/02/22 14:40:01 peter Exp $
1.64 lukem 2:
3: .if !defined(_BSD_OWN_MK_)
4: _BSD_OWN_MK_=1
1.24 thorpej 5:
1.169 tv 6: MAKECONF?= /etc/mk.conf
1.205 tv 7: .-include "${MAKECONF}"
1.13 mycroft 8:
1.341 lukem 9: #
1.310 thorpej 10: # CPU model, derived from MACHINE_ARCH
1.341 lukem 11: #
1.310 thorpej 12: MACHINE_CPU= ${MACHINE_ARCH:C/mipse[bl]/mips/:C/sh3e[bl]/sh3/:C/sh5e[bl]/sh5/:S/m68000/m68k/:S/armeb/arm/}
13:
1.341 lukem 14: #
1.418 cl 15: # Subdirectory used below ${RELEASEDIR} when building a release
16: #
17: RELEASEMACHINEDIR?= ${MACHINE}
18:
19: #
20: # Subdirectory or path component used for the following paths:
21: # distrib/${RELEASEMACHINE}
22: # distrib/notes/${RELEASEMACHINE}
23: # etc/etc.${RELEASEMACHINE}
24: # Used when building a release.
25: #
26: RELEASEMACHINE?= ${MACHINE}
27:
28: #
1.209 tv 29: # NEED_OWN_INSTALL_TARGET is set to "no" by pkgsrc/mk/bsd.pkg.mk to
30: # ensure that things defined by <bsd.own.mk> (default targets,
31: # INSTALL_FILE, etc.) are not conflicting with bsd.pkg.mk.
1.341 lukem 32: #
1.209 tv 33: NEED_OWN_INSTALL_TARGET?= yes
34:
1.341 lukem 35: #
1.310 thorpej 36: # This lists the platforms which do not have working in-tree toolchains.
1.403 scw 37: # For the in-tree gcc 3.3.2 toolchain, this list is empty.
38: # If some future port is not supported by the in-tree toolchain, this
39: # should be set to "yes" for that port only.
1.341 lukem 40: #
1.310 thorpej 41: TOOLCHAIN_MISSING= no
1.221 thorpej 42:
1.341 lukem 43: #
1.346 mrg 44: # Transitional for toolchain upgrade to GCC3.3
45: #
1.353 mrg 46: # not working:
47: #
1.411 uwe 48: .if ${MACHINE_ARCH} == "vax"
1.395 mrg 49: HAVE_GCC3?= no
50: .else
51: HAVE_GCC3?= yes
52: .endif
53:
1.353 mrg 54: # Do we want to use tools/toolchain or not?
1.406 lukem 55: .if ${HAVE_GCC3} != "no"
1.353 mrg 56: USE_TOOLS_TOOLCHAIN=no
1.346 mrg 57: .endif
1.354 tron 58: USE_TOOLS_TOOLCHAIN?=yes
1.346 mrg 59:
1.221 thorpej 60: CPPFLAG_ISYSTEM= -isystem
1.397 mrg 61: # GCC2 did not have -isystem-cxx
1.406 lukem 62: .if ${USE_TOOLS_TOOLCHAIN} != "no"
1.346 mrg 63: CPPFLAG_ISYSTEMXX= -isystem
64: .else
1.352 mrg 65: CPPFLAG_ISYSTEMXX= -isystem-cxx
1.346 mrg 66: .endif
1.184 tv 67:
1.222 perry 68: .if empty(.MAKEFLAGS:M-V*)
69: PRINTOBJDIR= ${MAKE} -V .OBJDIR
70: .else
71: PRINTOBJDIR= echo # prevent infinite recursion
72: .endif
73:
1.341 lukem 74: #
1.286 lukem 75: # Determine if running in the NetBSD source tree by checking for the
76: # existence of build.sh and tools/ in the current or a parent directory,
77: # and setting _SRC_TOP_ to the result.
78: #
1.287 lukem 79: .if !defined(_SRC_TOP_) # {
1.199 jmc 80: _SRC_TOP_!= cd ${.CURDIR}; while :; do \
1.200 jmc 81: here=`pwd`; \
1.199 jmc 82: [ -f build.sh ] && [ -d tools ] && { echo $$here; break; }; \
83: case $$here in /) echo ""; break;; esac; \
1.341 lukem 84: cd ..; done
1.199 jmc 85:
86: .MAKEOVERRIDES+= _SRC_TOP_
87:
1.287 lukem 88: .endif # }
1.222 perry 89:
1.341 lukem 90: #
1.322 lukem 91: # If _SRC_TOP_ != "", we're within the NetBSD source tree, so set
1.288 lukem 92: # defaults for NETBSDSRCDIR and _SRC_TOP_OBJ_.
1.287 lukem 93: #
94: .if (${_SRC_TOP_} != "") # {
95:
1.288 lukem 96: NETBSDSRCDIR?= ${_SRC_TOP_}
1.180 tv 97:
1.287 lukem 98: .if !defined(_SRC_TOP_OBJ_)
99: _SRC_TOP_OBJ_!= cd ${_SRC_TOP_} && ${PRINTOBJDIR}
100: .MAKEOVERRIDES+= _SRC_TOP_OBJ_
1.286 lukem 101: .endif
102:
1.322 lukem 103: .endif # _SRC_TOP_ != "" # }
1.286 lukem 104:
105:
1.310 thorpej 106: .if (${_SRC_TOP_} != "") && \
1.406 lukem 107: (${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN))
1.287 lukem 108: USETOOLS?= yes
1.286 lukem 109: .endif
1.287 lukem 110: USETOOLS?= no
111:
1.286 lukem 112:
1.310 thorpej 113: .if ${MACHINE_ARCH} == "mips" || ${MACHINE_ARCH} == "sh3" || \
114: ${MACHINE_ARCH} == "sh5"
1.180 tv 115: .BEGIN:
116: @echo "Must set MACHINE_ARCH to one of ${MACHINE_ARCH}eb or ${MACHINE_ARCH}el"
117: @false
1.310 thorpej 118: .elif defined(REQUIRETOOLS) && \
1.406 lukem 119: (${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN)) && \
1.310 thorpej 120: ${USETOOLS} == "no"
1.180 tv 121: .BEGIN:
1.203 tv 122: @echo "USETOOLS=no, but this component requires a version-specific host toolchain"
1.180 tv 123: @false
124: .endif
125:
1.341 lukem 126: #
1.204 tv 127: # Host platform information; may be overridden
1.341 lukem 128: #
1.204 tv 129: .if !defined(HOST_OSTYPE)
130: _HOST_OSNAME!= uname -s
131: _HOST_OSREL!= uname -r
132: _HOST_ARCH!= uname -p 2>/dev/null || uname -m
1.421 jmc 133: HOST_OSTYPE:= ${_HOST_OSNAME}-${_HOST_OSREL:C/\([^\)]*\)//g:[*]:C/ /_/g}-${_HOST_ARCH:C/\([^\)]*\)//g:[*]:C/ /_/g}
1.204 tv 134: .MAKEOVERRIDES+= HOST_OSTYPE
135: .endif
1.333 christos 136: HOST_CYGWIN= ${HOST_OSTYPE:MCYGWIN*}
1.204 tv 137:
1.275 lukem 138: .if ${USETOOLS} == "yes" # {
139:
1.341 lukem 140: #
1.204 tv 141: # Provide a default for TOOLDIR.
1.341 lukem 142: #
1.199 jmc 143: .if !defined(TOOLDIR)
1.339 lukem 144: TOOLDIR:= ${_SRC_TOP_OBJ_}/tooldir.${HOST_OSTYPE}
1.204 tv 145: .MAKEOVERRIDES+= TOOLDIR
1.199 jmc 146: .endif
1.180 tv 147:
1.341 lukem 148: #
1.320 thorpej 149: # This is the prefix used for the NetBSD-sourced tools.
1.341 lukem 150: #
1.320 thorpej 151: _TOOL_PREFIX?= nb
152:
1.341 lukem 153: #
1.318 thorpej 154: # If an external toolchain base is specified, use it.
1.341 lukem 155: #
156: .if defined(EXTERNAL_TOOLCHAIN) # {
1.318 thorpej 157: AR= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ar
158: AS= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-as
159: LD= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ld
160: NM= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-nm
161: OBJCOPY= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-objcopy
162: OBJDUMP= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-objdump
163: RANLIB= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ranlib
164: SIZE= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-size
165: STRIP= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-strip
166:
167: CC= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-gcc
168: CPP= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-cpp
169: CXX= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-c++
170: FC= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-g77
171: OBJC= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-gcc
1.341 lukem 172: .else # } {
1.204 tv 173: # Define default locations for common tools.
1.341 lukem 174: .if ${USETOOLS_BINUTILS:Uyes} == "yes" # {
1.232 tv 175: AR= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ar
176: AS= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-as
1.234 thorpej 177: LD= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ld
178: NM= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-nm
179: OBJCOPY= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-objcopy
180: OBJDUMP= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-objdump
181: RANLIB= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ranlib
182: SIZE= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-size
183: STRIP= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-strip
1.341 lukem 184: .endif # }
1.234 thorpej 185:
1.341 lukem 186: .if ${USETOOLS_GCC:Uyes} == "yes" # {
1.234 thorpej 187: CC= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc
188: CPP= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-cpp
189: CXX= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-c++
190: FC= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-g77
191: OBJC= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc
1.341 lukem 192: .endif # }
193: .endif # EXTERNAL_TOOLCHAIN # }
1.234 thorpej 194:
1.338 lukem 195: HOST_MKDEP= ${TOOLDIR}/bin/${_TOOL_PREFIX}host-mkdep
196:
1.210 thorpej 197: DBSYM= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-dbsym
1.320 thorpej 198: ELF2ECOFF= ${TOOLDIR}/bin/${_TOOL_PREFIX}mips-elf2ecoff
199: INSTALL= STRIP=${STRIP:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}install
200: LEX= ${TOOLDIR}/bin/${_TOOL_PREFIX}lex
1.215 tv 201: LINT= CC=${CC:Q} ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-lint
1.338 lukem 202: LORDER= NM=${NM:Q} MKTEMP=${TOOL_MKTEMP:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}lorder
1.320 thorpej 203: MKDEP= CC=${CC:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}mkdep
204: TSORT= ${TOOLDIR}/bin/${_TOOL_PREFIX}tsort -q
205: YACC= ${TOOLDIR}/bin/${_TOOL_PREFIX}yacc
1.338 lukem 206:
1.426 jmc 207: TOOL_AMIGAAOUT2BB= ${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-aout2bb
208: TOOL_AMIGAELF2BB= ${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-elf2bb
209: TOOL_AMIGATXLT= ${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-txlt
1.338 lukem 210: TOOL_ASN1_COMPILE= ${TOOLDIR}/bin/${_TOOL_PREFIX}asn1_compile
1.425 jmc 211: TOOL_BEBOXELF2PEF= ${TOOLDIR}/bin/${_TOOL_PREFIX}bebox-elf2pef
212: TOOL_BEBOXMKBOOTIMAGE= ${TOOLDIR}/bin/${_TOOL_PREFIX}bebox-mkbootimage
1.338 lukem 213: TOOL_CAP_MKDB= ${TOOLDIR}/bin/${_TOOL_PREFIX}cap_mkdb
214: TOOL_CAT= ${TOOLDIR}/bin/${_TOOL_PREFIX}cat
215: TOOL_CKSUM= ${TOOLDIR}/bin/${_TOOL_PREFIX}cksum
216: TOOL_COMPILE_ET= ${TOOLDIR}/bin/${_TOOL_PREFIX}compile_et
217: TOOL_CONFIG= ${TOOLDIR}/bin/${_TOOL_PREFIX}config
218: TOOL_CRUNCHGEN= MAKE=${.MAKE:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}crunchgen
219: TOOL_CTAGS= ${TOOLDIR}/bin/${_TOOL_PREFIX}ctags
220: TOOL_DB= ${TOOLDIR}/bin/${_TOOL_PREFIX}db
221: TOOL_EQN= ${TOOLDIR}/bin/${_TOOL_PREFIX}eqn
222: TOOL_FGEN= ${TOOLDIR}/bin/${_TOOL_PREFIX}fgen
223: TOOL_GENCAT= ${TOOLDIR}/bin/${_TOOL_PREFIX}gencat
224: TOOL_GROFF= PATH=${TOOLDIR}/lib/groff:$${PATH} ${TOOLDIR}/bin/${_TOOL_PREFIX}groff
225: TOOL_HEXDUMP= ${TOOLDIR}/bin/${_TOOL_PREFIX}hexdump
1.427 jmc 226: TOOL_HP300MKBOOT= ${TOOLDIR}/bin/${_TOOL_PREFIX}hp300-mkboot
1.338 lukem 227: TOOL_INDXBIB= ${TOOLDIR}/bin/${_TOOL_PREFIX}indxbib
228: TOOL_INSTALLBOOT= ${TOOLDIR}/bin/${_TOOL_PREFIX}installboot
229: TOOL_INSTALL_INFO= ${TOOLDIR}/bin/${_TOOL_PREFIX}install-info
230: TOOL_M4= ${TOOLDIR}/bin/${_TOOL_PREFIX}m4
1.405 matt 231: TOOL_MACPPCFIXCOFF= ${TOOLDIR}/bin/${_TOOL_PREFIX}macppc-fixcoff
1.338 lukem 232: TOOL_MAKEFS= ${TOOLDIR}/bin/${_TOOL_PREFIX}makefs
233: TOOL_MAKEINFO= ${TOOLDIR}/bin/${_TOOL_PREFIX}makeinfo
234: TOOL_MAKEWHATIS= ${TOOLDIR}/bin/${_TOOL_PREFIX}makewhatis
235: TOOL_MDSETIMAGE= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-mdsetimage
236: TOOL_MENUC= MENUDEF=${TOOLDIR}/share/misc ${TOOLDIR}/bin/${_TOOL_PREFIX}menuc
1.425 jmc 237: TOOL_MIPSELF2ECOFF= ${TOOLDIR}/bin/${_TOOL_PREFIX}mips-elf2ecoff
1.338 lukem 238: TOOL_MKCSMAPPER= ${TOOLDIR}/bin/${_TOOL_PREFIX}mkcsmapper
239: TOOL_MKESDB= ${TOOLDIR}/bin/${_TOOL_PREFIX}mkesdb
240: TOOL_MKLOCALE= ${TOOLDIR}/bin/${_TOOL_PREFIX}mklocale
241: TOOL_MKMAGIC= ${TOOLDIR}/bin/${_TOOL_PREFIX}file
242: TOOL_MKTEMP= ${TOOLDIR}/bin/${_TOOL_PREFIX}mktemp
243: TOOL_MSGC= MSGDEF=${TOOLDIR}/share/misc ${TOOLDIR}/bin/${_TOOL_PREFIX}msgc
244: TOOL_MTREE= ${TOOLDIR}/bin/${_TOOL_PREFIX}mtree
245: TOOL_PAX= ${TOOLDIR}/bin/${_TOOL_PREFIX}pax
246: TOOL_PIC= ${TOOLDIR}/bin/${_TOOL_PREFIX}pic
247: TOOL_PREPMKBOOTIMAGE= ${TOOLDIR}/bin/${_TOOL_PREFIX}prep-mkbootimage
248: TOOL_PWD_MKDB= ${TOOLDIR}/bin/${_TOOL_PREFIX}pwd_mkdb
249: TOOL_REFER= ${TOOLDIR}/bin/${_TOOL_PREFIX}refer
250: TOOL_ROFF_ASCII= PATH=${TOOLDIR}/lib/groff:$${PATH} ${TOOLDIR}/bin/${_TOOL_PREFIX}nroff
251: TOOL_ROFF_DVI= ${TOOL_GROFF} -Tdvi
1.340 lukem 252: TOOL_ROFF_HTML= ${TOOL_GROFF} -Tlatin1 -mdoc2html
1.338 lukem 253: TOOL_ROFF_PS= ${TOOL_GROFF} -Tps
254: TOOL_ROFF_RAW= ${TOOL_GROFF} -Z
255: TOOL_RPCGEN= CPP=${CPP:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}rpcgen
256: TOOL_SOELIM= ${TOOLDIR}/bin/${_TOOL_PREFIX}soelim
1.342 lukem 257: TOOL_STAT= ${TOOLDIR}/bin/${_TOOL_PREFIX}stat
1.420 abs 258: TOOL_SPARKCRC= ${TOOLDIR}/bin/${_TOOL_PREFIX}sparkcrc
1.338 lukem 259: TOOL_SUNLABEL= ${TOOLDIR}/bin/${_TOOL_PREFIX}sunlabel
260: TOOL_TBL= ${TOOLDIR}/bin/${_TOOL_PREFIX}tbl
261: TOOL_UUDECODE= ${TOOLDIR}/bin/${_TOOL_PREFIX}uudecode
262: TOOL_VGRIND= ${TOOLDIR}/bin/${_TOOL_PREFIX}vgrind -f
263: TOOL_ZIC= ${TOOLDIR}/bin/${_TOOL_PREFIX}zic
1.180 tv 264:
1.275 lukem 265: .endif # USETOOLS == yes # }
1.272 lukem 266:
1.341 lukem 267: #
1.272 lukem 268: # Targets to check if DESTDIR or RELEASEDIR is provided
269: #
270: .if !target(check_DESTDIR)
271: check_DESTDIR: .PHONY .NOTMAIN
272: .if !defined(DESTDIR)
273: @echo "setenv DESTDIR before doing that!"
274: @false
275: .else
276: @true
277: .endif
278: .endif
279:
280: .if !target(check_RELEASEDIR)
281: check_RELEASEDIR: .PHONY .NOTMAIN
282: .if !defined(RELEASEDIR)
283: @echo "setenv RELEASEDIR before doing that!"
284: @false
285: .else
286: @true
287: .endif
288: .endif
289:
290:
1.341 lukem 291: .if ${USETOOLS} == "yes" # {
292: #
1.180 tv 293: # Make sure DESTDIR is set, so that builds with these tools always
294: # get appropriate -nostdinc, -nostdlib, etc. handling. The default is
295: # <empty string>, meaning start from /, the root directory.
1.341 lukem 296: #
1.180 tv 297: DESTDIR?=
1.341 lukem 298: .endif # }
1.287 lukem 299:
1.341 lukem 300: #
1.306 lukem 301: # Build a dynamically linked /bin and /sbin, with the necessary shared
302: # libraries moved from /usr/lib to /lib and the shared linker moved
303: # from /usr/libexec to /lib
304: #
1.315 thorpej 305: # Note that if the BINDIR is not /bin or /sbin, then we always use the
306: # non-DYNAMICROOT behavior (i.e. it is only enabled for programs in /bin
307: # and /sbin). See <bsd.shlib.mk>.
308: #
1.311 lukem 309: MKDYNAMICROOT?= yes
1.306 lukem 310:
1.341 lukem 311: #
1.287 lukem 312: # Where the system object and source trees are kept; can be configurable
313: # by the user in case they want them in ~/foosrc and ~/fooobj (for example).
314: #
315: BSDSRCDIR?= /usr/src
316: BSDOBJDIR?= /usr/obj
1.288 lukem 317: NETBSDSRCDIR?= ${BSDSRCDIR}
1.1 cgd 318:
1.61 lukem 319: BINGRP?= wheel
320: BINOWN?= root
1.1 cgd 321: BINMODE?= 555
1.4 mycroft 322: NONBINMODE?= 444
1.17 brezak 323:
1.31 christos 324: MANDIR?= /usr/share/man
1.61 lukem 325: MANGRP?= wheel
326: MANOWN?= root
1.4 mycroft 327: MANMODE?= ${NONBINMODE}
1.52 mycroft 328: MANINSTALL?= maninstall catinstall
1.115 tv 329:
330: INFODIR?= /usr/share/info
331: INFOGRP?= wheel
332: INFOOWN?= root
333: INFOMODE?= ${NONBINMODE}
1.4 mycroft 334:
335: LIBDIR?= /usr/lib
1.315 thorpej 336:
1.4 mycroft 337: LINTLIBDIR?= /usr/libdata/lint
338: LIBGRP?= ${BINGRP}
339: LIBOWN?= ${BINOWN}
340: LIBMODE?= ${NONBINMODE}
341:
1.135 simonb 342: DOCDIR?= /usr/share/doc
1.136 simonb 343: HTMLDOCDIR?= /usr/share/doc/html
1.61 lukem 344: DOCGRP?= wheel
345: DOCOWN?= root
1.135 simonb 346: DOCMODE?= ${NONBINMODE}
1.15 jtc 347:
348: NLSDIR?= /usr/share/nls
1.61 lukem 349: NLSGRP?= wheel
350: NLSOWN?= root
1.15 jtc 351: NLSMODE?= ${NONBINMODE}
1.25 explorer 352:
353: KMODDIR?= /usr/lkm
1.61 lukem 354: KMODGRP?= wheel
355: KMODOWN?= root
1.25 explorer 356: KMODMODE?= ${NONBINMODE}
1.155 itojun 357:
358: LOCALEDIR?= /usr/share/locale
359: LOCALEGRP?= wheel
360: LOCALEOWN?= root
361: LOCALEMODE?= ${NONBINMODE}
1.1 cgd 362:
1.341 lukem 363: #
364: # Data-driven table using make variables to control how
1.264 thorpej 365: # toolchain-dependent targets and shared libraries are built
366: # for different platforms and object formats.
367: #
1.296 thorpej 368: # OBJECT_FMT: currently either "ELF" or "a.out".
1.264 thorpej 369: #
1.296 thorpej 370: # All platforms are ELF, except for ns32k (which does not yet have
371: # an ELF BFD back-end).
1.341 lukem 372: #
1.296 thorpej 373: .if ${MACHINE_ARCH} == "ns32k"
374: OBJECT_FMT?= a.out # allow overrides, to ease transition
375: .else
1.264 thorpej 376: OBJECT_FMT= ELF
377: .endif
378:
1.341 lukem 379: #
1.310 thorpej 380: # If this platform's toolchain is missing, we obviously cannot build it.
1.341 lukem 381: #
1.406 lukem 382: .if ${TOOLCHAIN_MISSING} != "no"
1.310 thorpej 383: MKBFD:= no
384: MKGDB:= no
385: MKGCC:= no
386: .endif
387:
1.341 lukem 388: #
1.310 thorpej 389: # If we are using an external toolchain, we can still build the target's
390: # BFD stuff, but we cannot build GCC's support libraries, since those are
391: # tightly-coupled to the version of GCC being used.
1.341 lukem 392: #
1.310 thorpej 393: .if defined(EXTERNAL_TOOLCHAIN)
394: MKGCC:= no
395: .endif
396:
1.341 lukem 397: #
1.356 uwe 398: # GCC can produce PIC code for sh3 only starting with gcc3.
1.341 lukem 399: #
1.406 lukem 400: .if ${MACHINE_CPU} == "sh3" && ${HAVE_GCC3} == "no"
1.230 tv 401: NOPIC= # defined
1.266 thorpej 402: .endif
1.18 cgd 403:
1.341 lukem 404: #
1.403 scw 405: # gcc3 and gdb on sh5 are not ready for prime-time.
1.341 lukem 406: #
1.317 thorpej 407: .if ${MACHINE_CPU} == "sh5"
1.301 scw 408: NOPROFILE= # defined
1.403 scw 409: NOPIC= # defined
410: MKGDB=no
1.301 scw 411: .endif
412:
1.341 lukem 413: #
1.165 fredette 414: # The m68000 port is incomplete.
1.341 lukem 415: #
1.165 fredette 416: .if ${MACHINE_ARCH} == "m68000"
1.230 tv 417: NOPIC= # defined
1.32 thorpej 418: .endif
1.122 simonb 419:
1.341 lukem 420: #
1.297 fredette 421: # The hppa port is incomplete.
1.341 lukem 422: #
1.297 fredette 423: .if ${MACHINE_ARCH} == "hppa"
1.416 skrll 424: MKGDB= no
1.297 fredette 425: .endif
426:
1.341 lukem 427: #
1.327 thorpej 428: # On the MIPS, all libs are compiled with ABIcalls (and are thus PIC),
429: # not just shared libraries, so don't build the _pic version.
1.341 lukem 430: #
1.327 thorpej 431: .if ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb"
432: MKPICLIB:= no
433: .endif
434:
1.341 lukem 435: #
1.400 simonb 436: # Shared libraries are not supported on ns32k with current GNU tools.
1.404 simonb 437: # Disable native gdb too.
1.341 lukem 438: #
1.400 simonb 439: .if ${MACHINE_ARCH} == "ns32k"
1.296 thorpej 440: NOPIC= # defined
1.404 simonb 441: MKGDB= no
1.296 thorpej 442: .endif
443:
1.341 lukem 444: #
1.327 thorpej 445: # On VAX using ELF, all objects are PIC, not just shared libraries,
1.401 matt 446: # so don't build the _pic version. Unless we are using GCC3 which
447: # doesn't support PIC yet.
1.341 lukem 448: #
1.402 matt 449: .if ${MACHINE_ARCH} == "vax" && ${HAVE_GCC3} != "no"
1.401 matt 450: NOPIC= # defined
451: .endif
1.327 thorpej 452: .if ${MACHINE_ARCH} == "vax" && ${OBJECT_FMT} == "ELF"
453: MKPICLIB:= no
454: .endif
455:
1.341 lukem 456: #
1.122 simonb 457: # Location of the file that contains the major and minor numbers of the
458: # version of a shared library. If this file exists a shared library
459: # will be built by <bsd.lib.mk>.
1.341 lukem 460: #
1.122 simonb 461: SHLIB_VERSION_FILE?= ${.CURDIR}/shlib_version
1.69 tv 462:
1.341 lukem 463: #
1.69 tv 464: # GNU sources and packages sometimes see architecture names differently.
1.341 lukem 465: #
1.261 thorpej 466: GNU_ARCH.m68000=m68010
1.150 itojun 467: GNU_ARCH.sh3eb=sh
1.236 thorpej 468: GNU_ARCH.sh3el=shle
1.317 thorpej 469: GNU_ARCH.sh5eb=sh5
470: GNU_ARCH.sh5el=sh5le
1.172 tv 471: MACHINE_GNU_ARCH=${GNU_ARCH.${MACHINE_ARCH}:U${MACHINE_ARCH}}
1.161 tv 472:
1.341 lukem 473: #
1.161 tv 474: # In order to identify NetBSD to GNU packages, we sometimes need
475: # an "elf" tag for historically a.out platforms.
1.341 lukem 476: #
1.162 tv 477: .if ${OBJECT_FMT} == "ELF" && \
1.192 thorpej 478: (${MACHINE_GNU_ARCH} == "arm" || \
1.294 thorpej 479: ${MACHINE_GNU_ARCH} == "armeb" || \
1.296 thorpej 480: ${MACHINE_ARCH} == "ns32k" || \
1.168 matt 481: ${MACHINE_ARCH} == "i386" || \
1.161 tv 482: ${MACHINE_ARCH} == "m68k" || \
1.260 thorpej 483: ${MACHINE_ARCH} == "m68000" || \
1.235 thorpej 484: ${MACHINE_GNU_ARCH} == "sh" || \
1.236 thorpej 485: ${MACHINE_GNU_ARCH} == "shle" || \
1.168 matt 486: ${MACHINE_ARCH} == "sparc" || \
487: ${MACHINE_ARCH} == "vax")
1.318 thorpej 488: MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsdelf
1.161 tv 489: .else
1.318 thorpej 490: MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsd
1.161 tv 491: .endif
1.153 itojun 492:
1.160 tv 493: TARGETS+= all clean cleandir depend dependall includes \
1.142 phil 494: install lint obj regress tags html installhtml cleanhtml
1.128 perry 495: .PHONY: all clean cleandir depend dependall distclean includes \
496: install lint obj regress tags beforedepend afterdepend \
1.142 phil 497: beforeinstall afterinstall realinstall realdepend realall \
1.257 reinoud 498: html installhtml cleanhtml subdir-all subdir-install subdir-depend
1.58 agc 499:
1.406 lukem 500: .if ${NEED_OWN_INSTALL_TARGET} != "no"
1.56 drochner 501: .if !target(install)
502: install: .NOTMAIN beforeinstall subdir-install realinstall afterinstall
1.55 drochner 503: beforeinstall: .NOTMAIN
1.56 drochner 504: subdir-install: .NOTMAIN beforeinstall
505: realinstall: .NOTMAIN beforeinstall
506: afterinstall: .NOTMAIN subdir-install realinstall
1.58 agc 507: .endif
1.131 mycroft 508: all: .NOTMAIN realall subdir-all
509: subdir-all: .NOTMAIN
510: realall: .NOTMAIN
511: depend: .NOTMAIN realdepend subdir-depend
512: subdir-depend: .NOTMAIN
513: realdepend: .NOTMAIN
1.160 tv 514: distclean: .NOTMAIN cleandir
1.171 tv 515: cleandir: .NOTMAIN clean
1.205 tv 516:
517: dependall: .NOTMAIN realdepend .MAKE
518: @cd ${.CURDIR}; ${MAKE} realall
1.132 mycroft 519: .endif
1.116 lukem 520:
1.341 lukem 521: #
1.116 lukem 522: # Define MKxxx variables (which are either yes or no) for users
1.350 lukem 523: # to set in /etc/mk.conf and override in the make environment.
1.116 lukem 524: # These should be tested with `== "no"' or `!= "no"'.
1.340 lukem 525: # The NOxxx variables should only be set by Makefiles.
1.116 lukem 526: #
527:
1.341 lukem 528: #
1.230 tv 529: # Supported NO* options (if defined, MK* will be forced to "no",
530: # regardless of user's mk.conf setting).
1.341 lukem 531: #
1.422 lukem 532: .for var in \
533: CRYPTO DOC HTML LINKLIB LINT MAN NLS OBJ PIC PICINSTALL PROFILE \
1.358 lukem 534: SHARE STATICLIB
1.230 tv 535: .if defined(NO${var})
536: MK${var}:= no
537: .endif
538: .endfor
1.268 ross 539:
1.341 lukem 540: #
541: # Older-style variables that enabled behaviour when set.
542: #
543: .for var in MANZ UNPRIVED UPDATE
544: .if defined(${var})
545: MK${var}:= yes
1.268 ross 546: .endif
1.341 lukem 547: .endfor
1.230 tv 548:
1.341 lukem 549: #
1.230 tv 550: # MK* options which default to "yes".
1.341 lukem 551: #
1.422 lukem 552: .for var in \
553: BFD BINUTILS \
1.373 matt 554: CATPAGES CRYPTO CVS \
555: DOC \
556: GCC GCCCMDS GDB \
557: HESIOD HTML \
1.436 peter 558: IEEEFP INET6 INFO IPFILTER \
1.373 matt 559: KERBEROS KERBEROS4 \
560: LINKLIB LINT \
561: MAN \
562: NLS \
563: OBJ \
1.436 peter 564: PAM PF PIC PICINSTALL PICLIB POSTFIX PROFILE \
1.407 lukem 565: SENDMAIL SHARE SKEY STATICLIB \
1.373 matt 566: UUCP \
567: YP
1.230 tv 568: MK${var}?= yes
569: .endfor
570:
1.341 lukem 571: #
1.230 tv 572: # MK* options which default to "no".
1.341 lukem 573: #
1.422 lukem 574: .for var in \
1.435 thorpej 575: CRYPTO_IDEA CRYPTO_MDC2 CRYPTO_RC5 \
1.433 lukem 576: MANZ OBJDIRS PRIVATELIB SOFTFLOAT UNPRIVED UPDATE X11
1.230 tv 577: MK${var}?= no
578: .endfor
579:
1.341 lukem 580: #
1.230 tv 581: # Force some options off if their dependencies are off.
1.341 lukem 582: #
583:
1.413 jmc 584: .if ${MKKERBEROS} == "no"
585: MKKERBEROS4:= no
586: .endif
587:
1.230 tv 588: .if ${MKCRYPTO} == "no"
1.344 itojun 589: MKKERBEROS4:= no
1.230 tv 590: MKKERBEROS:= no
1.340 lukem 591: .endif
592:
593: .if ${MKMAN} == "no"
1.341 lukem 594: MKCATPAGES:= no
1.340 lukem 595: MKHTML:= no
1.116 lukem 596: .endif
597:
1.117 lukem 598: .if ${MKLINKLIB} == "no"
1.230 tv 599: MKPICINSTALL:= no
600: MKPROFILE:= no
1.327 thorpej 601: .endif
602:
603: .if ${MKPIC} == "no"
604: MKPICLIB:= no
1.116 lukem 605: .endif
606:
1.230 tv 607: .if ${MKOBJ} == "no"
608: MKOBJDIRS:= no
1.116 lukem 609: .endif
610:
1.117 lukem 611: .if ${MKSHARE} == "no"
1.230 tv 612: MKCATPAGES:= no
613: MKDOC:= no
614: MKINFO:= no
1.341 lukem 615: MKHTML:= no
1.230 tv 616: MKMAN:= no
617: MKNLS:= no
1.116 lukem 618: .endif
1.276 thorpej 619:
1.341 lukem 620: #
621: # install(1) parameters.
622: #
623: COPY?= -c
624: .if ${MKUPDATE} == "no"
625: PRESERVE?=
626: .else
627: PRESERVE?= -p
628: .endif
629: RENAME?= -r
630: HRDLINK?= -l h
631: SYMLINK?= -l s
632:
633: METALOG?= ${DESTDIR}/METALOG
634: METALOG.add?= ${TOOL_CAT} -l >> ${METALOG}
635: .if (${_SRC_TOP_} != "") # only set INSTPRIV if inside ${NETBSDSRCDIR}
636: .if ${MKUNPRIVED} != "no"
1.409 lukem 637: INSTPRIV.unpriv=-U -M ${METALOG} -D ${DESTDIR} -h sha1
1.341 lukem 638: .else
639: INSTPRIV.unpriv=
640: .endif
641: INSTPRIV?= ${INSTPRIV.unpriv} -N ${NETBSDSRCDIR}/etc
642: .endif
643: SYSPKGTAG?= ${SYSPKG:D-T ${SYSPKG}_pkg}
644: SYSPKGDOCTAG?= ${SYSPKG:D-T ${SYSPKG}-doc_pkg}
1.410 lukem 645: STRIPFLAG?=
1.341 lukem 646:
1.406 lukem 647: .if ${NEED_OWN_INSTALL_TARGET} != "no"
1.341 lukem 648: INSTALL_DIR?= ${INSTALL} ${INSTPRIV} -d
649: INSTALL_FILE?= ${INSTALL} ${INSTPRIV} ${COPY} ${PRESERVE} ${RENAME}
650: INSTALL_LINK?= ${INSTALL} ${INSTPRIV} ${HRDLINK} ${RENAME}
651: INSTALL_SYMLINK?= ${INSTALL} ${INSTPRIV} ${SYMLINK} ${RENAME}
652: HOST_INSTALL_FILE?= ${INSTALL} ${COPY} ${PRESERVE} ${RENAME}
653: .endif
654:
655: #
1.351 lukem 656: # Set defaults for the USE_xxx variables.
657: #
658:
659: #
1.433 lukem 660: # USE_* options which default to "no" and will be forced to "no" if their
661: # corresponding MK* variable is set to "no".
662: # (The latter is implemented using the .for loop in the next block.)
663: #
664: USE_PAM?= no
665:
666: #
1.351 lukem 667: # USE_* options which default to "yes" unless their corresponding MK*
668: # variable is set to "no".
1.341 lukem 669: #
1.428 lukem 670: .for var in HESIOD INET6 KERBEROS KERBEROS4 PAM SKEY YP
1.276 thorpej 671: .if (${MK${var}} == "no")
672: USE_${var}:= no
673: .else
674: USE_${var}?= yes
675: .endif
1.351 lukem 676: .endfor
677:
678: #
679: # USE_* options which default to "yes".
680: #
681: .for var in LIBSTDCXX
682: USE_${var}?= yes
1.276 thorpej 683: .endfor
1.300 tron 684:
1.341 lukem 685: #
1.429 tron 686: # Because XFree86 3.3.6 was EOLed all ports use XFree86 4.x now.
687: # We keep this definition for backwards compatiblity.
1.341 lukem 688: #
1.429 tron 689: USE_XF86_4= yes
1.357 lukem 690:
691: #
1.422 lukem 692: # Where X11R6 sources are and where it is installed to.
1.357 lukem 693: #
694: X11SRCDIR?= /usr/xsrc
695: X11SRCDIR.xc?= ${X11SRCDIR}/xfree/xc
696: X11SRCDIR.local?= ${X11SRCDIR}/local
697: X11ROOTDIR?= /usr/X11R6
698: X11BINDIR?= ${X11ROOTDIR}/bin
1.417 lukem 699: X11ETCDIR?= /etc/X11
1.357 lukem 700: X11FONTDIR?= ${X11ROOTDIR}/lib/X11/fonts
701: X11INCDIR?= ${X11ROOTDIR}/include
702: X11LIBDIR?= ${X11ROOTDIR}/lib/X11
703: X11MANDIR?= ${X11ROOTDIR}/man
704: X11USRLIBDIR?= ${X11ROOTDIR}/lib
1.417 lukem 705:
1.412 rtr 706: X11DRI?= no
1.415 rtr 707: X11LOADABLE?= yes
1.374 lukem 708:
709:
710: #
1.414 lukem 711: # MAKEDIRTARGET dir target [extra make(1) params]
712: # run "cd $${dir} && ${MAKE} [params] $${target}", with a pretty message
713: #
714: MAKEDIRTARGET=\
715: @_makedirtarget() { \
716: dir="$$1"; shift; \
717: target="$$1"; shift; \
718: case "$${dir}" in \
719: /*) this="$${dir}/"; \
720: real="$${dir}" ;; \
721: .) this="${_THISDIR_}"; \
722: real="${.CURDIR}" ;; \
723: *) this="${_THISDIR_}$${dir}/"; \
724: real="${.CURDIR}/$${dir}" ;; \
725: esac; \
726: show=$${this:-.}; \
727: echo "$${target} ===> $${show%/}$${1:+ (with: $$@)}"; \
728: cd "$${real}" \
729: && ${MAKE} _THISDIR_="$${this}" "$$@" $${target}; \
730: }; \
731: _makedirtarget
732:
733: #
1.374 lukem 734: # MAKEVERBOSE support. Levels are:
1.380 lukem 735: # 0 No messages
736: # 1 Enable info messages, suppress command output
737: # 2 Enable info messages and command output
1.374 lukem 738: #
739: MAKEVERBOSE?= 2
740:
741: .if ${MAKEVERBOSE} == 0
742: _MKMSG?= @\#
743: _MKSHMSG?= : echo
744: _MKSHECHO?= : echo
1.380 lukem 745: .SILENT:
1.374 lukem 746: .elif ${MAKEVERBOSE} == 1
747: _MKMSG?= @echo ' '
748: _MKSHMSG?= echo ' '
749: _MKSHECHO?= : echo
1.380 lukem 750: .SILENT:
1.374 lukem 751: .else # MAKEVERBOSE == 2 ?
752: _MKMSG?= @echo '\# '
753: _MKSHMSG?= echo '\# '
754: _MKSHECHO?= echo
1.380 lukem 755: .SILENT: __makeverbose_dummy_target__
1.374 lukem 756: .endif
757:
758: _MKMSG_BUILD?= ${_MKMSG} " build "
759: _MKMSG_CREATE?= ${_MKMSG} " create "
760: _MKMSG_COMPILE?= ${_MKMSG} "compile "
761: _MKMSG_FORMAT?= ${_MKMSG} " format "
762: _MKMSG_INSTALL?= ${_MKMSG} "install "
763: _MKMSG_LINK?= ${_MKMSG} " link "
764: _MKMSG_LEX?= ${_MKMSG} " lex "
765: _MKMSG_REMOVE?= ${_MKMSG} " remove "
766: _MKMSG_YACC?= ${_MKMSG} " yacc "
1.391 lukem 767:
768: _MKSHMSG_CREATE?= ${_MKSHMSG} " create "
769: _MKSHMSG_INSTALL?= ${_MKSHMSG} "install "
1.374 lukem 770:
1.394 lukem 771: _MKTARGET_BUILD?= ${_MKMSG_BUILD} ${.CURDIR:T}/${.TARGET}
772: _MKTARGET_CREATE?= ${_MKMSG_CREATE} ${.CURDIR:T}/${.TARGET}
773: _MKTARGET_COMPILE?= ${_MKMSG_COMPILE} ${.CURDIR:T}/${.TARGET}
774: _MKTARGET_FORMAT?= ${_MKMSG_FORMAT} ${.CURDIR:T}/${.TARGET}
775: _MKTARGET_INSTALL?= ${_MKMSG_INSTALL} ${.TARGET}
776: _MKTARGET_LINK?= ${_MKMSG_LINK} ${.CURDIR:T}/${.TARGET}
777: _MKTARGET_LEX?= ${_MKMSG_LEX} ${.CURDIR:T}/${.TARGET}
778: _MKTARGET_REMOVE?= ${_MKMSG_REMOVE} ${.TARGET}
779: _MKTARGET_YACC?= ${_MKMSG_YACC} ${.CURDIR:T}/${.TARGET}
1.64 lukem 780:
1.347 lukem 781: .endif # !defined(_BSD_OWN_MK_)
CVSweb <webmaster@jp.NetBSD.org>