diff --git a/src/bin/Makefile b/src/bin/Makefile deleted file mode 100644 index a123b29..0000000 --- a/src/bin/Makefile +++ /dev/null @@ -1,95 +0,0 @@ -# $Id: Makefile 121 2016-01-14 03:18:20Z reddawg $ -# The System Makefile (C) 2002 The UbixOS Project - -all: init-bin login-bin shell-bin clock-bin cp-bin fdisk-bin format-bin disklabel-bin ubistry-bin ld-bin ttyd-bin stat-bin ls-bin #rtld-elf-bin -# MrOlsen (2016-01-11) ERROR: weird it didnt like -elf rtld-elf-bin -# MrOlsen (2016-01-11) NOTE: edit-bin cat-bin -# test-bin pwd-bin cat-bin de-bin ls-bin goofball-bin mount-bin - -init-bin: init - (cd init;make) - -login-bin: login - (cd login;make) - -shell-bin: shell - (cd shell;make) - -test-bin: test - (cd test;make) - -ls-bin: ls - (cd ls;make) - -pwd-bin: pwd - (cd pwd;make) - -cat-bin: cat - (cd cat;make) - -ld-bin: ld - (cd ld;make) - -de-bin: de - (cd de;make) - -muffin-bin: muffin - (cd muffin;make) - -goofball-bin: goofball - (cd goofball;make) - -clock-bin: clock - (cd clock;make) - -fdisk-bin: fdisk - (cd fdisk;make) - -cp-bin: cp - (cd cp;make) - -format-bin: format - (cd format;make) - -disklabel-bin: disklabel - (cd disklabel;make) - -launcher-bin: launcher - (cd launcher;make) - -ubistry-bin: ubistry - (cd ubistry;make) - -edit-bin: edit - (cd edit;make) - -ttyd-bin: ttyd - (cd ttyd;make) - -stat-bin: stat - (cd stat;make) - -mount-bin: mount - (cd mount;make) - -rtld-elf-bin: rtld-elf - (cd rtld-elf;make) - -clean: - (cd cp;make clean) - (cd fdisk;make clean) - (cd init;make clean) - (cd shell;make clean) - (cd ls;make clean) - (cd login;make clean) - (cd clock;make clean) - (cd muffin;make clean) - (cd format;make clean) - (cd disklabel;make clean) - (cd ubistry;make clean) - (cd ld;make clean) - (cd edit;make clean) - (cd ttyd;make clean) - (cd stat;make clean) - (cd mount;make clean) - (cd rtld-elf;make clean) diff --git a/src/bin/Makefile.old b/src/bin/Makefile.old new file mode 100644 index 0000000..a123b29 --- /dev/null +++ b/src/bin/Makefile.old @@ -0,0 +1,95 @@ +# $Id: Makefile 121 2016-01-14 03:18:20Z reddawg $ +# The System Makefile (C) 2002 The UbixOS Project + +all: init-bin login-bin shell-bin clock-bin cp-bin fdisk-bin format-bin disklabel-bin ubistry-bin ld-bin ttyd-bin stat-bin ls-bin #rtld-elf-bin +# MrOlsen (2016-01-11) ERROR: weird it didnt like -elf rtld-elf-bin +# MrOlsen (2016-01-11) NOTE: edit-bin cat-bin +# test-bin pwd-bin cat-bin de-bin ls-bin goofball-bin mount-bin + +init-bin: init + (cd init;make) + +login-bin: login + (cd login;make) + +shell-bin: shell + (cd shell;make) + +test-bin: test + (cd test;make) + +ls-bin: ls + (cd ls;make) + +pwd-bin: pwd + (cd pwd;make) + +cat-bin: cat + (cd cat;make) + +ld-bin: ld + (cd ld;make) + +de-bin: de + (cd de;make) + +muffin-bin: muffin + (cd muffin;make) + +goofball-bin: goofball + (cd goofball;make) + +clock-bin: clock + (cd clock;make) + +fdisk-bin: fdisk + (cd fdisk;make) + +cp-bin: cp + (cd cp;make) + +format-bin: format + (cd format;make) + +disklabel-bin: disklabel + (cd disklabel;make) + +launcher-bin: launcher + (cd launcher;make) + +ubistry-bin: ubistry + (cd ubistry;make) + +edit-bin: edit + (cd edit;make) + +ttyd-bin: ttyd + (cd ttyd;make) + +stat-bin: stat + (cd stat;make) + +mount-bin: mount + (cd mount;make) + +rtld-elf-bin: rtld-elf + (cd rtld-elf;make) + +clean: + (cd cp;make clean) + (cd fdisk;make clean) + (cd init;make clean) + (cd shell;make clean) + (cd ls;make clean) + (cd login;make clean) + (cd clock;make clean) + (cd muffin;make clean) + (cd format;make clean) + (cd disklabel;make clean) + (cd ubistry;make clean) + (cd ld;make clean) + (cd edit;make clean) + (cd ttyd;make clean) + (cd stat;make clean) + (cd mount;make clean) + (cd rtld-elf;make clean) diff --git a/src/share/mk/Makefile b/src/share/mk/Makefile new file mode 100644 index 0000000..c68b094 --- /dev/null +++ b/src/share/mk/Makefile @@ -0,0 +1,28 @@ +# $NetBSD: Makefile,v 1.49 2014/01/16 01:15:33 christos Exp $ +# @(#)Makefile 8.1 (Berkeley) 6/8/93 + +NOOBJ= # defined + +.include + +.if ${MKSHARE} != "no" +FILES= bsd.README bsd.buildinstall.mk bsd.clang-analyze.mk bsd.clean.mk \ + bsd.dep.mk bsd.doc.mk bsd.endian.mk bsd.files.mk bsd.gcc.mk \ + bsd.host.mk bsd.hostlib.mk bsd.hostprog.mk bsd.inc.mk bsd.info.mk \ + bsd.init.mk bsd.ioconf.mk bsd.kernobj.mk bsd.kinc.mk bsd.klinks.mk \ + bsd.kmodule.mk bsd.lib.mk bsd.links.mk bsd.lua.mk \ + bsd.man.mk bsd.nls.mk \ + bsd.obj.mk bsd.own.mk bsd.prog.mk bsd.rpc.mk bsd.shlib.mk \ + bsd.subdir.mk bsd.sys.mk bsd.syscall.mk bsd.test.mk bsd.x11.mk sys.mk + +.if defined(__MINIX) +# MINIX-specific files +FILES+= minix.service.mk minix.gcov.mk +.endif # defined(__MINIX) + +FILESDIR=/usr/share/mk +.endif + +FILESMODE=444 + +.include diff --git a/src/share/mk/bsd.buildinstall.mk b/src/share/mk/bsd.buildinstall.mk new file mode 100644 index 0000000..87c65b3 --- /dev/null +++ b/src/share/mk/bsd.buildinstall.mk @@ -0,0 +1,29 @@ +# $NetBSD: bsd.buildinstall.mk,v 1.1 2012/11/15 23:51:53 joerg Exp $ + +# +# build_install logic for src/Makefile +# Used by src/lib/Makefile and src/tools/Makefile. +# +# Compute a list of subdirectories delimited by .WAIT. +# Run "make dependall && make install" for all subdirectories in a group +# concurrently, but wait after each group. +# +SUBDIR_GROUPS= 1 +CUR_GROUP:= 1 +.for dir in ${SUBDIR} +. if ${dir} == ".WAIT" +CUR_GROUP:= ${CUR_GROUP}1 +SUBDIR_GROUPS:= ${SUBDIR_GROUPS} ${CUR_GROUP} +. else +SUBDIR_GROUP.${CUR_GROUP}+= ${dir} +.endif + +.endfor + +build_install: +.for group in ${SUBDIR_GROUPS} +. if !empty(SUBDIR_GROUP.${group}) + ${MAKEDIRTARGET} . ${SUBDIR_GROUP.${group}:C/^/dependall-/} + ${MAKEDIRTARGET} . ${SUBDIR_GROUP.${group}:C/^/install-/} +. endif +.endfor diff --git a/src/share/mk/bsd.clang-analyze.mk b/src/share/mk/bsd.clang-analyze.mk new file mode 100644 index 0000000..81912be --- /dev/null +++ b/src/share/mk/bsd.clang-analyze.mk @@ -0,0 +1,40 @@ +# $NetBSD: bsd.clang-analyze.mk,v 1.3 2012/04/04 10:37:18 joerg Exp $ + +.ifndef CLANG_ANALYZE_SRCS + +CLANG_ANALYZE_FLAGS+= --analyze + +CLANG_ANALYZE_CHECKERS+= core deadcode security unix + +.for checker in ${CLANG_ANALYZE_CHECKERS} +CLANG_ANALYZE_FLAGS+= -Xanalyzer -analyzer-checker=${checker} +.endfor + +.SUFFIXES: .c .cc .cpp .cxx .C .clang-analyzer + +CLANG_ANALYZE_CFLAGS= ${CFLAGS:N-Wa,--fatal-warnings} +CLANG_ANALYZE_CXXFLAGS= ${CXXFLAGS:N-Wa,--fatal-warnings} + +.c.clang-analyzer: + ${TOOL_CC.clang} ${CLANG_ANALYZE_FLAGS} \ + ${CLANG_ANALYZE_CFLAGS} ${CPPFLAGS} \ + ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} \ + ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} +.cc.clang-analyzer .cpp.clang-analyzer .cxx.clang-analyzer .C.clang-analyzer: + ${TOOL_CXX.clang} ${CLANG_ANALYZE_FLAGS} \ + ${CLANG_ANALYZE_CXXFLAGS} ${CPPFLAGS} \ + ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} \ + ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} + +CLANG_ANALYZE_SRCS= \ + ${SRCS:M*.[cC]} ${SRCS:M*.cc} \ + ${SRCS:M*.cpp} ${SRCS:M*.cxx} \ + ${DPSRCS:M*.[cC]} ${DPSRCS:M*.cc} \ + ${DPSRCS:M*.cpp} ${DPSRCS:M*.cxx} +.if !empty(CLANG_ANALYZE_SRCS) +CLANG_ANALYZE_OUTPUT= ${CLANG_ANALYZE_SRCS:R:S,$,.clang-analyzer,} +.endif + +analyze: ${CLANG_ANALYZE_OUTPUT} + +.endif diff --git a/src/share/mk/bsd.clean.mk b/src/share/mk/bsd.clean.mk new file mode 100644 index 0000000..61b34b6 --- /dev/null +++ b/src/share/mk/bsd.clean.mk @@ -0,0 +1,91 @@ +# $NetBSD: bsd.clean.mk,v 1.8 2012/11/19 16:04:54 apb Exp $ + +# +# +# Public targets: +# +# clean: Delete files listed in ${CLEANFILES}. +# cleandir: Delete files listed in ${CLEANFILES} and ${CLEANDIRFILES}. +# +# Public variables: +# +# CLEANFILES Files to remove for both the clean and cleandir targets. +# +# CLEANDIRFILES Files to remove for the cleandir target, but not for +# the clean target. +# +# MKCLEANSRC Whether or not to clean the source directory +# in addition to the object directory. Defaults to "yes". +# +# MKCLEANVERIFY Whether or not to verify that the file deletion worked. +# Defaults to "yes". +# +# The files listed in CLEANFILES and CLEANDIRFILES must not be +# directories, because the potential risk from running "rm -rf" commands +# in bsd.clean.mk is considered too great. If you want to recursively +# delete a directory as part of "make clean" or "make cleandir" then you +# need to provide your own target. + +.if !defined(_BSD_CLEAN_MK_) +_BSD_CLEAN_MK_=1 + +.include + +MKCLEANSRC?= yes +MKCLEANVERIFY?= yes + +clean: .PHONY __doclean +__doclean: .PHONY .MADE __cleanuse CLEANFILES +cleandir: .PHONY clean __docleandir +__docleandir: .PHONY .MADE __cleanuse CLEANDIRFILES + +# __cleanuse is invoked with ${.ALLSRC} as the name of a variable +# (such as CLEANFILES or CLEANDIRFILES), or possibly a list of +# variable names. ${.ALLSRC:@v@${${v}}@} will be the list of +# files to delete. (We pass the variable name, e.g. CLEANFILES, +# instead of the file names, e.g. ${CLEANFILES}, because we don't +# want make to replace any of the file names with the result of +# searching .PATH.) +# +# If the list of files is empty, then the commands +# reduce to "true", with an "@" prefix to prevent echoing. +# +# The use of :M* is needed to handle the case that CLEANFILES +# or CLEANDIRFILES is not completely empty but contains spaces. +# This can easily happen when CLEANFILES or CLEANDIRFILES is set +# from other variables that happen to be empty.) +# +# The use of :Q is needed to handle the case that CLEANFILES +# or CLEANDIRFILES contains quoted strings, such as +# CLEANFILES = "filename with spaces". +# +__cleanuse: .USE +.if 0 # print "# clean CLEANFILES" for debugging + ${"${.ALLSRC:@v@${${v}:M*}@:Q}" == "":?@true:${_MKMSG} \ + "clean" ${.ALLSRC} } +.endif +.for _d in ${"${.OBJDIR}" == "${.CURDIR}" || "${MKCLEANSRC}" == "no" \ + :? ${.OBJDIR} \ + : ${.OBJDIR} ${.CURDIR} } + ${"${.ALLSRC:@v@${${v}:M*}@:Q}" == "":?@true: \ + (cd ${_d} && rm -f ${.ALLSRC:@v@${${v}}@} || true) } +.if "${MKCLEANVERIFY}" == "yes" + @${"${.ALLSRC:@v@${${v}:M*}@:Q}" == "":?true: \ + bad="\$(cd ${_d} && ls -1d ${.ALLSRC:@v@${${v}}@} 2>/dev/null)"; \ + if test -n "\$bad"; then \ + echo "Failed to remove the following files from ${_d}:" ; \ + echo "\$bad" | while read file ; do \ + echo " \$file" ; \ + done ; \ + false ; \ + fi } +.endif +.endfor + +# Don't automatically load ".depend" files during "make clean" +# or "make cleandir". +.if make(clean) || make(cleandir) +.MAKE.DEPENDFILE := .depend.no-such-file +.endif + +.endif # !defined(_BSD_CLEAN_MK) diff --git a/src/share/mk/bsd.dep.mk b/src/share/mk/bsd.dep.mk new file mode 100644 index 0000000..c6cb500 --- /dev/null +++ b/src/share/mk/bsd.dep.mk @@ -0,0 +1,142 @@ +# $NetBSD: bsd.dep.mk,v 1.82 2014/12/01 01:34:30 erh Exp $ + +.if defined(__MINIX) +#LSC: Be a bit smarter about the default compiler +.if exists(/usr/pkg/bin/clang) || exists(/usr/bin/clang) +CC?= clang +.endif + +.if exists(/usr/pkg/bin/gcc) || exists(/usr/bin/gcc) +CC?= gcc +.endif + +MKDEP?= CC=${CC:Q} mkdep +MKDEPCXX?= CC=${CXX:Q} mkdep +.endif # defined(__MINIX) + +##### Basic targets +realdepend: beforedepend .depend afterdepend +.ORDER: beforedepend .depend afterdepend + +beforedepend .depend afterdepend: # ensure existence + +##### Default values +MKDEP?= mkdep +MKDEPCXX?= mkdep +MKDEP_SUFFIXES?= .o .d + +##### Build rules +# some of the rules involve .h sources, so remove them from mkdep line + +.if defined(SRCS) && !empty(SRCS) +__acpp_flags= ${_ASM_TRADITIONAL_CPP} + +.if defined(NODPSRCS) +.for f in ${SRCS} ${DPSRCS} +.if "${NODPSRCS:M${f}}" == "" +__DPSRCS.all+= ${f:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} +.endif +.endfor +beforedepend: ${DPSRCS} +.else +__DPSRCS.all+= ${SRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} \ + ${DPSRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} +.endif +__DPSRCS.d= ${__DPSRCS.all:O:u:M*.d} +__DPSRCS.notd= ${__DPSRCS.all:O:u:N*.d} + +.if defined(__MINIX) +__DPSRCS.bcd= ${"${USE_BITCODE:Uno}" == "yes":? ${SRCS:M*.c:O:u:.c=.bcd}:} +__DPSRCS.d+= ${__DPSRCS.bcd} +.endif # defined(__MINIX) + +.NOPATH: .depend ${__DPSRCS.d} + +.if !empty(__DPSRCS.d) # { +${__DPSRCS.d}: ${__DPSRCS.notd} ${DPSRCS} +.endif # } + +MKDEPSUFFLAGS=-s ${MKDEP_SUFFIXES:Q} + +.if defined(MKDEPINCLUDES) && ${MKDEPINCLUDES} != "no" +.STALE: + @echo Rebuilding dependency file: ${.ALLSRC} + @rm -f ${.ALLSRC} + @(cd ${.CURDIR} && ${MAKE} depend) +_MKDEP_MERGEFLAGS=-i +_MKDEP_FILEFLAGS=${MKDEPSUFFLAGS} +.else +_MKDEP_MERGEFLAGS=${MKDEPSUFFLAGS} +_MKDEP_FILEFLAGS= +.endif + +.depend: ${__DPSRCS.d} + ${_MKTARGET_CREATE} + rm -f .depend + ${MKDEP} ${_MKDEP_MERGEFLAGS} -d -f ${.TARGET} ${__DPSRCS.d} + +.if !defined(__MINIX) +.SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m +.else +.SUFFIXES: .bcd .d .s .S .c .C .cc .cpp .cxx .m + +.if ${USE_BITCODE:Uno} == "yes" +.c.bcd: + ${_MKTARGET_CREATE} + ${MKDEP} -f ${.TARGET} -s .bc -- ${MKDEPFLAGS} \ + ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ + ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} +.endif # ${USE_BITCODE:Uno} == "yes" +.endif # !defined(__MINIX) + +.c.d: + ${_MKTARGET_CREATE} + ${MKDEP} -f ${.TARGET}.tmp ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ + ${CFLAGS:M-std=*} ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ + ${CPPFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} \ + ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} && \ + mv ${.TARGET}.tmp ${.TARGET} + +.m.d: + ${_MKTARGET_CREATE} + ${MKDEP} -f ${.TARGET}.tmp ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ + ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ + ${CPPFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} \ + ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} && \ + mv ${.TARGET}.tmp ${.TARGET} + +.s.d .S.d: + ${_MKTARGET_CREATE} + ${MKDEP} -f ${.TARGET}.tmp ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ + ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ + ${CPPFLAGS} ${AFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} \ + ${__acpp_flags} ${.IMPSRC} && \ + mv ${.TARGET}.tmp ${.TARGET} + +.C.d .cc.d .cpp.d .cxx.d: + ${_MKTARGET_CREATE} + ${MKDEPCXX} -f ${.TARGET}.tmp ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ + ${CXXFLAGS:M-std=*} ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ + ${CPPFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} \ + ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} && \ + mv ${.TARGET}.tmp ${.TARGET} + +.endif # defined(SRCS) && !empty(SRCS) # } + +##### Clean rules +.if defined(SRCS) && !empty(SRCS) +CLEANDIRFILES+= .depend ${__DPSRCS.d} ${__DPSRCS.d:.d=.d.tmp} ${.CURDIR}/tags ${CLEANDEPEND} +.endif + +##### Custom rules +.if !target(tags) +tags: ${SRCS} +.if defined(SRCS) && !empty(SRCS) + ${_MKTARGET_CREATE} + -cd "${.CURDIR}"; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \ + ${TOOL_SED} "s;\${.CURDIR}/;;" > tags +.endif +.endif + +##### Pull in related .mk logic +.include diff --git a/src/share/mk/bsd.doc.mk b/src/share/mk/bsd.doc.mk new file mode 100644 index 0000000..ef3e49f --- /dev/null +++ b/src/share/mk/bsd.doc.mk @@ -0,0 +1,219 @@ +# $NetBSD: bsd.doc.mk,v 1.68 2015/08/04 08:36:14 dholland Exp $ +# @(#)bsd.doc.mk 8.1 (Berkeley) 8/14/93 + +.include + +# The makefile should set these: +# SECTION one of usd, smm, or psd (lower-case) +# ARTICLE name of this document +# SRCS roff source files +# DEPSRCS additional roff source files implicitly included +# MACROS name(s) of roff macro packages, including the -m +# ROFF_PIC set to "yes" to use pic(1) +# ROFF_EQN set to "yes" to use eqn(1) +# ROFF_TBL set to "yes" to use tbl(1) +# ROFF_REFER set to "yes" to use refer(1) +# EXTRAHTMLFILES additional files emitted as part of HTML build +# +# PAGES unknown (XXX) +# EXTRA extra files to install (XXX) +# +# If there are multiple docs to be generated, set these: +# SUBARTICLES= name1 name2 ... +# SRCS.name1= roff source files +# SRCS.name2= more roff source files +# SRCS. : = : +# DEPSRCS.name1= additional included roff source files +# DEPSRCS.name2= more additional included roff source files +# DEPSRCS. : = : +# +# I'm hoping that MACROS and ROFF_* can be uniform across all +# subarticles. + + +# Old bsd.doc.mk files tend to invoke tbl and other preprocessors +# directly; they should be changed to set ROFF_* instead. +# +# Also they set e.g. DIR=usd/72.mydocument; this should be changed +# to SECTION=usd and ARTICLE=mydocument. The article numbers are +# no longer present in the file system and do not need to be known +# at build time. +# + +# 20130908 dholland: Make sure all makefiles have been converted to the +# new scheme. +.if !defined(SECTION) +.error "bsd.doc.mk: SECTION must be defined" +.endif +.if target(paper.ps) +.error "bsd.doc.mk: target(paper.ps) is true -- this is not allowed" +.endif + +# 20130908 dholland: right now we cannot generate pdf from roff sources, +# so build compressed postscript instead. XXX. (and: yech) +TOOL_ROFF_PDF?=false "No roff pdf support" +PRINTABLE=ps.gz +#PRINTABLE=ps +#PRINTABLE=pdf + +# If there aren't subarticles, we generate one doc that has the same +# name as the top-level article. +SUBARTICLES?=${ARTICLE} +SRCS.${ARTICLE}?=${SRCS} +DEPSRCS.${ARTICLE}?=${DEPSRCS} + +##### Build + +.for SA in ${SUBARTICLES} +.if ${MKDOC} != "no" +realall: ${SA}.txt +realall: ${SA}.${PRINTABLE} +.if ${MKHTML} != "no" && ${MKGROFFHTMLDOC} != "no" +realall: ${SA}.html +.endif +.endif +.endfor # SUBARTICLES + +.if defined(ROFF_PIC) && ${ROFF_PIC} != "no" +ROFFFLAGS+=-p +.endif +.if defined(ROFF_EQN) && ${ROFF_EQN} != "no" +ROFFFLAGS+=-e +.endif +.if defined(ROFF_TBL) && ${ROFF_TBL} != "no" +ROFFFLAGS+=-t +.endif +.if defined(ROFF_REFER) && ${ROFF_REFER} != "no" +ROFFFLAGS+=-R +.endif +ROFFFLAGS+=-I${.CURDIR} + +.for SA in ${SUBARTICLES} + +# +# Find the sources. +# +# We can't use .IMPSRC in the rules because they aren't suffix rules +# (they could be for some docs, but not others) and we can't use +# .ALLSRC because that includes DEPSRCS. +# +# As far as I know, the only ways to get the path discovered via .PATH +# are those two magic variables or the P modifier. +# +# For some reason the P modifier finds the path to a variable name, +# not the path to a word in a variable. +# + +.for S in ${SRCS.${SA}} +SRCS2.${SA}+=${${S}:P} +.endfor +.for S in ${DEPSRCS.${SA}} +DEPSRCS2.${SA}+=${${S}:P} +.endfor + +# +# Note: we use TOOL_ROFF_DOCASCII because TOOL_ROFF_ASCII invokes +# the nroff wrapper instead of groff directly, and that doesn't +# understand -I. +# +# We use TOOL_ROFF_DOCHTML because TOOL_ROFF_HTML uses -mdoc2html, +# which is great if it works but doesn't work with at least some of +# the non-mdoc docs. (e.g. the curses one) TOOL_ROFF_DOCHTML uses +# groff -Thtml, which produces fairly blah output but works with these +# docs. It might end up being necessary to choose one or the other on +# a per-document basis... sigh. +# + +${SA}.txt: ${SRCS2.${SA}} ${DEPSRCS2.${SA}} + ${_MKTARGET_FORMAT} + ${TOOL_ROFF_DOCASCII} ${ROFFFLAGS} ${MACROS} ${PAGES} ${SRCS2.${SA}} \ + > ${.TARGET} + +${SA}.ps: ${SRCS2.${SA}} ${DEPSRCS2.${SA}} + ${_MKTARGET_FORMAT} + ${TOOL_ROFF_PS} ${ROFFFLAGS} ${MACROS} ${PAGES} ${SRCS2.${SA}} \ + | ${TOOL_SED} -e '/^%%CreationDate:/d' \ + > ${.TARGET} + +${SA}.pdf: ${SRCS2.${SA}} ${DEPSRCS2.${SA}} + ${_MKTARGET_FORMAT} + ${TOOL_ROFF_PDF} ${ROFFFLAGS} ${MACROS} ${PAGES} ${SRCS2.${SA}} \ + > ${.TARGET} + +${SA}.html: ${SRCS2.${SA}} ${DEPSRCS2.${SA}} + ${_MKTARGET_FORMAT} + ${TOOL_ROFF_DOCHTML} ${ROFFFLAGS} ${MACROS} ${PAGES} ${SRCS2.${SA}} \ + -P -I -P ${SA} \ + > ${.TARGET} + +${SA}.ps.gz: ${SA}.ps + ${TOOL_GZIP} -9 -c -n ${.ALLSRC} > ${.TARGET} + +.endfor # SUBARTICLES + +##### Install + +DOCINST:= +.for SA in ${SUBARTICLES} +DOCINST+=${SA}.txt ${SA}.${PRINTABLE} +.if ${MKHTML} != "no" && ${MKGROFFHTMLDOC} != "no" +DOCINST+=${SA}.html +.endif +.endfor +.if ${MKHTML} != "no" && ${MKGROFFHTMLDOC} != "no" +DOCINST+=${EXTRAHTMLFILES} +.endif + +.if ${MKDOC} != "no" +docinstall: +.for D in ${DOCINST} + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${DOCOWN} -g ${DOCGRP} -m ${DOCMODE} ${D} \ + ${DESTDIR}${DOCDIR}/${SECTION}/${ARTICLE}/${D} +.endfor +.else +docinstall: ; +.endif + +.PHONY: docinstall +realinstall: docinstall + +##### Clean + +cleandoc: +.for SA in ${SUBARTICLES} + rm -f ${SA}.txt ${SA}.ps ${SA}.ps.gz ${SA}.html +.endfor + rm -f ${EXTRAHTMLFILES} [eE]rrs mklog ${CLEANFILES} + +.PHONY: cleandoc +clean: cleandoc + +##### Extra custom rules + +.if !target(print) +print: ; +.PHONY: print +.for SA in ${SUBARTICLES} +print: print.${SA} +.PHONY: print.{SA} +print.${SA}: ${SA}.ps + lpr -P${PRINTER} ${.ALLSRC} +.endfor +.endif + +spell: ; +.PHONY: spell +.for SA in ${SUBARTICLES} +spell: spell.${SA} +.PHONY: spell.{SA} +spell.${SA}: ${SRCS2} ${DEPSRCS2} + spell ${SRCS2} | sort | comm -23 - spell.ok > paper.spell +.endfor + +##### Pull in related .mk logic + +.include +.include + +${TARGETS}: # ensure existence diff --git a/src/share/mk/bsd.endian.mk b/src/share/mk/bsd.endian.mk new file mode 100644 index 0000000..45ebf7c --- /dev/null +++ b/src/share/mk/bsd.endian.mk @@ -0,0 +1,33 @@ +# $NetBSD: bsd.endian.mk,v 1.22 2014/09/19 17:45:42 matt Exp $ + +.if !defined(_BSD_ENDIAN_MK_) +_BSD_ENDIAN_MK_=1 + +.include + +.if ${MACHINE_ARCH} == "aarch64" || \ + ${MACHINE_ARCH} == "alpha" || \ + ${MACHINE_ARCH} == "arm" || \ + (!empty(MACHINE_ARCH:Mearm*) && empty(MACHINE_ARCH:Mearm*eb)) || \ + ${MACHINE_ARCH} == "i386" || \ + ${MACHINE_ARCH} == "ia64" || \ + ${MACHINE_ARCH} == "vax" || \ + ${MACHINE_ARCH} == "riscv32" || \ + ${MACHINE_ARCH} == "riscv64" || \ + ${MACHINE_ARCH} == "x86_64" || \ + ${MACHINE_ARCH:C/^.*el$/el/} == "el" +TARGET_ENDIANNESS= 1234 +.elif ${MACHINE_ARCH} == "coldfire" || \ + ${MACHINE_ARCH} == "hppa" || \ + ${MACHINE_ARCH} == "m68000" || \ + ${MACHINE_ARCH} == "m68k" || \ + ${MACHINE_ARCH} == "or1k" || \ + ${MACHINE_ARCH} == "powerpc" || \ + ${MACHINE_ARCH} == "powerpc64" || \ + ${MACHINE_ARCH} == "sparc" || \ + ${MACHINE_ARCH} == "sparc64" || \ + ${MACHINE_ARCH:C/^.*eb$/eb/} == "eb" +TARGET_ENDIANNESS= 4321 +.endif + +.endif # !defined(_BSD_ENDIAN_MK_) diff --git a/src/share/mk/bsd.files.mk b/src/share/mk/bsd.files.mk new file mode 100644 index 0000000..4a1df65 --- /dev/null +++ b/src/share/mk/bsd.files.mk @@ -0,0 +1,162 @@ +# $NetBSD: bsd.files.mk,v 1.43 2013/04/06 15:39:19 uebayasi Exp $ + +.if !defined(_BSD_FILES_MK_) +_BSD_FILES_MK_=1 + +.include + +.if !target(__fileinstall) +##### Basic targets +realinstall: filesinstall +realall: filesbuild + +##### Default values +FILESDIR?= ${BINDIR} +FILESOWN?= ${BINOWN} +FILESGRP?= ${BINGRP} +FILESMODE?= ${NONBINMODE} + +##### Build rules +filesbuild: +.PHONY: filesbuild + +##### Install rules +filesinstall:: # ensure existence +.PHONY: filesinstall + +configfilesinstall:: .PHONY + +__fileinstall: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} \ + -o ${FILESOWN_${.ALLSRC:T}:U${FILESOWN}} \ + -g ${FILESGRP_${.ALLSRC:T}:U${FILESGRP}} \ + -m ${FILESMODE_${.ALLSRC:T}:U${FILESMODE}} \ + ${SYSPKGTAG} ${.ALLSRC} ${.TARGET} + +.endif # !target(__fileinstall) + + +.for F in ${FILES:O:u} +_FDIR:= ${FILESDIR_${F}:U${FILESDIR}} # dir override +_FNAME:= ${FILESNAME_${F}:U${FILESNAME:U${F:T}}} # name override +_F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path +_FDOBUILD:= ${FILESBUILD_${F}:U${FILESBUILD:Uno}} + +.if ${MKUPDATE} == "no" +${_F}! ${F} __fileinstall # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no") +${_F}! .MADE # no build at install +.endif +.else +${_F}: ${F} __fileinstall # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no") +${_F}: .MADE # no build at install +.endif +.endif + +.if ${_FDOBUILD} != "no" +filesbuild: ${F} +CLEANFILES+= ${F} +.endif + +filesinstall:: ${_F} +.PRECIOUS: ${_F} # keep if install fails +.endfor + + +# +# CONFIGFILES +# +configinstall: configfilesinstall + +.for F in ${CONFIGFILES:O:u} +_FDIR:= ${FILESDIR_${F}:U${FILESDIR}} # dir override +_FNAME:= ${FILESNAME_${F}:U${FILESNAME:U${F:T}}} # name override +_F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path +_FDOBUILD:= ${FILESBUILD_${F}:U${FILESBUILD:Uno}} + +.if ${MKUPDATE} == "no" +${_F}! ${F} __fileinstall # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no") +${_F}! .MADE # no build at install +.endif +.else +${_F}: ${F} __fileinstall # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no") +${_F}: .MADE # no build at install +.endif +.endif + +.if ${_FDOBUILD} != "no" +filesbuild: ${F} +CLEANFILES+= ${F} +.endif + +configfilesinstall:: ${_F} +.PRECIOUS: ${_F} # keep if install fails +.endfor + +.undef _FDIR +.undef _FNAME +.undef _F + + +# +# BUILDSYMLINKS +# +.if defined(BUILDSYMLINKS) # { + +.for _SL _TL in ${BUILDSYMLINKS} +BUILDSYMLINKS.s+= ${_SL} +BUILDSYMLINKS.t+= ${_TL} +${_TL}: ${_SL} + ${_MKMSG} "symlink " ${.CURDIR:T}/${.TARGET} + rm -f ${.TARGET} + ln -s ${.ALLSRC} ${.TARGET} +.endfor + +realall: ${BUILDSYMLINKS.t} + +CLEANDIRFILES+= ${BUILDSYMLINKS.t} + +.endif # } + +# +# .uue -> "" handling (i.e. decode a given binary/object) +# +# UUDECODE_FILES - List of files which are stored in the source tree +# as .uue and should be uudecoded. +# +# UUDECODE_FILES_RENAME_fn - For this file, rename its output to the provided +# name (handled via -p and redirecting stdout) + +.if defined(UUDECODE_FILES) # { +.SUFFIXES: .uue + +.uue: + ${_MKTARGET_CREATE} + rm -f ${.TARGET} + ${TOOL_UUDECODE} -p ${.IMPSRC} > ${.TARGET} + +.if defined(UUDECODE_FILES_RENAME_${UUDECODE_FILES}) +${UUDECODE_FILES_RENAME_${UUDECODE_FILES}}: ${UUDECODE_FILES} + cp ${.ALLSRC} ${.TARGET} +.endif + +realall: ${UUDECODE_FILES} + +CLEANUUDECODE_FILES=${UUDECODE_FILES} +.for i in ${UUDECODE_FILES} +CLEANUUDECODE_FILES+=${UUDECODE_FILES_RENAME_${i}} +.endfor + +CLEANFILES+= ${CLEANUUDECODE_FILES} +.endif # } + +##### Pull in related .mk logic +.include +.include +.include + +.endif # !defined(_BSD_FILES_MK_) diff --git a/src/share/mk/bsd.gcc.mk b/src/share/mk/bsd.gcc.mk new file mode 100644 index 0000000..916bb66 --- /dev/null +++ b/src/share/mk/bsd.gcc.mk @@ -0,0 +1,34 @@ +# $NetBSD: bsd.gcc.mk,v 1.11 2015/06/07 15:04:28 matt Exp $ + +.if !defined(_BSD_GCC_MK_) +_BSD_GCC_MK_=1 + +.if defined(EXTERNAL_TOOLCHAIN) +_GCC_CRTBEGIN!= ${CC} --print-file-name=crtbegin.o +.ifndef _GCC_CRTBEGINS +_GCC_CRTBEGINS!= ${CC} --print-file-name=crtbeginS.o +.endif +_GCC_CRTEND!= ${CC} --print-file-name=crtend.o +.ifndef _GCC_CRTENDS +_GCC_CRTENDS!= ${CC} --print-file-name=crtendS.o +.endif +.ifndef _GCC_CRTI +_GCC_CRTI!= ${CC} --print-file-name=crti.o +.endif +.ifndef _GCC_CRTN +_GCC_CRTN!= ${CC} --print-file-name=crtn.o +.endif +_GCC_CRTDIR!= dirname ${_GCC_CRTBEGIN} +_GCC_LIBGCCDIR!= dirname `${CC} --print-libgcc-file-name` +.else +_GCC_CRTBEGIN?= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtbegin.o +_GCC_CRTBEGINS?= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtbeginS.o +_GCC_CRTEND?= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtend.o +_GCC_CRTENDS?= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtendS.o +_GCC_CRTI?= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crti.o +_GCC_CRTN?= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtn.o +_GCC_CRTDIR?= ${DESTDIR}/usr/lib${MLIBDIR:D/${MLIBDIR}} +_GCC_LIBGCCDIR?= ${DESTDIR}/usr/lib${MLIBDIR:D/${MLIBDIR}} +.endif + +.endif # ! defined(_BSD_GCC_MK_) diff --git a/src/share/mk/bsd.host.mk b/src/share/mk/bsd.host.mk new file mode 100644 index 0000000..1a105e6 --- /dev/null +++ b/src/share/mk/bsd.host.mk @@ -0,0 +1,76 @@ +# $NetBSD: bsd.host.mk,v 1.2 2014/04/10 19:02:18 plunky Exp $ + +.if !defined(_BSD_HOST_MK_) +_BSD_HOST_MK_=1 + +.if ${HOST_OSTYPE:C/\-.*//:U} == "Minix" +HOST_LDFLAGS?= -static + +#LSC: Be a bit smarter about the default compiler +.if exists(/usr/pkg/bin/clang) || exists(/usr/bin/clang) +HOST_CC?= clang +.endif + +.if exists(/usr/pkg/bin/gcc) || exists(/usr/bin/gcc) +HOST_CC?= gcc +.endif +.endif # ${HOST_OSTYPE:C/\-.*//:U} == "Minix" + +# Helpers for cross-compiling +HOST_CC?= cc +HOST_CFLAGS?= -O +HOST_COMPILE.c?=${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} -c +HOST_COMPILE.cc?= ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_CPPFLAGS} -c +HOST_LINK.cc?= ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS} +.if defined(HOSTPROG_CXX) +HOST_LINK.c?= ${HOST_LINK.cc} +.else +HOST_LINK.c?= ${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS} +.endif + +HOST_CXX?= c++ +HOST_CXXFLAGS?= -O + +HOST_CPP?= cpp +HOST_CPPFLAGS?= + +HOST_LD?= ld +HOST_LDFLAGS?= + +HOST_AR?= ar +HOST_RANLIB?= ranlib + +HOST_LN?= ln + +# HOST_SH must be an absolute path +HOST_SH?= /bin/sh + +.if !defined(HOST_OSTYPE) +_HOST_OSNAME!= uname -s +_HOST_OSREL!= uname -r +# For _HOST_ARCH, if uname -p fails, or prints "unknown", or prints +# something that does not look like an identifier, then use uname -m. +_HOST_ARCH!= uname -p 2>/dev/null +_HOST_ARCH:= ${HOST_ARCH:tW:C/.*[^-_A-Za-z0-9].*//:S/unknown//} +.if empty(_HOST_ARCH) +_HOST_ARCH!= uname -m +.endif +HOST_OSTYPE:= ${_HOST_OSNAME}-${_HOST_OSREL:C/\([^\)]*\)//g:[*]:C/ /_/g}-${_HOST_ARCH:C/\([^\)]*\)//g:[*]:C/ /_/g} +.MAKEOVERRIDES+= HOST_OSTYPE +.endif # !defined(HOST_OSTYPE) + +.if ${USETOOLS} == "yes" +HOST_MKDEP?= ${TOOLDIR}/bin/${_TOOL_PREFIX}host-mkdep +HOST_MKDEPCXX?= ${TOOLDIR}/bin/${_TOOL_PREFIX}host-mkdep +.else +HOST_MKDEP?= CC=${HOST_CC:Q} mkdep +HOST_MKDEPCXX?= CC=${HOST_CXX:Q} mkdep +.endif + +.if ${NEED_OWN_INSTALL_TARGET} != "no" +HOST_INSTALL_FILE?= ${INSTALL} ${COPY} ${PRESERVE} ${RENAME} +HOST_INSTALL_DIR?= ${INSTALL} -d +HOST_INSTALL_SYMLINK?= ${INSTALL} ${SYMLINK} ${RENAME} +.endif + +.endif diff --git a/src/share/mk/bsd.hostlib.mk b/src/share/mk/bsd.hostlib.mk new file mode 100644 index 0000000..debf501 --- /dev/null +++ b/src/share/mk/bsd.hostlib.mk @@ -0,0 +1,57 @@ +# $NetBSD: bsd.hostlib.mk,v 1.19 2014/12/01 01:34:30 erh Exp $ + +.include +.include + +##### Basic targets + +##### Default values +CFLAGS+= ${COPTS} +MKDEP_SUFFIXES?= .o .lo .d + +# Override these: +MKDEP:= ${HOST_MKDEP} +MKDEPCXX:= ${HOST_MKDEPCXX} + +.if ${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN) +OBJHOSTMACHINE= # set +.endif + +##### Build rules +.if defined(HOSTLIB) +_YHLSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}} +DPSRCS+= ${_YHLSRCS} +CLEANFILES+= ${_YHLSRCS} +.endif # defined(HOSTLIB) + +.if !empty(SRCS:N*.h:N*.sh) +OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.lo/g} +.endif + +.if defined(OBJS) && !empty(OBJS) +.NOPATH: lib${HOSTLIB}.a ${OBJS} ${_YHLSRCS} + +${OBJS}: ${DPSRCS} + +lib${HOSTLIB}.a: ${OBJS} ${DPADD} + ${_MKTARGET_BUILD} + rm -f ${.TARGET} + ${HOST_AR} cq ${.TARGET} ${OBJS} + ${HOST_RANLIB} ${.TARGET} + +.endif # defined(OBJS) && !empty(OBJS) + +realall: lib${HOSTLIB}.a + +CLEANFILES+= a.out [Ee]rrs mklog core *.core lib${HOSTLIB}.a ${OBJS} + +beforedepend: +CFLAGS:= ${HOST_CFLAGS} +CPPFLAGS:= ${HOST_CPPFLAGS} + +##### Pull in related .mk logic +.include +.include +.include + +${TARGETS}: # ensure existence diff --git a/src/share/mk/bsd.hostprog.mk b/src/share/mk/bsd.hostprog.mk new file mode 100644 index 0000000..9b2b99d --- /dev/null +++ b/src/share/mk/bsd.hostprog.mk @@ -0,0 +1,172 @@ +# $NetBSD: bsd.hostprog.mk,v 1.74 2014/12/01 01:34:30 erh Exp $ +# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94 + +.include +.include + +##### Basic targets + +##### Default values +LIBATF_C?= /usr/lib/libatf-c.a +LIBATF_CXX?= /usr/lib/libatf-c++.a +LIBBLUETOOTH?= /usr/lib/libbluetooth.a +LIBBZ2?= /usr/lib/libbz2.a +LIBC?= /usr/lib/libc.a +LIBC_PIC?= /usr/lib/libc_pic.a +LIBC_SO?= /usr/lib/libc.so +LIBCOMPAT?= /usr/lib/libcompat.a +LIBCRYPT?= /usr/lib/libcrypt.a +LIBCURSES?= /usr/lib/libcurses.a +LIBDBM?= /usr/lib/libdbm.a +LIBDES?= /usr/lib/libdes.a +LIBEDIT?= /usr/lib/libedit.a +LIBEVENT?= /usr/lib/libevent.a +LIBEVENT_OPENSSL?= /usr/lib/libevent_openssl.a +LIBEVENT_PTHREADS?= /usr/lib/libevent_pthreads.a +LIBEXPAT?= /usr/lib/libexpat.a +LIBFETCH?= /usr/lib/libfetch.a +LIBFORM?= /usr/lib/libform.a +LIBGCC?= /usr/lib/libgcc.a +LIBGNUMALLOC?= /usr/lib/libgnumalloc.a +LIBINTL?= /usr/lib/libintl.a +LIBIPSEC?= /usr/lib/libipsec.a +LIBKVM?= /usr/lib/libkvm.a +LIBL?= /usr/lib/libl.a +LIBLUTOK?= /usr/lib/liblutok.a +LIBLZMA?= /usr/lib/liblzma.a +LIBM?= /usr/lib/libm.a +LIBMAGIC?= /usr/lib/libmagic.a +LIBMENU?= /usr/lib/libmenu.a +LIBMP?= /usr/lib/libmp.a +LIBNTP?= /usr/lib/libntp.a +LIBOBJC?= /usr/lib/libobjc.a +LIBP2K?= /usr/lib/libp2k.a +LIBPC?= /usr/lib/libpc.a +LIBPCAP?= /usr/lib/libpcap.a +LIBPCI?= /usr/lib/libpci.a +LIBPLOT?= /usr/lib/libplot.a +LIBPOSIX?= /usr/lib/libposix.a +LIBPUFFS?= /usr/lib/libpuffs.a +LIBQUOTA?= /usr/lib/libquota.a +LIBRESOLV?= /usr/lib/libresolv.a +LIBRPCSVC?= /usr/lib/librpcsvc.a +LIBRUMP?= /usr/lib/librump.a +LIBRUMPCLIENT?= /usr/lib/librumpclient.a +LIBRUMPNET?= /usr/lib/librumpnet.a +LIBRUMPUSER?= /usr/lib/librumpuser.a +LIBRUMPVFS?= /usr/lib/librumpvfs.a +LIBSKEY?= /usr/lib/libskey.a +LIBSQLITE3?= /usr/lib/libsqlite3.a +LIBSSP?= /usr/lib/libssp.a +LIBSTDCXX?= /usr/lib/libstdc++.a +LIBSUPCXX?= /usr/lib/libsupc++.a +LIBTERMINFO?= /usr/lib/libterminfo.a +LIBUTIL?= /usr/lib/libutil.a +LIBWRAP?= /usr/lib/libwrap.a +LIBUKFS?= /usr/lib/libukfs.a +LIBY?= /usr/lib/liby.a +LIBZ?= /usr/lib/libz.a + +##### rump file system modules +LIBRUMPFS_CD9660FS?= /usr/lib/librumpfs_cd9660fs.a +LIBRUMPFS_EFS?= /usr/lib/librumpfs_efs.a +LIBRUMPFS_EXT2FS?= /usr/lib/librumpfs_ext2fs.a +LIBRUMPFS_FFS?= /usr/lib/librumpfs_ffs.a +LIBRUMPFS_HFS?= /usr/lib/librumpfs_hfs.a +LIBRUMPFS_LFS?= /usr/lib/librumpfs_lfs.a +LIBRUMPFS_MSDOSFS?= /usr/lib/librumpfs_msdosfs.a +LIBRUMPFS_NTFS?= /usr/lib/librumpfs_ntfs.a +LIBRUMPFS_SYSPUFFS?= /usr/lib/librumpfs_syspuffs.a +LIBRUMPFS_TMPFS?= /usr/lib/librumpfs_tmpfs.a +LIBRUMPFS_UDF?= /usr/lib/librumpfs_udf.a +LIBRUMPFS_UFS?= /usr/lib/librumpfs_ufs.a + +MKDEP_SUFFIXES?= .lo .ln .d + +# Override these: +INSTALL:= ${INSTALL:NSTRIP=*} +MKDEP:= ${HOST_MKDEP} +MKDEPCXX:= ${HOST_MKDEPCXX} + +.if ${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN) +OBJHOSTMACHINE= # set +.endif + +##### Build rules +.if defined(HOSTPROG_CXX) +HOSTPROG= ${HOSTPROG_CXX} +.endif + +.if defined(HOSTPROG) +SRCS?= ${HOSTPROG}.c + +_YHPSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}} +DPSRCS+= ${_YHPSRCS} +CLEANFILES+= ${_YHPSRCS} + +.if !empty(SRCS:N*.h:N*.sh) +OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.lo/g} +LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} +.endif + +.if defined(OBJS) && !empty(OBJS) +.NOPATH: ${OBJS} ${HOSTPROG} ${_YHPSRCS} + +${OBJS} ${LOBJS}: ${DPSRCS} +${HOSTPROG}: ${OBJS} ${DPADD} + ${_MKTARGET_LINK} + ${HOST_LINK.c} ${HOST_LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD} +.if !empty(.MAKE.OS:M*CYGWIN*) + ${HOST_SH} ${NETBSDSRCDIR}/tools/binstall/mkmanifest ${HOSTPROG} +.endif + + +.endif # defined(OBJS) && !empty(OBJS) + +.if !defined(MAN) +MAN= ${HOSTPROG}.1 +.endif # !defined(MAN) +.endif # defined(HOSTPROG) + +realall: ${HOSTPROG} + +CLEANFILES+= a.out [Ee]rrs mklog core *.core ${HOSTPROG} ${OBJS} ${LOBJS} + +beforedepend: +CFLAGS:= ${HOST_CFLAGS} +CPPFLAGS:= ${HOST_CPPFLAGS:N-Wp,-iremap,*} + +lint: ${LOBJS} +.if defined(LOBJS) && !empty(LOBJS) + ${LINT} ${LINTFLAGS} ${LDFLAGS:C/-L[ ]*/-L/Wg:M-L*} ${LOBJS} ${LDADD} +.endif + +##### Pull in related .mk logic +LINKSMODE?= ${BINMODE} +.include +.include +.include +.include +.include +.include +.include + +${TARGETS}: # ensure existence + +# Override YACC/LEX rules so nbtool_config.h can be forced as the 1st include +.l.c: + ${_MKTARGET_LEX} + ${LEX.l} -o${.TARGET} ${.IMPSRC} + echo '#if HAVE_NBTOOL_CONFIG_H' > ${.TARGET}.1 + echo '#include "nbtool_config.h"' >> ${.TARGET}.1 + echo '#endif' >> ${.TARGET}.1 + cat ${.TARGET} >> ${.TARGET}.1 + mv ${.TARGET}.1 ${.TARGET} +.y.c: + ${_MKTARGET_YACC} + ${YACC.y} -o ${.TARGET} ${.IMPSRC} + echo '#if HAVE_NBTOOL_CONFIG_H' > ${.TARGET}.1 + echo '#include "nbtool_config.h"' >> ${.TARGET}.1 + echo '#endif' >> ${.TARGET}.1 + cat ${.TARGET} >> ${.TARGET}.1 + mv ${.TARGET}.1 ${.TARGET} diff --git a/src/share/mk/bsd.inc.mk b/src/share/mk/bsd.inc.mk new file mode 100644 index 0000000..9672743 --- /dev/null +++ b/src/share/mk/bsd.inc.mk @@ -0,0 +1,57 @@ +# $NetBSD: bsd.inc.mk,v 1.32 2006/03/16 18:43:34 jwise Exp $ + +.include + +##### Basic targets +includes: ${INCS} incinstall inclinkinstall + +##### Default values +INCSYMLINKS?= + +##### Install rules +incinstall:: # ensure existence +.PHONY: incinstall + +# -c is forced on here, in order to preserve modtimes for "make depend" +__incinstall: .USE + @cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \ + (${_MKSHMSG_INSTALL} ${.TARGET}; \ + ${_MKSHECHO} "${INSTALL_FILE} -c -o ${BINOWN} -g ${BINGRP} \ + -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}" && \ + ${INSTALL_FILE} -c -o ${BINOWN} -g ${BINGRP} \ + -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}) + +.for F in ${INCS:O:u} +_FDIR:= ${INCSDIR_${F:C,/,_,g}:U${INCSDIR}} # dir override +_FNAME:= ${INCSNAME_${F:C,/,_,g}:U${INCSNAME:U${F}}} # name override +_F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path + +.if ${MKUPDATE} == "no" +${_F}! ${F} __incinstall # install rule +.else +${_F}: ${F} __incinstall # install rule +.endif + +incinstall:: ${_F} +.PRECIOUS: ${_F} # keep if install fails +.endfor + +.undef _FDIR +.undef _FNAME +.undef _F + +inclinkinstall: .PHONY +.if !empty(INCSYMLINKS) + @(set ${INCSYMLINKS}; \ + while test $$# -ge 2; do \ + l=$$1; shift; \ + t=${DESTDIR}$$1; shift; \ + if ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \ + [ "$$l" = "$$ttarg" ]; then \ + continue ; \ + fi ; \ + ${_MKSHMSG_INSTALL} $$t; \ + ${_MKSHECHO} ${INSTALL_SYMLINK} $$l $$t; \ + ${INSTALL_SYMLINK} $$l $$t; \ + done; ) +.endif diff --git a/src/share/mk/bsd.info.mk b/src/share/mk/bsd.info.mk new file mode 100644 index 0000000..ef6bd1f --- /dev/null +++ b/src/share/mk/bsd.info.mk @@ -0,0 +1,87 @@ +# $NetBSD: bsd.info.mk,v 1.40 2011/09/10 16:57:35 apb Exp $ + +.include + +##### Basic targets +realinstall: infoinstall + +##### Default values +INFOFLAGS?= + +INFOFILES?= + +##### Build rules +.if ${MKINFO} != "no" + +INFOFILES= ${TEXINFO:C/\.te?xi(nfo)?$/.info/} + +realall: ${INFOFILES} +.NOPATH: ${INFOFILES} + +.SUFFIXES: .txi .texi .texinfo .info + +.txi.info .texi.info .texinfo.info: + ${_MKTARGET_CREATE} + ${TOOL_MAKEINFO} ${INFOFLAGS} --no-split --no-version-header -o ${.TARGET} ${.IMPSRC} + +.endif # ${MKINFO} != "no" + +##### Install rules +infoinstall:: # ensure existence +.PHONY: infoinstall + +.if ${MKINFO} != "no" + +INFODIRFILE=${DESTDIR}${INFODIR}/dir + +# serialize access to ${INFODIRFILE}; needed for parallel makes +__infoinstall: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} \ + -o ${INFOOWN_${.ALLSRC:T}:U${INFOOWN}} \ + -g ${INFOGRP_${.ALLSRC:T}:U${INFOGRP}} \ + -m ${INFOMODE_${.ALLSRC:T}:U${INFOMODE}} \ + ${.ALLSRC} ${.TARGET} + @[ -f ${INFODIRFILE} ] && \ + while ! ln ${INFODIRFILE} ${INFODIRFILE}.lock 2> /dev/null; \ + do sleep 1; done; \ + ${TOOL_INSTALL_INFO} -d ${INFODIRFILE} -r ${.TARGET} 2> /dev/null; \ + ${TOOL_INSTALL_INFO} -d ${INFODIRFILE} ${.TARGET}; \ + rm -f ${INFODIRFILE}.lock + + +.for F in ${INFOFILES:O:u} +_FDIR:= ${INFODIR_${F}:U${INFODIR}} # dir overrides +_FNAME:= ${INFONAME_${F}:U${INFONAME:U${F:T}}} # name overrides +_F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path + +.if ${MKUPDATE} == "no" +${_F}! ${F} __infoinstall # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}! .MADE # no build at install +.endif +.else +${_F}: ${F} __infoinstall # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}: .MADE # no build at install +.endif +.endif + +infoinstall:: ${_F} +.PRECIOUS: ${_F} # keep if install fails +.endfor + +.undef _FDIR +.undef _FNAME +.undef _F +.endif # ${MKINFO} != "no" + +##### Clean rules +CLEANDIRFILES+= ${INFOFILES} + +##### Pull in related .mk logic +.include +.include +.include + +${TARGETS}: # ensure existence diff --git a/src/share/mk/bsd.init.mk b/src/share/mk/bsd.init.mk new file mode 100644 index 0000000..22dc168 --- /dev/null +++ b/src/share/mk/bsd.init.mk @@ -0,0 +1,13 @@ +# $NetBSD: bsd.init.mk,v 1.2 2003/07/28 02:38:33 lukem Exp $ + +# includes Makefile.inc and ; this is used at the +# top of all files which actually "build something". + +.if !defined(_BSD_INIT_MK_) +_BSD_INIT_MK_=1 + +.-include "${.CURDIR}/../Makefile.inc" +.include +.MAIN: all + +.endif # !defined(_BSD_INIT_MK_) diff --git a/src/share/mk/bsd.ioconf.mk b/src/share/mk/bsd.ioconf.mk new file mode 100644 index 0000000..c1acac5 --- /dev/null +++ b/src/share/mk/bsd.ioconf.mk @@ -0,0 +1,41 @@ +# $NetBSD: bsd.ioconf.mk,v 1.5 2014/11/30 15:53:29 uebayasi Exp $ +# + +.include + +# If IOCONF is defined, autocreate ioconf.[ch] and locators.h. +# This is useful mainly for devices. +.if !empty(IOCONF) + +# discourage direct inclusion. bsd.ioconf.mk will hopefully go away +# when the kernel build procedures are unified. +.if defined(_BSD_IOCONF_MK_USER_) + +# XXX: ioconf.c doesn't need to depend on TOOL_CONFIG, but that helps +# keep builds working while hashing out some of the experimental +# features related to ioconf. +.if ${USETOOLS} == "yes" +CONFIGDEP=${TOOL_CONFIG} +.endif +ioconf.c: ${IOCONF} ${CONFIGDEP} + ${TOOL_CONFIG} ${CONFIGOPTS} -b ${.OBJDIR} -s ${S} \ + ${IOCONFDIR:U${.CURDIR}}/${IOCONF} + # config doesn't change the files if they're unchanged. however, + # here we want to satisfy our make dependency, so force a + # timestamp update + touch ioconf.c ioconf.h locators.h + +.else # _BSD_IOCONF_MK_USER_ + +ioconf.c: + @echo do not include bsd.ioconf.mk directly + @false + +.endif # _BSD_IOCONF_MK_USER_ + +locators.h: ioconf.c +ioconf.h: ioconf.c + +CLEANFILES+= ioconf.c ioconf.h locators.h +DPSRCS+= ioconf.c ioconf.h locators.h +.endif diff --git a/src/share/mk/bsd.kernobj.mk b/src/share/mk/bsd.kernobj.mk new file mode 100644 index 0000000..ba3c9ed --- /dev/null +++ b/src/share/mk/bsd.kernobj.mk @@ -0,0 +1,33 @@ +# $NetBSD: bsd.kernobj.mk,v 1.14 2013/06/03 07:39:07 mrg Exp $ + +# KERNSRCDIR Is the location of the top of the kernel src. +# It defaults to `${NETBSDSRCDIR}/sys'. +# +# KERNARCHDIR Is the location of the machine dependent kernel sources. +# It defaults to `arch/${MACHINE}', but may be overridden +# in case ${MACHINE} is not correct. +# +# KERNCONFDIRDEFAULT Is the default for ${KERNCONFDIR}. +# It defaults to `${KERNSRCDIR}/${KERNARCHDIR}/conf'. +# +# KERNCONFDIR Is where the configuration files for kernels are found. +# Users can set this to have build.sh find kernel +# configurations in another directory. +# It defaults to `${KERNCONFDIRDEFAULT}'. +# +# KERNOBJDIR Is the kernel build directory. The kernel GENERIC for +# instance will be compiled in ${KERNOBJDIR}/GENERIC. +# The default is the .OBJDIR of +# `${KERNSRCDIR}/${KERNARCHDIR}/compile'. +# + +.include + +KERNSRCDIR?= ${NETBSDSRCDIR}/sys +KERNARCHDIR?= arch/${MACHINE} +KERNCONFDIRDEFAULT?= ${KERNSRCDIR}/${KERNARCHDIR}/conf +KERNCONFDIR?= ${KERNCONFDIRDEFAULT} + +.if !defined(KERNOBJDIR) && exists(${KERNSRCDIR}/${KERNARCHDIR}/compile) +KERNOBJDIR!= cd "${KERNSRCDIR}/${KERNARCHDIR}/compile" && ${PRINTOBJDIR} +.endif diff --git a/src/share/mk/bsd.kinc.mk b/src/share/mk/bsd.kinc.mk new file mode 100644 index 0000000..bb4b035 --- /dev/null +++ b/src/share/mk/bsd.kinc.mk @@ -0,0 +1,84 @@ +# $NetBSD: bsd.kinc.mk,v 1.36 2006/03/16 18:43:34 jwise Exp $ + +# Variables: +# +# INCSDIR Directory to install includes into (and/or make, and/or +# symlink, depending on what's going on). +# +# INCS Headers to install. +# +# DEPINCS Headers to install which are built dynamically. +# +# SUBDIR Subdirectories to enter +# +# INCSYMLINKS Symlinks to make (unconditionally), a la bsd.links.mk. +# Note that the original bits will be 'rm -rf'd rather than +# just 'rm -f'd, to make the right thing happen with include +# directories. +# + +.include + +##### Basic targets +.PRECIOUS: ${DESTDIR}${INCSDIR} +includes: ${DESTDIR}${INCSDIR} .WAIT ${INCS} incinstall + +##### Install rules +incinstall:: # ensure existence +.PHONY: incinstall + +# make sure the directory is OK, and install includes. + +${DESTDIR}${INCSDIR}: .EXEC + @if [ ! -d ${.TARGET} ] || [ -h ${.TARGET} ] ; then \ + ${_MKSHMSG_CREATE} ${.TARGET}; \ + /bin/rm -rf ${.TARGET}; \ + ${_MKSHECHO} ${INSTALL_DIR} -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${.TARGET}; \ + ${INSTALL_DIR} -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${.TARGET}; \ + fi + +# -c is forced on here, in order to preserve modtimes for "make depend" +__incinstall: .USE + @cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \ + (${_MKSHMSG_INSTALL} ${.TARGET}; \ + ${_MKSHECHO} "${INSTALL_FILE} -c -o ${BINOWN} -g ${BINGRP} \ + -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}" && \ + ${INSTALL_FILE} -c -o ${BINOWN} -g ${BINGRP} \ + -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}) + +.for F in ${INCS:O:u} ${DEPINCS:O:u} +_F:= ${DESTDIR}${INCSDIR}/${F} # installed path + +.if ${MKUPDATE} == "no" +${_F}! ${F} __incinstall # install rule +.else +${_F}: ${F} __incinstall # install rule +.endif + +incinstall:: ${_F} +.PRECIOUS: ${_F} # keep if install fails +.endfor + +.undef _F + +.if defined(INCSYMLINKS) && !empty(INCSYMLINKS) +incinstall:: + @(set ${INCSYMLINKS}; \ + while test $$# -ge 2; do \ + l=$$1; shift; \ + t=${DESTDIR}$$1; shift; \ + if ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \ + [ "$$l" = "$$ttarg" ]; then \ + continue ; \ + fi ; \ + ${_MKSHMSG_INSTALL} $$t; \ + ${_MKSHECHO} ${INSTALL_SYMLINK} $$l $$t; \ + ${INSTALL_SYMLINK} $$l $$t; \ + done; ) +.endif + +##### Pull in related .mk logic +.include +.include diff --git a/src/share/mk/bsd.klinks.mk b/src/share/mk/bsd.klinks.mk new file mode 100644 index 0000000..2616e4a --- /dev/null +++ b/src/share/mk/bsd.klinks.mk @@ -0,0 +1,87 @@ +# $NetBSD: bsd.klinks.mk,v 1.13 2014/08/10 05:57:31 matt Exp $ +# + +.include + +KLINK_MACHINE?= ${MACHINE} + +##### Default values +.if !defined(S) +.if defined(NETBSDSRCDIR) +S= ${NETBSDSRCDIR}/sys +.elif defined(BSDSRCDIR) +S= ${BSDSRCDIR}/sys +.else +S= /sys +.endif +.endif + +CLEANFILES+= machine ${MACHINE_CPU} ${KLINK_MACHINE} +.if ${KLINK_MACHINE} == "sun2" || ${KLINK_MACHINE} == "sun3" +CLEANFILES+= sun68k +.elif ${KLINK_MACHINE} == "sparc64" +CLEANFILES+= sparc +.elif ${KLINK_MACHINE} == "i386" +CLEANFILES+= x86 +.elif ${KLINK_MACHINE} == "amd64" +CLEANFILES+= x86 i386 +.elif ${KLINK_MACHINE} == "evbmips" +CLEANFILES+= algor sbmips +.elif ${MACHINE_CPU} == "aarch64" +CLEANFILES+= arm +.endif + +.if defined(XEN_BUILD) || ${KLINK_MACHINE} == "xen" +CLEANFILES+= xen xen-ma/machine # xen-ma +CPPFLAGS+= -I${.OBJDIR}/xen-ma +.if ${MACHINE_CPU} == "i386" +CLEANFILES+= x86 +.endif +.endif + +# XXX. This should be done a better way. It's @'d to reduce visual spew. +# XXX .BEGIN is used to make sure the links are done before anything else. +.if !make(obj) && !make(clean) && !make(cleandir) +.BEGIN: + -@rm -f machine && \ + ln -s $S/arch/${KLINK_MACHINE}/include machine + -@rm -f ${KLINK_MACHINE} && \ + ln -s $S/arch/${KLINK_MACHINE}/include ${KLINK_MACHINE} + -@if [ -d $S/arch/${MACHINE_CPU} ]; then \ + rm -f ${MACHINE_CPU} && \ + ln -s $S/arch/${MACHINE_CPU}/include ${MACHINE_CPU}; \ + fi +# XXX. it gets worse.. +.if ${KLINK_MACHINE} == "sun2" || ${KLINK_MACHINE} == "sun3" + -@rm -f sun68k && \ + ln -s $S/arch/sun68k/include sun68k +.endif +.if ${KLINK_MACHINE} == "sparc64" + -@rm -f sparc && \ + ln -s $S/arch/sparc/include sparc +.endif +.if ${KLINK_MACHINE} == "amd64" + -@rm -f i386 && \ + ln -s $S/arch/i386/include i386 +.endif +.if ${MACHINE_CPU} == "i386" || ${MACHINE_CPU} == "x86_64" + -@rm -f x86 && \ + ln -s $S/arch/x86/include x86 +.endif +.if ${MACHINE_CPU} == "aarch64" + -@rm -f arm && \ + ln -s $S/arch/arm/include arm +.endif +.if defined(XEN_BUILD) || ${KLINK_MACHINE} == "xen" + -@rm -f xen && \ + ln -s $S/arch/xen/include xen + -@rm -rf xen-ma && mkdir xen-ma && \ + ln -s ../${XEN_BUILD:U${MACHINE_ARCH}} xen-ma/machine +.endif +.if ${KLINK_MACHINE} == "evbmips" + -@rm -f algor && \ + ln -s $S/arch/algor/include algor + -@rm -f sbmips && \ + ln -s $S/arch/sbmips/include sbmips +.endif +.endif diff --git a/src/share/mk/bsd.kmodule.mk b/src/share/mk/bsd.kmodule.mk new file mode 100644 index 0000000..970bb6a --- /dev/null +++ b/src/share/mk/bsd.kmodule.mk @@ -0,0 +1,249 @@ +# $NetBSD: bsd.kmodule.mk,v 1.55 2015/07/09 14:50:08 matt Exp $ + +# We are not building this with PIE +MKPIE=no + +.include +.include +.include + +##### Basic targets +realinstall: kmodinstall + +KERN= $S/kern +MKLDSCRIPT?= no + +CFLAGS+= -ffreestanding ${COPTS} +CPPFLAGS+= -nostdinc -I. -I${.CURDIR} -isystem $S -isystem $S/arch +CPPFLAGS+= -isystem ${S}/../common/include +CPPFLAGS+= -D_KERNEL -D_LKM -D_MODULE -DSYSCTL_INCLUDE_DESCR + +# XXX until the kernel is fixed again... +CFLAGS+= -fno-strict-aliasing -Wno-pointer-sign + +# XXX This is a workaround for platforms that have relative relocations +# that, when relocated by the module loader, result in addresses that +# overflow the size of the relocation (e.g. R_PPC_REL24 in powerpc). +# The real solution to this involves generating trampolines for those +# relocations inside the loader and removing this workaround, as the +# resulting code would be much faster. +.if ${MACHINE_CPU} == "arm" +CFLAGS+= -fno-common -fno-unwind-tables +.elif ${MACHINE_CPU} == "hppa" +CFLAGS+= -mlong-calls +.elif ${MACHINE_CPU} == "powerpc" +CFLAGS+= ${${ACTIVE_CC} == "gcc":? -mlongcall :} +.elif ${MACHINE_CPU} == "vax" +CFLAGS+= -fno-pic +.elif ${MACHINE_CPU} == "riscv" +CFLAGS+= -fPIC -Wa,-fno-pic +.elif ${MACHINE_ARCH} == "mips64eb" && !defined(BSD_MK_COMPAT_FILE) +CFLAGS+= -mabi=64 +LDFLAGS+= -Wl,-m,elf64btsmip +.elif ${MACHINE_ARCH} == "mips64el" && !defined(BSD_MK_COMPAT_FILE) +CFLAGS+= -mabi=64 +LDFLAGS+= -Wl,-m,elf64ltsmip +.endif + +.if ${MACHINE_CPU} == "sparc64" +# force same memory model as rest of the kernel +CFLAGS+= ${${ACTIVE_CC} == "gcc":? -mcmodel=medlow :} +CFLAGS+= ${${ACTIVE_CC} == "clang":? -mcmodel=small :} +.endif + +# evbppc needs some special help +.if ${MACHINE} == "evbppc" + +. ifndef PPC_INTR_IMPL +PPC_INTR_IMPL=\"powerpc/intr.h\" +. endif +. ifndef PPC_PCI_MACHDEP_IMPL +PPC_PCI_MACHDEP_IMPL=\"powerpc/pci_machdep.h\" +. endif +CPPFLAGS+= -DPPC_INTR_IMPL=${PPC_INTR_IMPL} +CPPFLAGS+= -DPPC_PCI_MACHDEP_IMPL=${DPPC_PCI_MACHDEP_IMPL} + +. ifdef PPC_IBM4XX +CPPFLAGS+= -DPPC_IBM4XX +. elifdef PPC_BOOKE +CPPFLAGS+= -DPPC_BOOKE +. else +CPPFLAGS+= -DPPC_OEA +. endif + +.endif + + +_YKMSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}} +DPSRCS+= ${_YKMSRCS} +CLEANFILES+= ${_YKMSRCS} + +.if exists($S/../sys/modules/xldscripts/kmodule) +KMODSCRIPTSRC= $S/../sys/modules/xldscripts/kmodule +.else +KMODSCRIPTSRC= ${DESTDIR}/usr/libdata/ldscripts/kmodule +.endif +.if ${MKLDSCRIPT} == "yes" +KMODSCRIPT= kldscript +MKLDSCRIPTSH= +.else +KMODSCRIPT= ${KMODSCRIPTSRC} +.endif + +PROG?= ${KMOD}.kmod + +##### Build rules +realall: ${PROG} + +.if (defined(USE_COMBINE) && ${USE_COMBINE} != "no" && !commands(${_P}) \ + && !defined(NOCOMBINE.${_P}) && !defined(NOCOMBINE)) +.for f in ${SRCS:N*.h:N*.sh:N*.fth:C/\.[yl]$/.c/g} +.if (${CPPFLAGS.$f:D1} == "1" || ${CPUFLAGS.$f:D2} == "2" \ + || ${COPTS.$f:D3} == "3" || ${OBJCOPTS.$f:D4} == "4" \ + || ${CXXFLAGS.$f:D5} == "5") \ + || ("${f:M*.[cyl]}" == "" || commands(${f:R:S/$/.o/})) +XOBJS+= ${f:R:S/$/.o/} +.else +XSRCS+= ${f} +NODPSRCS+= ${f} +.endif +.endfor + +.if !empty(XOBJS) +${XOBJS}: ${DPSRCS} +.endif + +.if ${MKLDSCRIPT} == "yes" +${KMODSCRIPT}: ${KMODSCRIPTSRC} ${XOBJS} $S/conf/mkldscript.sh + @rm -f ${.TARGET} + @OBJDUMP=${OBJDUMP} ${HOST_SH} $S/conf/mkldscript.sh \ + -t ${KMODSCRIPTSRC} ${XOBJS} > ${.TARGET} +.endif + +${PROG}: ${XOBJS} ${XSRCS} ${DPSRCS} ${DPADD} ${KMODSCRIPT} + ${CC} ${LDFLAGS} -nostdlib -MD -combine -r -Wl,-T,${KMODSCRIPT},-d \ + -Wl,-Map=${.TARGET}.map \ + -o ${.TARGET} ${CFLAGS} ${CPPFLAGS} ${XOBJS} \ + ${XSRCS:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} && \ + echo '.-include "${KMOD}.d"' > .depend + +.else +OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g} + +${OBJS} ${LOBJS}: ${DPSRCS} + +.if ${MKLDSCRIPT} == "yes" +${KMODSCRIPT}: ${KMODSCRIPTSRC} ${OBJS} $S/conf/mkldscript.sh + @rm -f ${.TARGET} + @OBJDUMP=${OBJDUMP} ${HOST_SH} $S/conf/mkldscript.sh \ + -t ${KMODSCRIPTSRC} ${OBJS} > ${.TARGET} +.endif + +.if ${MACHINE_CPU} == "arm" +# The solution to limited branch space involves generating trampolines for +# those relocations while creating the module, as the resulting code will +# be much faster and simplifies the loader. +ARCHDIR= $S/modules/arch/${MACHINE_CPU} +ASM_H= $S/arch/${MACHINE_CPU}/include/asm.h +CLEANFILES+= tmp.o tmp.S ${KMOD}_tmp.o ${KMOD}_tramp.o ${KMOD}_tramp.S +${KMOD}_tmp.o: ${OBJS} ${DPADD} + ${_MKTARGET_LINK} + ${LD} -r -o tmp.o ${OBJS} + ${LD} -r \ + `${OBJDUMP} --syms --reloc tmp.o | \ + ${TOOL_AWK} -f ${ARCHDIR}/kmodwrap.awk` \ + -o ${.TARGET} tmp.o + +${KMOD}_tramp.S: ${KMOD}_tmp.o ${ARCHDIR}/kmodtramp.awk ${ASM_H} + ${_MKTARGET_CREATE} + ${OBJDUMP} --syms --reloc ${KMOD}_tmp.o | \ + ${TOOL_AWK} -f ${ARCHDIR}/kmodtramp.awk \ + > tmp.S && \ + mv tmp.S ${.TARGET} + +${PROG}: ${KMOD}_tmp.o ${KMOD}_tramp.o + ${_MKTARGET_LINK} +.if exists(${ARCHDIR}/kmodhide.awk) + ${LD} -r -Map=${.TARGET}.map \ + -o tmp.o ${KMOD}_tmp.o ${KMOD}_tramp.o + ${OBJCOPY} \ + `${NM} tmp.o | ${TOOL_AWK} -f ${ARCHDIR}/kmodhide.awk` \ + tmp.o ${.TARGET} && \ + rm tmp.o +.else + ${LD} -r -Map=${.TARGET}.map \ + -o ${.TARGET} ${KMOD}_tmp.o ${KMOD}_tramp.o +.endif +.else +${PROG}: ${OBJS} ${DPADD} ${KMODSCRIPT} + ${_MKTARGET_LINK} + ${CC} ${LDFLAGS} -nostdlib -r -Wl,-T,${KMODSCRIPT},-d \ + -Wl,-Map=${.TARGET}.map \ + -o ${.TARGET} ${OBJS} +.endif +.endif + +##### Install rules +.if !target(kmodinstall) +.if !defined(KMODULEDIR) +_OSRELEASE!= ${HOST_SH} $S/conf/osrelease.sh -k +# Ensure these are recorded properly in METALOG on unprived installes: +KMODULEARCHDIR?= ${MACHINE} +_INST_DIRS= ${DESTDIR}/stand/${KMODULEARCHDIR} +_INST_DIRS+= ${DESTDIR}/stand/${KMODULEARCHDIR}/${_OSRELEASE} +_INST_DIRS+= ${DESTDIR}/stand/${KMODULEARCHDIR}/${_OSRELEASE}/modules +KMODULEDIR= ${DESTDIR}/stand/${KMODULEARCHDIR}/${_OSRELEASE}/modules/${KMOD} +.endif +_PROG:= ${KMODULEDIR}/${PROG} # installed path + +.if ${MKUPDATE} == "no" +${_PROG}! ${PROG} # install rule +.if !defined(BUILD) && !make(all) && !make(${PROG}) +${_PROG}! .MADE # no build at install +.endif +.else +${_PROG}: ${PROG} # install rule +.if !defined(BUILD) && !make(all) && !make(${PROG}) +${_PROG}: .MADE # no build at install +.endif +.endif + ${_MKTARGET_INSTALL} + dirs=${_INST_DIRS:Q}; \ + for d in $$dirs; do \ + ${INSTALL_DIR} $$d; \ + done + ${INSTALL_DIR} ${KMODULEDIR} + ${INSTALL_FILE} -o ${KMODULEOWN} -g ${KMODULEGRP} -m ${KMODULEMODE} \ + ${.ALLSRC} ${.TARGET} + +kmodinstall:: ${_PROG} +.PHONY: kmodinstall +.PRECIOUS: ${_PROG} # keep if install fails + +.undef _PROG +.endif # !target(kmodinstall) + +##### Clean rules +CLEANFILES+= a.out [Ee]rrs mklog core *.core ${PROG} ${OBJS} ${LOBJS} +CLEANFILES+= ${PROG}.map +.if ${MKLDSCRIPT} == "yes" +CLEANFILES+= kldscript +.endif + +##### Custom rules +lint: ${LOBJS} +.if defined(LOBJS) && !empty(LOBJS) + ${LINT} ${LINTFLAGS} ${LDFLAGS:C/-L[ ]*/-L/Wg:M-L*} ${LOBJS} ${LDADD} +.endif + +##### Pull in related .mk logic +LINKSOWN?= ${KMODULEOWN} +LINKSGRP?= ${KMODULEGRP} +LINKSMODE?= ${KMODULEMODE} +.include +.include +.include +.include + +.-include "$S/arch/${MACHINE_CPU}/include/Makefile.inc" +.-include "$S/arch/${MACHINE}/include/Makefile.inc" diff --git a/src/share/mk/bsd.lib.mk b/src/share/mk/bsd.lib.mk new file mode 100644 index 0000000..73867e3 --- /dev/null +++ b/src/share/mk/bsd.lib.mk @@ -0,0 +1,968 @@ +# $NetBSD: bsd.lib.mk,v 1.362 2015/09/08 16:06:42 uebayasi Exp $ +# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 + +.include +.include +.include +# Pull in here so we can override its .c.o rule +.include + +LIBISMODULE?= no +LIBISPRIVATE?= no +LIBISCXX?= no + +.if ${LIBISMODULE} != "no" +_LIB_PREFIX?= # empty +MKDEBUGLIB:= no +MKLINT:= no +MKPICINSTALL:= no +MKPROFILE:= no +MKSTATICLIB:= no +.else +_LIB_PREFIX?= lib +.endif + +.if ${LIBISPRIVATE} != "no" +MKDEBUGLIB:= no +MKLINT:= no +MKPICINSTALL:= no +. if defined(NOSTATICLIB) && ${MKPICLIB} != "no" +MKSTATICLIB:= no +. else +MKPIC:= no +. endif +MKPROFILE:= no +.endif + +##### Basic targets +.PHONY: checkver libinstall +realinstall: checkver libinstall + +##### LIB specific flags. +# XXX: This is needed for programs that link with .a libraries +# Perhaps a more correct solution is to always generate _pic.a +# files or always have a shared library. +.if defined(MKPIE) && (${MKPIE} != "no") +CFLAGS+= ${PIE_CFLAGS} +AFLAGS+= ${PIE_AFLAGS} +.endif + +##### Libraries that this may depend upon. +.if defined(LIBDPLIBS) && ${MKPIC} != "no" # { +.for _lib _dir in ${LIBDPLIBS} +.if !defined(LIBDO.${_lib}) +LIBDO.${_lib}!= cd "${_dir}" && ${PRINTOBJDIR} +.MAKEOVERRIDES+=LIBDO.${_lib} +.endif +.if ${LIBDO.${_lib}} == "_external" +LDADD+= -l${_lib} +.else +LDADD+= -L${LIBDO.${_lib}} -l${_lib} +DPADD+= ${LIBDO.${_lib}}/lib${_lib}.so # Don't use _LIB_PREFIX +.endif +.endfor +.endif # } + +##### Build and install rules +MKDEP_SUFFIXES?= .o .po .pico .go .ln .d + +.if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE}) # { +SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major +SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor +SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny + +DPADD+= ${SHLIB_VERSION_FILE} + +# Check for higher installed library versions. +.if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \ + exists(${NETBSDSRCDIR}/lib/checkver) +checkver: + @(cd "${.CURDIR}" && \ + HOST_SH=${HOST_SH:Q} AWK=${TOOL_AWK:Q} \ + ${HOST_SH} ${NETBSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \ + -d ${_DEST.OBJ} ${LIB}) +.endif +.endif # } + +.if !target(checkver) +checkver: +.endif + +print-shlib-major: +.if defined(SHLIB_MAJOR) && ${MKPIC} != "no" + @echo ${SHLIB_MAJOR} +.else + @false +.endif + +print-shlib-minor: +.if defined(SHLIB_MINOR) && ${MKPIC} != "no" + @echo ${SHLIB_MINOR} +.else + @false +.endif + +print-shlib-teeny: +.if defined(SHLIB_TEENY) && ${MKPIC} != "no" + @echo ${SHLIB_TEENY} +.else + @false +.endif + +.if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR) # { +.if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR) +.if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY) +SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY} +.else +SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} +.endif +.else +SHLIB_FULLVERSION=${SHLIB_MAJOR} +.endif +.endif # } + +# add additional suffixes not exported. +# .po is used for profiling object files. +# .pico is used for PIC object files. +.SUFFIXES: .out .a .ln .pico .po .go .o .s .S .c .cc .cpp .cxx .C .m .F .f .r .y .l .cl .p .h +.SUFFIXES: .sh .m4 .m + + +# Set PICFLAGS to cc flags for producing position-independent code, +# if not already set. + +# Data-driven table using make variables to control how shared libraries +# are built for different platforms and object formats. +# SHLIB_MAJOR, SHLIB_MINOR, SHLIB_TEENY: Major, minor, and teeny version +# numbers of shared library +# SHLIB_SOVERSION: version number to be compiled into a shared library +# via -soname. Usualy ${SHLIB_MAJOR} on ELF. +# NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR} +# [.${SHLIB_TEENY}]] +# SHLIB_SHFLAGS: Flags to tell ${LD} to emit shared library. +# with ELF, also set shared-lib version for ld.so. +# SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors +# SHLIB_LDENDFILE: support .o file, call C++ file-level destructors + +PICFLAGS ?= -fPIC + +.if ${MKPICLIB} != "no" +CSHLIBFLAGS+= ${PICFLAGS} +.endif + +.if defined(CSHLIBFLAGS) && !empty(CSHLIBFLAGS) +MKSHLIBOBJS= yes +.else +MKSHLIBOBJS= no +.endif + +.if (defined(MKDEBUG) && (${MKDEBUG} != "no")) || \ + (defined(CFLAGS) && !empty(CFLAGS:M*-g*)) +# We only add -g to the shared library objects +# because we don't currently split .a archives. +CSHLIBFLAGS+= -g +.if ${LIBISPRIVATE} == "yes" +CFLAGS+= -g +.endif +.endif + +# Platform-independent linker flags for ELF shared libraries +SHLIB_SOVERSION= ${SHLIB_MAJOR} +SHLIB_SHFLAGS= -Wl,-soname,${_LIB}.so.${SHLIB_SOVERSION} +.if !defined(SHLIB_WARNTEXTREL) || ${SHLIB_WARNTEXTREL} != "no" +SHLIB_SHFLAGS+= -Wl,--warn-shared-textrel +.endif +.if !defined(SHLIB_MKMAP) || ${SHLIB_MKMAP} != "no" +SHLIB_SHFLAGS+= -Wl,-Map=${_LIB}.so.${SHLIB_SOVERSION}.map +.endif +CLEANFILES+= ${_LIB}.so.${SHLIB_SOVERSION}.map +SHLIB_LDSTARTFILE?= ${_GCC_CRTI} ${_GCC_CRTBEGINS} +SHLIB_LDENDFILE?= ${_GCC_CRTENDS} ${_GCC_CRTN} + +CFLAGS+= ${COPTS} +OBJCFLAGS+= ${OBJCOPTS} +AFLAGS+= ${COPTS} +FFLAGS+= ${FOPTS} + +.if defined(CTFCONVERT) +.if defined(CFLAGS) && !empty(CFLAGS:M*-g*) +CTFFLAGS+= -g +.if defined(HAVE_GCC) && ${HAVE_GCC} >= 48 +#CFLAGS+= -gdwarf-2 +.endif +.endif +.endif + +LIBSTRIPAOBJS= yes +.if !defined(CFLAGS) || empty(CFLAGS:M*-g*) +LIBSTRIPCOBJS= yes +.endif +.if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*) +LIBSTRIPOBJCOBJS= yes +.endif +.if !defined(FFLAGS) || empty(FFLAGS:M*-g*) +LIBSTRIPFOBJS= yes +.endif +.if !defined(CSHLIBFLAGS) || empty(CSHLIBFLAGS:M*-g*) +LIBSTRIPSHLIBOBJS= yes +.endif + +.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" +SHLIB_SHFLAGS+= -L ${DESTDIR}/usr/lib +SHLIB_SHFLAGS+= -Wl,-plugin=${GOLD_PLUGIN} \ + -Wl,-plugin-opt=-disable-opt + +SECTIONIFYPASS?=${NETBSDSRCDIR}/minix/llvm/bin/sectionify.so +# dcvmoole: the following construction is a hack for libmagicrt. For reasons +# not entirely under our control, clang refuses to take .bc objects even when +# using the gold linker, saying that LLVM IR code cannot be linked. In order +# to sidestep this, libmagicrt uses the name "foo.bc.o" instead of "foo.bc" to +# link the its LLVM IR objects. As all libmagicrt modules use the sectionify +# pass below, and this step needs temporary files, we give the temporary files +# the .o suffix (while anything would do!), and allow the libmagicrt makefile +# to override the rename to the real file name to perform a copy instead. As +# a result, libmagicrt ends up with both the .bc and .bc.o objects, and it can +# pass the latter set to clang, bypassing clang's overly strict checks. +SECTIONIFYMV?=mv -f + +.S.bc: ${.TARGET:.bc=.o} + rm -f ${.TARGET} + ln ${.TARGET:.bc=.o} ${.TARGET} +.c.bc: + ${_MKTARGET_COMPILE} + ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -flto + if [ -n '${SECTIONIFY.${.IMPSRC:T}:U${SECTIONIFY}}' ]; then \ + ${OPT} -load ${SECTIONIFYPASS} -sectionify ${SECTIONIFY.${.IMPSRC:T}:U${SECTIONIFY}} -o ${.TARGET}.o ${.TARGET} && ${SECTIONIFYMV} ${.TARGET}.o ${.TARGET}; \ + fi + +.cc.bc .cxx.bc .cpp.bc: + ${_MKTARGET_COMPILE} + ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -flto +.endif # defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" +.c.o: + ${_MKTARGET_COMPILE} + ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPCOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.c.po: + ${_MKTARGET_COMPILE} + ${COMPILE.c} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPCOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.c.go: + ${_MKTARGET_COMPILE} + ${COMPILE.c} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET} + +.c.pico: + ${_MKTARGET_COMPILE} + ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET} +.if defined(LIBSTRIPSHLIBOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.cc.o .cpp.o .cxx.o .C.o: + ${_MKTARGET_COMPILE} + ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(LIBSTRIPCOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.cc.po .cpp.po .cxx.po .C.po: + ${_MKTARGET_COMPILE} + ${COMPILE.cc} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET} +.if defined(LIBSTRIPCOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.cc.go .cpp.go .cxx.go .C.go: + ${_MKTARGET_COMPILE} + ${COMPILE.cc} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET} + +.cc.pico .cpp.pico .cxx.pico .C.pico: + ${_MKTARGET_COMPILE} + ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET} +.if defined(LIBSTRIPSHLIBOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.f.o: + ${_MKTARGET_COMPILE} + ${COMPILE.f} ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPFOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.f.po: + ${_MKTARGET_COMPILE} + ${COMPILE.f} ${PROFFLAGS} -pg ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPFOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.f.go: + ${_MKTARGET_COMPILE} + ${COMPILE.f} ${DEBUGFLAGS} -g ${.IMPSRC} -o ${.TARGET} + +.f.pico: + ${_MKTARGET_COMPILE} + ${COMPILE.f} ${PICFLAGS} ${.IMPSRC} -o ${.TARGET} +.if defined(LIBSTRIPFOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.f.ln: + ${_MKTARGET_COMPILE} + @echo Skipping lint for Fortran libraries. + +.m.o: + ${_MKTARGET_COMPILE} + ${COMPILE.m} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPOBJCOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.m.po: + ${_MKTARGET_COMPILE} + ${COMPILE.m} ${PROFFLAGS} -pg ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPOBJCOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.m.go: + ${_MKTARGET_COMPILE} + ${COMPILE.m} ${DEBUGFLAGS} -g ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(LIBSTRIPOBJCOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.m.pico: + ${_MKTARGET_COMPILE} + ${COMPILE.m} ${CSHLIBFLAGS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(LIBSTRIPOBJCOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.s.o: + ${_MKTARGET_COMPILE} + ${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPAOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.S.o: + ${_MKTARGET_COMPILE} + ${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPAOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.s.po: + ${_MKTARGET_COMPILE} + ${COMPILE.s} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPAOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.S.po: + ${_MKTARGET_COMPILE} + ${COMPILE.S} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPAOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.s.go: + ${_MKTARGET_COMPILE} + ${COMPILE.s} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} + +.S.go: + ${_MKTARGET_COMPILE} + ${COMPILE.S} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} + +.s.pico: + ${_MKTARGET_COMPILE} + ${COMPILE.s} ${PICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(LIBSTRIPAOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.S.pico: + ${_MKTARGET_COMPILE} + ${COMPILE.S} ${PICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(LIBSTRIPAOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +# Declare a few variables to make our life easier later. +_LIB:=${_LIB_PREFIX}${LIB} +_LIB.a:=${_LIB}.a +_LIB_p.a:=${_LIB}_p.a +_LIB_g.a:=${_LIB}_g.a +_LIB_pic.a:=${_LIB}_pic.a +_LIB.ln:=llib-l${LIB}.ln +.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" +_LIB_bc.a:=${_LIB}_bc.a +.endif # defined(__MINIX) + +.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION) +_LIB.so:=${_LIB}.so +_LIB.so.major:=${_LIB}.so.${SHLIB_MAJOR} +_LIB.so.full:=${_LIB}.so.${SHLIB_FULLVERSION} +_LIB.so.link:=${_LIB}.so.${SHLIB_FULLVERSION}.link +.if ${MKDEBUG} != "no" +_LIB.so.debug:=${_LIB.so.full}.debug +.endif +.endif + +_DEST.LIB:=${DESTDIR}${LIBDIR} +_DEST.OBJ:=${DESTDIR}${_LIBSODIR} +_DEST.LINT:=${DESTDIR}${LINTLIBDIR} +_DEST.DEBUG:=${DESTDIR}${DEBUGDIR}${LIBDIR} +_DEST.ODEBUG:=${DESTDIR}${DEBUGDIR}${_LIBSODIR} + +.if defined(LIB) # { +.if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \ + || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no" +_LIBS=${_LIB.a} +.else +_LIBS= +.endif + +.if ${LIBISPRIVATE} != "no" \ + && (defined(USE_COMBINE) && ${USE_COMBINE} == "yes" \ + && !defined(NOCOMBINE)) # { +.for f in ${SRCS:N*.h:N*.sh:C/\.[yl]$/.c/g} +COMBINEFLAGS.${LIB}.$f := ${CPPFLAGS.$f:D1} ${CPUFLAGS.$f:D2} ${COPTS.$f:D3} ${OBJCOPTS.$f:D4} ${CXXFLAGS.$f:D5} +.if empty(COMBINEFLAGS.${LIB}.${f}) && !defined(NOCOMBINE.$f) +COMBINESRCS+= ${f} +NODPSRCS+= ${f} +.else +OBJS+= ${f:R:S/$/.o/} +.endif +.endfor + +.if !empty(COMBINESRCS) +OBJS+= ${_LIB}_combine.o +${_LIB}_combine.o: ${COMBINESRCS} + ${_MKTARGET_COMPILE} + ${COMPILE.c} -MD --combine ${.ALLSRC} -o ${.TARGET} +.if defined(LIBSTRIPOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +CLEANFILES+= ${_LIB}_combine.d + +.if exists("${_LIB}_combine.d") +.include "${_LIB}_combine.d" +.endif +.endif # empty(XSRCS.${LIB}) +.else # } { +OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g} +.endif # } + +STOBJS+=${OBJS} + +LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} + +.if ${LIBISPRIVATE} != "no" +# No installation is required +libinstall:: +.endif + +.if ${MKDEBUGLIB} != "no" +_LIBS+=${_LIB_g.a} +GOBJS+=${OBJS:.o=.go} +DEBUGFLAGS?=-DDEBUG +.endif + +.if ${MKPROFILE} != "no" +_LIBS+=${_LIB_p.a} +POBJS+=${OBJS:.o=.po} +PROFFLAGS?=-DGPROF -DPROF +.endif + +.if ${MKPIC} != "no" # { +.if ${MKPICLIB} == "no" +.if ${MKSHLIBOBJS} != "no" +# make _pic.a, which isn't really pic, +# since it's needed for making shared lib. +# but don't install it. +SOLIB=${_LIB_pic.a} +SOBJS+=${OBJS:.o=.pico} +.else +SOLIB=${_LIB.a} +.endif +.else +SOLIB=${_LIB_pic.a} +_LIBS+=${SOLIB} +SOBJS+=${OBJS:.o=.pico} +.endif +.if defined(SHLIB_FULLVERSION) +_LIBS+=${_LIB.so.full} +.endif +.endif # } + +.if ${MKLINT} != "no" && !empty(LOBJS) +_LIBS+=${_LIB.ln} +.endif + +ALLOBJS= +.if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \ + || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no" +ALLOBJS+=${STOBJS} +.endif +ALLOBJS+=${POBJS} ${SOBJS} +.if ${MKLINT} != "no" && !empty(LOBJS) +ALLOBJS+=${LOBJS} +.endif +.else # !defined(LIB) # } { +LOBJS= +SOBJS= +.endif # !defined(LIB) # } + +_YLSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}} + +.if ${USE_BITCODE:Uno} == "yes" +.if defined(LIB) +_LIBS+=${_LIB_bc.a} +.endif +.endif # ${USE_BITCODE:Uno} == "yes" + +.NOPATH: ${ALLOBJS} ${_LIBS} ${_YLSRCS} + +realall: ${SRCS} ${ALLOBJS:O} ${_LIBS} ${_LIB.so.debug} + +MKARZERO?= ${MKREPRO:Uno} + +.if ${MKARZERO} == "yes" +_ARFL=crsD +_ARRANFL=sD +_INSTRANLIB= +.else +_ARFL=crs +_ARRANFL=s +.if ${USE_BITCODE:Uno} == "yes" +_INSTRANLIB=${empty(PRESERVE):?-a "${AR} --plugin ${GOLD_PLUGIN} -s":} +.else +_INSTRANLIB=${empty(PRESERVE):?-a "${RANLIB} -t":} +.endif # ${USE_BITCODE:Uno} == "yes" +.endif + +# If you change this, please consider reflecting the change in +# the override in sys/rump/Makefile.rump. +.if !target(__archivebuild) +__archivebuild: .USE + ${_MKTARGET_BUILD} + rm -f ${.TARGET} + ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` +.endif + +.if !target(__archiveinstall) +__archiveinstall: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${_INSTRANLIB} ${.ALLSRC} ${.TARGET} +.endif + +__archivesymlinkpic: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET} + +DPSRCS+= ${_YLSRCS} +CLEANFILES+= ${_YLSRCS} + +${STOBJS} ${POBJS} ${GOBJS} ${SOBJS} ${LOBJS}: ${DPSRCS} + +.if ${USE_BITCODE:Uno} == "yes" + +.if !target(__archivebuildbc) +__archivebuildbc: .USE + ${_MKTARGET_BUILD} + rm -f ${.TARGET} + ${AR} ${_ARFL} --plugin ${GOLD_PLUGIN} ${.TARGET} ${.ALLSRC:M*bc} +.endif + +# LSC: Ignore libunwind in the bitcode archive, otherwise final linking chokes +# on libunwind hidden assembly symbols. +BCOBJS+=${OBJS:Nlibunwind.*:.o=.bc} +ALLOBJS+=${BCOBJS} +${_LIB_bc.a}:: ${BCOBJS} __archivebuildbc + +.endif # ${USE_BITCODE:Uno} == "yes" + +${_LIB.a}:: ${STOBJS} __archivebuild + +${_LIB_p.a}:: ${POBJS} __archivebuild + +${_LIB_pic.a}:: ${SOBJS} __archivebuild + +${_LIB_g.a}:: ${GOBJS} __archivebuild + + +_LIBLDOPTS= +.if ${SHLIBDIR} != "/usr/lib" +_LIBLDOPTS+= -Wl,-rpath,${SHLIBDIR} \ + -L=${SHLIBDIR} +.elif ${SHLIBINSTALLDIR} != "/usr/lib" +_LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \ + -L=${SHLIBINSTALLDIR} +.endif + +# gcc -shared now adds -lc automatically. For libraries other than libc and +# libgcc* we add as a dependency the installed shared libc. For libc and +# libgcc* we avoid adding libc as a dependency by using -nostdlib. Note that +# -Xl,-nostdlib is not enough because we want to tell the compiler-driver not +# to add standard libraries, not the linker. +.if !defined(LIB) +.if !empty(LIBC_SO) +DPLIBC ?= ${DESTDIR}${LIBC_SO} +.endif +.else +.if ${LIB} != "c" && ${LIB:Mgcc*} == "" \ + && ${LIB} != "sys" && ${LIB} != "minc" && ${LIB} != "mthread" # Minix-specific libs +.if !empty(LIBC_SO) +DPLIBC ?= ${DESTDIR}${LIBC_SO} +.endif +.else +LDLIBC ?= -nodefaultlibs +.if ${HAVE_LIBGCC} == "yes" && (${LIB} == "c" || ${LIB} == "minc") +.if !defined(__MINIX) +LDADD+= -lgcc +.else +LDADD+= ${${ACTIVE_CC} == "gcc":? -lgcc:} +.if ${MACHINE_ARCH} == "earm" +LDADD+= ${${ACTIVE_CC} == "gcc":? -lgcc_eh:} +.endif # ${MACHINE_ARCH} == "earm" +.endif # !defined(__MINIX) +.endif +.endif +.endif + +.if ${LIBISCXX} != "no" +LIBCC:= ${CXX} +. if ${MKLIBCXX} == "yes" +LIBDPLIBS+= c++ ${.CURDIR}/../../../../../external/bsd/libc++/lib +. else +LIBDPLIBS+= stdc++ ${.CURDIR}/../../../../../external/gpl3/${EXTERNAL_GCC_SUBDIR}/lib/libstdc++-v3 +. endif +.else +LIBCC:= ${CC} +.endif + +_LDADD.${_LIB}= ${LDADD} ${LDADD.${_LIB}} +_LDFLAGS.${_LIB}= ${LDFLAGS} ${LDFLAGS.${_LIB}} + +_MAINLIBDEPS= ${SOLIB} ${DPADD} ${DPLIBC} \ + ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE} + +.if defined(_LIB.so.debug) +${_LIB.so.debug}: ${_LIB.so.link} + ${_MKTARGET_CREATE} + ( ${OBJCOPY} --only-keep-debug \ + ${_LIB.so.link} ${_LIB.so.debug} \ + ) || (rm -f ${.TARGET}; false) +${_LIB.so.full}: ${_LIB.so.link} ${_LIB.so.debug} + ${_MKTARGET_CREATE} + ( ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \ + --add-gnu-debuglink=${_LIB.so.debug} \ + ${_LIB.so.link} ${_LIB.so.full} \ + ) || (rm -f ${.TARGET}; false) +${_LIB.so.link}: ${_MAINLIBDEPS} +.else # aka no MKDEBUG +${_LIB.so.full}: ${_MAINLIBDEPS} +.endif + ${_MKTARGET_BUILD} + rm -f ${.TARGET} + ${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} \ + ${_LDFLAGS.${_LIB}} -o ${.TARGET} ${_LIBLDOPTS} \ + -Wl,--whole-archive ${SOLIB} \ + -Wl,--no-whole-archive ${_LDADD.${_LIB}} +# We don't use INSTALL_SYMLINK here because this is just +# happening inside the build directory/objdir. XXX Why does +# this spend so much effort on libraries that aren't live??? XXX +# XXX Also creates dead symlinks until the .full rule runs +# above and creates the main link +.if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \ + "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}" + ${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so.major}.tmp + mv -f ${_LIB.so.major}.tmp ${_LIB.so.major} +.endif + ${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so}.tmp + mv -f ${_LIB.so}.tmp ${_LIB.so} +.if ${MKSTRIPIDENT} != "no" + ${OBJCOPY} -R .ident ${.TARGET} +.endif + +.if !empty(LOBJS) # { +LLIBS?= -lc +${_LIB.ln}: ${LOBJS} + ${_MKTARGET_COMPILE} + rm -f ${.TARGET} +.if defined(DESTDIR) + ${LINT} -C${LIB} ${.ALLSRC} -L${DESTDIR}/usr/libdata ${LLIBS} +.else + ${LINT} -C${LIB} ${.ALLSRC} ${LLIBS} +.endif +.endif # } + +lint: ${LOBJS} +.if defined(LOBJS) && !empty(LOBJS) + ${LINT} ${LINTFLAGS} ${LOBJS} +.endif + + +# If the number of entries in CLEANFILES is too large, then the +# commands in bsd.clean.mk encounter errors like "exec(/bin/sh) +# failed (Argument list too long)". Avoid that by splitting the +# files to clean into several lists using different variable names. +# __cleanuse is an internal target in bsd.clean.mk; the way we +# use it here mimics the way it's used by the clean target in +# bsd.clean.mk. +# +clean: libclean1 libclean2 libclean3 libclean4 libclean5 +libclean1: .PHONY .MADE __cleanuse LIBCLEANFILES1 +libclean2: .PHONY .MADE __cleanuse LIBCLEANFILES2 +libclean3: .PHONY .MADE __cleanuse LIBCLEANFILES3 +libclean4: .PHONY .MADE __cleanuse LIBCLEANFILES4 +libclean5: .PHONY .MADE __cleanuse LIBCLEANFILES5 +.if defined(__MINIX) +# MINIX: core conflicts with core/ in lib/liblwip +CLEANFILES+= a.out [Ee]rrs mklog *.core +.else +CLEANFILES+= a.out [Ee]rrs mklog core *.core +.endif # defined(__MINIX) +LIBCLEANFILES1+= ${_LIB.a} ${STOBJS} ${STOBJS:=.tmp} +LIBCLEANFILES2+= ${_LIB_p.a} ${POBJS} ${POBJS:=.tmp} +LIBCLEANFILES3+= ${_LIB_g.a} ${GOBJS} ${GOBJS:=.tmp} +LIBCLEANFILES4+= ${_LIB_pic.a} +.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION) +LIBCLEANFILES4+= ${_LIB.so}.* ${_LIB.so} ${_LIB.so.debug} +.endif +LIBCLEANFILES4+= ${SOBJS} ${SOBJS:=.tmp} +LIBCLEANFILES5+= ${_LIB.ln} ${LOBJS} + +.if defined(__MINIX) +clean: libclean6 +libclean6: .PHONY .MADE __cleanuse LIBCLEANFILES6 +LIBCLEANFILES6+= ${_LIB_bc.a} ${BCOBJS} ${BCOBJS:=.tmp} +.endif + +.if !target(libinstall) # { +# Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no +libinstall:: + +.if ${USE_BITCODE:Uno} == "yes" +libinstall:: ${_DEST.LIB}/bc/${_LIB.a} +.PRECIOUS: ${_DEST.LIB}/bc/${_LIB.a} + +.if ${MKUPDATE} == "no" +.if !defined(BUILD) && !make(all) && !make(${_LIB_bc.a}) +${_DEST.LIB}/bc/${_LIB.a}! .MADE +.endif +${_DEST.LIB}/bc/${_LIB.a}! ${_LIB_bc.a} __archiveinstall +.else +.if !defined(BUILD) && !make(all) && !make(${_LIB_bc.a}) +${_DEST.LIB}/bc/${_LIB.a}: .MADE +.endif +${_DEST.LIB}/bc/${_LIB.a}: ${_LIB_bc.a} __archiveinstall +.endif +.endif # ${USE_BITCODE:Uno} == "yes" + +.if ${MKLINKLIB} != "no" && ${MKSTATICLIB} != "no" +libinstall:: ${_DEST.LIB}/${_LIB.a} +.PRECIOUS: ${_DEST.LIB}/${_LIB.a} + +.if ${MKUPDATE} == "no" +.if !defined(BUILD) && !make(all) && !make(${_LIB.a}) +${_DEST.LIB}/${_LIB.a}! .MADE +.endif +${_DEST.LIB}/${_LIB.a}! ${_LIB.a} __archiveinstall +.else +.if !defined(BUILD) && !make(all) && !make(${_LIB.a}) +${_DEST.LIB}/${_LIB.a}: .MADE +.endif +${_DEST.LIB}/${_LIB.a}: ${_LIB.a} __archiveinstall +.endif +.endif + +.if ${MKPROFILE} != "no" +libinstall:: ${_DEST.LIB}/${_LIB_p.a} +.PRECIOUS: ${_DEST.LIB}/${_LIB_p.a} + +.if ${MKUPDATE} == "no" +.if !defined(BUILD) && !make(all) && !make(${_LIB_p.a}) +${_DEST.LIB}/${_LIB_p.a}! .MADE +.endif +${_DEST.LIB}/${_LIB_p.a}! ${_LIB_p.a} __archiveinstall +.else +.if !defined(BUILD) && !make(all) && !make(${_LIB_p.a}) +${_DEST.LIB}/${_LIB_p.a}: .MADE +.endif +${_DEST.LIB}/${_LIB_p.a}: ${_LIB_p.a} __archiveinstall +.endif +.endif + +.if ${MKDEBUGLIB} != "no" +libinstall:: ${_DEST.LIB}/${_LIB_g.a} +.PRECIOUS: ${_DEST.LIB}/${_LIB_g.a} + +.if ${MKUPDATE} == "no" +.if !defined(BUILD) && !make(all) && !make(${_LIB_g.a}) +${_DEST.LIB}/${_LIB_g.a}! .MADE +.endif +${_DEST.LIB}/${_LIB_g.a}! ${_LIB_g.a} __archiveinstall +.else +.if !defined(BUILD) && !make(all) && !make(${LIB_g.a}) +${_DEST.LIB}/${_LIB_g.a}: .MADE +.endif +${_DEST.LIB}/${_LIB_g.a}: ${_LIB_g.a} __archiveinstall +.endif +.endif + +.if ${MKPIC} != "no" && ${MKPICINSTALL} != "no" +libinstall:: ${_DEST.LIB}/${_LIB_pic.a} +.PRECIOUS: ${_DEST.LIB}/${_LIB_pic.a} + +.if ${MKUPDATE} == "no" +.if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a}) +${_DEST.LIB}/${_LIB_pic.a}! .MADE +.endif +.if ${MKPICLIB} == "no" +${_DEST.LIB}/${_LIB_pic.a}! ${_LIB.a} __archivesymlinkpic +.else +${_DEST.LIB}/${_LIB_pic.a}! ${_LIB_pic.a} __archiveinstall +.endif +.else +.if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a}) +${_DEST.LIB}/${_LIB_pic.a}: .MADE +.endif +.if ${MKPICLIB} == "no" +${_DEST.LIB}/${_LIB_pic.a}: ${_LIB.a} __archivesymlinkpic +.else +${_DEST.LIB}/${_LIB_pic.a}: ${_LIB_pic.a} __archiveinstall +.endif +.endif +.endif + +.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION) + +libinstall:: ${_DEST.OBJ}/${_LIB.so.full} +.PRECIOUS: ${_DEST.OBJ}/${_LIB.so.full} + +.if ${MKUPDATE} == "no" +.if !defined(BUILD) && !make(all) && !make(${_LIB.so.full}) +${_DEST.OBJ}/${_LIB.so.full}! .MADE +.endif +${_DEST.OBJ}/${_LIB.so.full}! ${_LIB.so.full} +.else +.if !defined(BUILD) && !make(all) && !make(${_LIB.so.full}) +${_DEST.OBJ}/${_LIB.so.full}: .MADE +.endif +${_DEST.OBJ}/${_LIB.so.full}: ${_LIB.so.full} +.endif + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${.ALLSRC} ${.TARGET} +.if ${_LIBSODIR} != ${LIBDIR} + ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \ + ${_DEST.LIB}/${_LIB.so.full} +.endif +.if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \ + "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}" + ${INSTALL_SYMLINK} ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so.major} +.if ${_LIBSODIR} != ${LIBDIR} + ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \ + ${_DEST.LIB}/${_LIB.so.major} +.endif +.endif +.if ${MKLINKLIB} != "no" + ${INSTALL_SYMLINK} ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so} +.if ${_LIBSODIR} != ${LIBDIR} + ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \ + ${_DEST.LIB}/${_LIB.so} +.endif +.endif +.endif + +.if defined(_LIB.so.debug) +libinstall:: ${_DEST.DEBUG}/${_LIB.so.debug} +.PRECIOUS: ${_DEST.DEBUG}/${_LIB.so.debug} + +${_DEST.DEBUG}/${_LIB.so.debug}: ${_LIB.so.debug} + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \ + ${.ALLSRC} ${.TARGET} +.if ${_LIBSODIR} != ${LIBDIR} + ${INSTALL_SYMLINK} -l r ${_DEST.DEBUG}/${_LIB.so.debug} \ + ${_DEST.ODEBUG}/${_LIB.so.debug} +.endif +.endif + +.if ${MKLINT} != "no" && !empty(LOBJS) +libinstall:: ${_DEST.LINT}/${_LIB.ln} +.PRECIOUS: ${_DEST.LINT}/${_LIB.ln} + +.if ${MKUPDATE} == "no" +.if !defined(BUILD) && !make(all) && !make(${_LIB.ln}) +${_DEST.LINT}/${_LIB.ln}! .MADE +.endif +${_DEST.LINT}/${_LIB.ln}! ${_LIB.ln} +.else +.if !defined(BUILD) && !make(all) && !make(${_LIB.ln}) +${_DEST.LINT}/${_LIB.ln}: .MADE +.endif +${_DEST.LINT}/${_LIB.ln}: ${_LIB.ln} +.endif + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${.ALLSRC} ${_DEST.LINT} +.endif +.endif # !target(libinstall) # } + +##### Pull in related .mk logic +LINKSOWN?= ${LIBOWN} +LINKSGRP?= ${LIBGRP} +LINKSMODE?= ${LIBMODE} +.include +.include +.include +.include +.include +.include +.include +.include + +${TARGETS}: # ensure existence diff --git a/src/share/mk/bsd.links.mk b/src/share/mk/bsd.links.mk new file mode 100644 index 0000000..067236d --- /dev/null +++ b/src/share/mk/bsd.links.mk @@ -0,0 +1,96 @@ +# $NetBSD: bsd.links.mk,v 1.34 2009/04/10 16:16:12 apb Exp $ + +.include + +##### Basic targets +install: linksinstall + +##### Default values +LINKS?= +SYMLINKS?= +LINKSOWN?= ${BINOWN} +LINKSGRP?= ${BINGRP} +LINKSMODE?= ${NONBINMODE} + +__linkinstall: .USE + ${_MKSHMSG_INSTALL} ${.TARGET}; \ + ${_MKSHECHO} "${INSTALL_LINK} \ + -o ${LINKSOWN_${.ALLSRC:T}:U${LINKSOWN}} \ + -g ${LINKSGRP_${.ALLSRC:T}:U${LINKSGRP}} \ + -m ${LINKSMODE_${.ALLSRC:T}:U${LINKSMODE}} \ + ${.ALLSRC} ${.TARGET}" && \ + ${INSTALL_LINK} \ + -o ${LINKSOWN_${.ALLSRC:T}:U${LINKSOWN}} \ + -g ${LINKSGRP_${.ALLSRC:T}:U${LINKSGRP}} \ + -m ${LINKSMODE_${.ALLSRC:T}:U${LINKSMODE}} \ + ${.ALLSRC} ${.TARGET} + +##### Install rules +.PHONY: linksinstall +linksinstall:: realinstall +.if !empty(SYMLINKS) + @(set ${SYMLINKS}; \ + while test $$# -ge 2; do \ + l=$$1; shift; \ + t=${DESTDIR}$$1; shift; \ + if ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \ + [ "$$l" = "$$ttarg" ]; then \ + continue ; \ + fi ; \ + ${_MKSHMSG_INSTALL} $$t; \ + ${_MKSHECHO} ${INSTALL_SYMLINK} $$l $$t; \ + ${INSTALL_SYMLINK} $$l $$t; \ + done; ) +.endif + +.for _src _dst in ${LINKS} +_l:=${DESTDIR}${_src} +_t:=${DESTDIR}${_dst} + +# Handle case conflicts carefully, when _dst occurs +# more than once after case flattening +.if ${MKUPDATE} == "no" || ${LINKS:tl:M${_dst:tl:Q}:[\#]} > 1 +${_t}! ${_l} __linkinstall +.else +${_t}: ${_l} __linkinstall +.endif + +linksinstall:: ${_t} +.PRECIOUS: ${_t} +.endfor + +configinstall: configlinksinstall +.PHONY: configlinksinstall +configlinksinstall:: configfilesinstall +.if !empty(CONFIGSYMLINKS) + @(set ${CONFIGSYMLINKS}; \ + while test $$# -ge 2; do \ + l=$$1; shift; \ + t=${DESTDIR}$$1; shift; \ + if ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \ + [ "$$l" = "$$ttarg" ]; then \ + continue ; \ + fi ; \ + ${_MKSHMSG_INSTALL} $$t; \ + ${_MKSHECHO} ${INSTALL_SYMLINK} $$l $$t; \ + ${INSTALL_SYMLINK} $$l $$t; \ + done; ) +.endif + +.for _src _dst in ${CONFIGLINKS} +_l:=${DESTDIR}${_src} +_t:=${DESTDIR}${_dst} + +# Handle case conflicts carefully, when _dst occurs +# more than once after case flattening +.if ${MKUPDATE} == "no" || ${CONFIGLINKS:tl:M${_dst:tl:Q}:[\#]} > 1 +${_t}! ${_l} __linkinstall +.else +${_t}: ${_l} __linkinstall +.endif + +configlinksinstall:: ${_t} +.PRECIOUS: ${_t} +.endfor + +.include diff --git a/src/share/mk/bsd.lua.mk b/src/share/mk/bsd.lua.mk new file mode 100644 index 0000000..cf33880 --- /dev/null +++ b/src/share/mk/bsd.lua.mk @@ -0,0 +1,173 @@ +# $NetBSD: bsd.lua.mk,v 1.7 2014/07/19 18:38:34 lneto Exp $ +# +# Build rules and definitions for Lua modules + +# +# Variables used +# +# LUA_VERSION currently installed version of Lua +# LUA_LIBDIR ${LIBDIR}/lua/${LUA_VERSION} +# +# LUA_MODULES list of Lua modules to build/installi +# LUA_DPLIBS shared library dependencies as per LIBDPLIBS +# +# LUA_SRCS.mod sources for each module (by default: "${mod:S/./_/g}.lua") +# +# DPADD additional dependencies for building modules +# DPADD.mod additional dependencies for a specific module +# +# +# HAVE_LUAC if defined, .lua source files will be compiled with ${LUAC} +# and installed as precompiled chunks for faster loading. Note +# that the luac file format is not yet standardised and may be +# subject to change. +# +# LUAC the luac compiler (by default: /usr/bin/luac) +# +# +# Notes: +# +# currently make(depend) and make(tags) do not support .lua sources; We +# add Lua sources to DPSRCS when HAVE_LUAC is defined and other language +# sources to SRCS for . +# +# other language support for other than C is incomplete +# +# C language sources are passed though lint, when MKLINT != "no" +# +# The Lua binary searches /usr/share/lua/5.1/ at this time and we could +# install .lua modules there which would mean slightly less duplication +# in compat builds. However, MKSHARE=no would prevent such modules from +# being installed so we just install everything under /usr/lib/lua/5.1/ +# + +.if !defined(_BSD_LUA_MK_) +_BSD_LUA_MK_=1 + +.include +.include +.include + +#__MINIX: Not always included +.include +.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" +LDFLAGS+= -L${DESTDIR}/usr/lib +.endif # defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" + +## +##### Basic targets +realinstall: .PHONY lua-install +realall: .PHONY lua-all +lint: .PHONY lua-lint + +lua-install: .PHONY + +lua-all: .PHONY + +lua-lint: .PHONY + +CLEANFILES+= a.out [Ee]rrs mklog core *.core + +## +##### Global variables +LUA_VERSION?= 5.3 +LUA_LIBDIR?= ${LIBDIR}/lua/${LUA_VERSION} +LUAC?= /usr/bin/luac + +## +##### Build rules + +# XX should these always be on? +CFLAGS+= -fPIC + +.SUFFIXES: .lua .luac +.lua.luac: + ${_MKTARGET_COMPILE} + ${LUAC} -o ${.TARGET} ${.IMPSRC} + +## +##### Libraries that modules may depend upon. +.for _lib _dir in ${LUA_DPLIBS} +.if !defined(LIBDO.${_lib}) +LIBDO.${_lib}!= cd "${_dir}" && ${PRINTOBJDIR} +.MAKEOVERRIDES+=LIBDO.${_lib} +.endif +LDADD+=-L${LIBDO.${_lib}} -l${_lib} +DPADD+=${LIBDO.${_lib}}/lib${_lib}.so +.endfor + +## +##### Lua Modules +.for _M in ${LUA_MODULES} +LUA_SRCS.${_M}?=${_M:S/./_/g}.lua +LUA_DEST.${_M}=${LUA_LIBDIR}${_M:S/./\//g:S/^/\//:H} + +.if !empty(LUA_SRCS.${_M}:M*.lua) +.if ${LUA_SRCS.${_M}:[\#]} > 1 +.error Module "${_M}" has too many source files +.endif +.if defined(HAVE_LUAC) +## +## The module has Lua source and needs to be compiled +LUA_TARG.${_M}=${_M:S/./_/g}.luac +LUA_NAME.${_M}=${_M:S/./\//g:T}.luac +CLEANFILES+=${LUA_TARG.${_M}} +DPSRCS+=${LUA_SRCS.${_M}} + +.NOPATH: ${LUA_TARG.${_M}} +lua-all: ${LUA_TARG.${_M}} +${LUA_TARG.${_M}}: ${LUA_SRCS.${_M}} ${DPADD} ${DPADD.${_M}} +.else +## +## The module has Lua source and can be installed directly +LUA_TARG.${_M}=${LUA_SRCS.${_M}} +LUA_NAME.${_M}=${_M:S/./\//g:T}.lua +.endif +.else +## +## The module has other language source and we must build ${_M}.so +LUA_OBJS.${_M}=${LUA_SRCS.${_M}:N*.lua:R:S/$/.o/g} +LUA_LOBJ.${_M}=${LUA_SRCS.${_M}:M*.c:.c=.ln} +LUA_TARG.${_M}=${_M:S/./_/g}.so +LUA_NAME.${_M}=${_M:S/./\//g:T}.so +CLEANFILES+=${LUA_OBJS.${_M}} ${LUA_LOBJ.${_M}} ${LUA_TARG.${_M}} +DPSRCS+=${LUA_SRCS.${_M}} +SRCS+=${LUA_SRCS.${_M}} + +.NOPATH: ${LUA_OBJS.${_M}} ${LUA_LOBJ.${_M}} ${LUA_TARG.${_M}} +.if ${MKLINT} != "no" +${LUA_TARG.${_M}}: ${LUA_LOBJ.${_M}} +.endif +lua-lint: ${LUA_LOBJ.${_M}} +lua-all: ${LUA_TARG.${_M}} +${LUA_TARG.${_M}}: ${LUA_OBJS.${_M}} ${DPADD} ${DPADD.${_M}} + ${_MKTARGET_BUILD} + rm -f ${.TARGET} + ${CC} -Wl,--warn-shared-textrel \ + -Wl,-x -shared ${LUA_OBJS.${_M}} \ + -Wl,-soname,${LUA_NAME.${_M}} -o ${.TARGET} \ + ${LDADD} ${LDADD.${_M}} ${LDFLAGS} ${LDFLAGS.${_M}} + +.endif + +DPADD+= ${LIBLUA} +LDADD+= -llua + +## +## module install rules +lua-install: ${DESTDIR}${LUA_DEST.${_M}}/${LUA_NAME.${_M}} +${DESTDIR}${LUA_DEST.${_M}}/${LUA_NAME.${_M}}! ${LUA_TARG.${_M}} + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${.ALLSRC} ${.TARGET} + +.endfor +## +##### end of modules + +.include +.include +.include +.include +.include +.endif # ! defined(_BSD_LUA_MK_) diff --git a/src/share/mk/bsd.man.mk b/src/share/mk/bsd.man.mk new file mode 100644 index 0000000..0e557ef --- /dev/null +++ b/src/share/mk/bsd.man.mk @@ -0,0 +1,302 @@ +# $NetBSD: bsd.man.mk,v 1.117 2014/12/19 22:25:39 christos Exp $ +# @(#)bsd.man.mk 8.1 (Berkeley) 6/8/93 + +.include + +##### Basic targets +.PHONY: catinstall maninstall catpages manpages catlinks manlinks +.PHONY: htmlinstall htmlpages htmllinks +.PHONY: lintmanpages +realinstall: ${MANINSTALL} + +# If our install destination is case-preserving, but case-insensitive +# then we do filesystem comparisons in lower case to make sure that +# we always refresh the target when needed. In general we don't +# want to do this, otherwise things like _exit.2 -> _Exit.2 get +# installed on each build even when they don't need to. Note that +# the CASE_INSENSITIVE_DEST macro is currently not defined anywhere, +# and the expansion does not really work because of make(1). +.if defined(CASE_INSENSITIVE_DEST) +_FLATTEN?=tl: +.endif + +##### Default values +.if ${USETOOLS} == "yes" +TMACDEPDIR?= ${TOOLDIR}/share/groff/tmac +.else +TMACDEPDIR?= /usr/share/tmac +.endif + +HTMLDIR?= ${DESTDIR}${MANDIR} +.if ${MKMANDOC} == yes && !defined(NOMANDOC) +CATDEPS?= +.else +CATDEPS?= ${TMACDEPDIR}/andoc.tmac \ + ${TMACDEPDIR}/doc.tmac \ + ${TMACDEPDIR}/mdoc/doc-common \ + ${TMACDEPDIR}/mdoc/doc-ditroff \ + ${TMACDEPDIR}/mdoc/doc-nroff \ + ${TMACDEPDIR}/mdoc/doc-syms +.endif +MANTARGET?= cat + +MAN?= +MLINKS?= +_MSECTIONS= 1 2 3 4 5 6 7 8 9 +_MSECTIONS+= 3lua 9lua +_MSECTIONREGEX= ${_MSECTIONS:ts|} # e.g. 1|2|3|... +.SUFFIXES: ${_MSECTIONS:@N@.$N@} + +.if ${MKMANZ} == "no" +MANCOMPRESS?= +MANSUFFIX?= +.else +MANCOMPRESS?= ${TOOL_GZIP_N} -cf +MANSUFFIX?= .gz +.endif + +# make MANCOMPRESS a filter, so it can be inserted on an as-needed basis +.if !empty(MANCOMPRESS) +MANCOMPRESS:= | ${MANCOMPRESS} +.endif + +__installpage: .USE + @cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \ + (${_MKSHMSG_INSTALL} ${.TARGET}; \ + ${_MKSHECHO} "${INSTALL_FILE} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \ + ${.ALLSRC} ${.TARGET}" && \ + ${INSTALL_FILE} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \ + ${.ALLSRC} ${.TARGET}) + +# XXX consider including bsd.links.mk and using __linkinstall instead +__linkinstallpage: .USE + ${_MKSHMSG_INSTALL} ${.TARGET}; \ + ${_MKSHECHO} "${INSTALL_LINK} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \ + ${.ALLSRC} ${.TARGET}" && \ + ${INSTALL_LINK} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \ + ${.ALLSRC} ${.TARGET} + +##### Build and install rules (source form pages) + +.if ${MKMAN} != "no" +maninstall: manpages manlinks +manpages:: # ensure target exists +MANPAGES= ${MAN:C/.$/&${MANSUFFIX}/} + +realall: ${MANPAGES} +.if !empty(MANSUFFIX) +.NOPATH: ${MANPAGES} +.SUFFIXES: ${_MSECTIONS:@N@.$N${MANSUFFIX}@} + +${_MSECTIONS:@N@.$N.$N${MANSUFFIX}@}: # build rule + ${_MKTARGET_FORMAT} + cat ${.IMPSRC} ${MANCOMPRESS} > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET} +.endif # !empty(MANSUFFIX) + +.for F in ${MANPAGES:S/${MANSUFFIX}$//:O:u} +_F:= ${DESTDIR}${MANDIR}/man${F:T:E}${MANSUBDIR}/${F}${MANSUFFIX} + +.if ${MKUPDATE} == "no" +${_F}! ${F}${MANSUFFIX} __installpage # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}! .MADE # no build at install +.endif +.else +${_F}: ${F}${MANSUFFIX} __installpage # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}: .MADE # no build at install +.endif +.endif + +manpages:: ${_F} +.PRECIOUS: ${_F} # keep if install fails +.endfor + +manlinks:: # link install + +.for _src _dst in ${MLINKS} +_l:=${DESTDIR}${MANDIR}/man${_src:T:E}${MANSUBDIR}/${_src}${MANSUFFIX} +_t:=${DESTDIR}${MANDIR}/man${_dst:T:E}${MANSUBDIR}/${_dst}${MANSUFFIX} + +# Handle case conflicts carefully, when _dst occurs +# more than once after case flattening +.if ${MKUPDATE} == "no" || ${MLINKS:${_FLATTEN}M${_dst:${_FLATTEN}Q}:[\#]} > 1 +${_t}! ${_l} __linkinstallpage +.else +${_t}: ${_l} __linkinstallpage +.endif + +manlinks:: ${_t} +.PRECIOUS: ${_t} +.endfor +.endif # ${MKMAN} != "no" + +##### Build and install rules (plaintext pages) + +.if (${MKCATPAGES} != "no") && (${MKMAN} != "no") +catinstall: catpages catlinks +catpages:: # ensure target exists +CATPAGES= ${MAN:C/\.(${_MSECTIONREGEX})\$/.cat\1${MANSUFFIX}/} + +realall: ${CATPAGES} +.NOPATH: ${CATPAGES} +.SUFFIXES: ${_MSECTIONS:@N@.cat$N${MANSUFFIX}@} +.MADE: ${CATDEPS} + +${_MSECTIONS:@N@.$N.cat$N${MANSUFFIX}@}: ${CATDEPS} # build rule + ${_MKTARGET_FORMAT} +.if ${MKMANDOC} == yes && !defined(NOMANDOC) + if test ""${NOMANDOC.${.IMPSRC:T}:tl:Q} != "yes"; then \ + ${TOOL_MANDOC_ASCII} ${.IMPSRC} ${MANCOMPRESS} \ + > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}; \ + else \ + ${TOOL_ROFF_ASCII} -mandoc ${.IMPSRC} ${MANCOMPRESS} \ + > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}; \ + fi +.elif defined(USETBL) + ${TOOL_TBL} ${.IMPSRC} | ${TOOL_ROFF_ASCII} -mandoc ${MANCOMPRESS} \ + > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET} +.else + ${TOOL_ROFF_ASCII} -mandoc ${.IMPSRC} ${MANCOMPRESS} \ + > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET} +.endif + +.for F in ${CATPAGES:S/${MANSUFFIX}$//:O:u} +_F:= ${DESTDIR}${MANDIR}/${F:T:E}${MANSUBDIR}/${F:R}.0${MANSUFFIX} + +.if ${MKUPDATE} == "no" +${_F}! ${F}${MANSUFFIX} __installpage # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}! .MADE # no build at install +.endif +.else +${_F}: ${F}${MANSUFFIX} __installpage # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}: .MADE # no build at install +.endif +.endif + +catpages:: ${_F} +.PRECIOUS: ${_F} # keep if install fails +.endfor + +catlinks:: # link install + +.for _src _dst in ${MLINKS} +_l:=${DESTDIR}${MANDIR}/cat${_src:T:E}${MANSUBDIR}/${_src:R}.0${MANSUFFIX} +_t:=${DESTDIR}${MANDIR}/cat${_dst:T:E}${MANSUBDIR}/${_dst:R}.0${MANSUFFIX} + +# Handle case conflicts carefully, when _dst occurs +# more than once after case flattening +.if ${MKUPDATE} == "no" || ${MLINKS:${_FLATTEN}M${_dst:${_FLATTEN}Q}:[\#]} > 1 +${_t}! ${_l} __linkinstallpage +.else +${_t}: ${_l} __linkinstallpage +.endif + +catlinks:: ${_t} +.PRECIOUS: ${_t} +.endfor +.endif # (${MKCATPAGES} != "no") && (${MKMAN} != "no") + +##### Build and install rules (HTML pages) + +.if (${MKHTML} != "no") && (${MKMAN} != "no") # { +htmlinstall: htmlpages htmllinks +htmlpages:: # ensure target exists +HTMLPAGES= ${MAN:C/\.(${_MSECTIONREGEX})\$/.html\1/} + +HTMLLINKS= ${MANSUBDIR:?../:}../html%S/%N.html +HTMLSTYLE= ${MANSUBDIR:?../:}../style.css + +realall: ${HTMLPAGES} +.NOPATH: ${HTMLPAGES} +.SUFFIXES: ${_MSECTIONS:@N@.html$N@} + +${_MSECTIONS:@N@.$N.html$N@}: # build rule + ${_MKTARGET_FORMAT} +.if ${MKMANDOC} == yes && !defined(NOMANDOC) + if test ""${NOMANDOC.${.IMPSRC:T}:tl:Q} != "yes"; then \ + ${TOOL_MANDOC_HTML} -Oman=${HTMLLINKS} -Ostyle=${HTMLSTYLE} \ + ${.IMPSRC} > ${.TARGET}.tmp && \ + mv ${.TARGET}.tmp ${.TARGET}; \ + else \ + ${TOOL_ROFF_HTML} ${.IMPSRC} ${MANCOMPRESS} \ + > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}; \ + fi +.elif defined(USETBL) + ${TOOL_TBL} ${.IMPSRC} | ${TOOL_ROFF_HTML} ${MANCOMPRESS} \ + > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET} +.else + ${TOOL_ROFF_HTML} ${.IMPSRC} ${MANCOMPRESS} \ + > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET} +.endif + +.for F in ${HTMLPAGES:O:u} +# construct installed path +_F:= ${HTMLDIR}/${F:T:E}${MANSUBDIR}/${F:R:S-/index$-/x&-}.html + +.if ${MKUPDATE} == "no" +${_F}! ${F} __installpage # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}! .MADE # no build at install +.endif +.else +${_F}: ${F} __installpage # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}: .MADE # no build at install +.endif +.endif + +htmlpages:: ${_F} +.PRECIOUS: ${_F} # keep if install fails +.endfor + +htmllinks:: # link install + +.for _src _dst in ${MLINKS} +_l:=${HTMLDIR}/html${_src:T:E}${MANSUBDIR}/${_src:R:S-/index$-/x&-}.html +_t:=${HTMLDIR}/html${_dst:T:E}${MANSUBDIR}/${_dst:R:S-/index$-/x&-}.html + +# Handle case conflicts carefully, when _dst occurs +# more than once after case flattening +.if ${MKUPDATE} == "no" || ${MLINKS:${_FLATTEN}M${_dst:${_FLATTEN}Q}:[\#]} > 1 +${_t}! ${_l} __linkinstallpage +.else +${_t}: ${_l} __linkinstallpage +.endif + +htmllinks:: ${_t} +.PRECIOUS: ${_t} +.endfor + +.endif # } + +##### Clean rules +.undef _F + +.if !empty(MAN) && (${MKMAN} != "no") +.if (${MKCATPAGES} != "no") +CLEANDIRFILES+= ${CATPAGES} +.endif +.if !empty(MANSUFFIX) +CLEANDIRFILES+= ${MANPAGES} ${CATPAGES:S/${MANSUFFIX}$//} +.endif +.if ${MKHTML} != "no" +CLEANDIRFILES+= ${HTMLPAGES} +.endif +.endif +# (XXX ${CATPAGES:S...} cleans up old .catN files where .catN.gz now used) + +.if !empty(MANPAGES) +lintmanpages: ${MANPAGES} + ${TOOL_MANDOC_LINT} -Tlint -fstrict -Wall,stop ${.ALLSRC} +.endif + +##### Pull in related .mk logic +.include +.include +.include +.include + +${TARGETS} catinstall maninstall htmlinstall: # ensure existence diff --git a/src/share/mk/bsd.nls.mk b/src/share/mk/bsd.nls.mk new file mode 100644 index 0000000..0fefdbe --- /dev/null +++ b/src/share/mk/bsd.nls.mk @@ -0,0 +1,71 @@ +# $NetBSD: bsd.nls.mk,v 1.47 2011/09/10 16:57:35 apb Exp $ + +.include + +##### Basic targets +realinstall: nlsinstall + +##### Default values +NLSNAME?= ${PROG:Ulib${LIB}} + +NLS?= + +##### Build rules +.if ${MKNLS} != "no" + +NLSALL= ${NLS:.msg=.cat} + +realall: ${NLSALL} +.NOPATH: ${NLSALL} + +.SUFFIXES: .cat .msg + +.msg.cat: + @rm -f ${.TARGET} + ${_MKTARGET_CREATE} + ${TOOL_GENCAT} ${.TARGET} ${.IMPSRC} + +.endif # ${MKNLS} != "no" + +##### Install rules +nlsinstall:: # ensure existence +.PHONY: nlsinstall + +.if ${MKNLS} != "no" + +__nlsinstall: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${NLSOWN} -g ${NLSGRP} -m ${NLSMODE} \ + ${.ALLSRC} ${.TARGET} + +.for F in ${NLSALL:O:u} +_F:= ${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat # installed path + +.if ${MKUPDATE} == "no" +${_F}! ${F} __nlsinstall # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}! .MADE # no build at install +.endif +.else +${_F}: ${F} __nlsinstall # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}: .MADE # no build at install +.endif +.endif + +nlsinstall:: ${_F} +.PRECIOUS: ${_F} # keep if install fails +.endfor + +.undef _F +.endif # ${MKNLS} != "no" + +##### Clean rules +.if ${MKNLS} != "no" && !empty(NLS) +CLEANDIRFILES+= ${NLSALL} +.endif + +##### Pull in related .mk logic +.include +.include +.include diff --git a/src/share/mk/bsd.obj.mk b/src/share/mk/bsd.obj.mk new file mode 100644 index 0000000..fb141d0 --- /dev/null +++ b/src/share/mk/bsd.obj.mk @@ -0,0 +1,109 @@ +# $NetBSD: bsd.obj.mk,v 1.49 2010/01/25 00:43:00 christos Exp $ + +.if !defined(_BSD_OBJ_MK_) +_BSD_OBJ_MK_=1 + +.include + +__curdir:= ${.CURDIR} + +.if ${MKOBJ} == "no" +obj: +.else +.if defined(MAKEOBJDIRPREFIX) || defined(MAKEOBJDIR) +.if defined(MAKEOBJDIRPREFIX) +__objdir:= ${MAKEOBJDIRPREFIX}${__curdir} +.else +__objdir:= ${MAKEOBJDIR} +.endif +# MAKEOBJDIR and MAKEOBJDIRPREFIX are env variables supported +# by make(1). We simply mkdir -p the specified path. +# If that fails - we do a mkdir to get the appropriate error message +# before bailing out. +obj: +.if defined(MAKEOBJDIRPREFIX) + @if [ ! -d ${MAKEOBJDIRPREFIX} ]; then \ + echo "MAKEOBJDIRPREFIX ${MAKEOBJDIRPREFIX} does not exist, bailing..."; \ + exit 1; \ + fi; +.endif + @if [ ! -d ${__objdir} ]; then \ + mkdir -p ${__objdir}; \ + if [ ! -d ${__objdir} ]; then \ + mkdir ${__objdir}; exit 1; \ + fi; \ + ${_MKSHMSG} " objdir ${__objdir}"; \ + fi +.else +PAWD?= /bin/pwd + +__objdir= obj${OBJMACHINE:D.${MACHINE}} + +__usrobjdir= ${BSDOBJDIR}${USR_OBJMACHINE:D.${MACHINE}} +__usrobjdirpf= ${USR_OBJMACHINE:D:U${OBJMACHINE:D.${MACHINE}}} + +.if defined(BUILDID) +__objdir:= ${__objdir}.${BUILDID} +__usrobjdirpf:= ${__usrobjdirpf}.${BUILDID} +__need_objdir_target=yes +.endif + +.if defined(OBJHOSTMACHINE) && (${MKHOSTOBJ:Uno} != "no") +# In case .CURDIR has been twiddled by a .mk file and is now relative, +# make it absolute again. +.if ${__curdir:M/*} == "" +__curdir!= cd "${__curdir}" && ${PAWD} +.endif + +__objdir:= ${__objdir}.${HOST_OSTYPE} +__usrobjdirpf:= ${__usrobjdirpf}.${HOST_OSTYPE} +__need_objdir_target=yes +.endif + +.if defined(__need_objdir_target) +# Get make to change its internal definition of .OBJDIR +.OBJDIR: ${__objdir} +.endif + +obj: + @cd "${__curdir}"; \ + here=`${PAWD}`/; subdir=$${here#${BSDSRCDIR}/}; \ + if [ "$$here" != "$$subdir" ]; then \ + if [ ! -d ${__usrobjdir} ]; then \ + echo "BSDOBJDIR ${__usrobjdir} does not exist, bailing..."; \ + exit 1; \ + fi; \ + subdir=$${subdir%/}; \ + dest=${__usrobjdir}/$$subdir${__usrobjdirpf}; \ + if [ -x ${TOOL_STAT} ] && \ + ttarg=`${TOOL_STAT} -qf '%Y' $${here}${__objdir}` && \ + [ "$$dest" = "$$ttarg" ]; then \ + : ; \ + else \ + ${_MKSHMSG} " objdir $$dest"; \ + rm -rf ${__objdir}; \ + ln -s $$dest ${__objdir}; \ + fi; \ + if [ ! -d $$dest ]; then \ + mkdir -p $$dest; \ + else \ + true; \ + fi; \ + else \ + true ; \ + dest=$${here}${__objdir} ; \ + if [ ! -d ${__objdir} ] || [ -h ${__objdir} ]; then \ + ${_MKSHMSG} " objdir $$dest"; \ + rm -f ${__objdir}; \ + mkdir $$dest; \ + fi ; \ + fi; +.endif +.endif + +print-objdir: + @echo ${.OBJDIR} + +.include + +.endif # !defined(_BSD_OBJ_MK_) diff --git a/src/share/mk/bsd.own.mk b/src/share/mk/bsd.own.mk new file mode 100644 index 0000000..f76d5f8 --- /dev/null +++ b/src/share/mk/bsd.own.mk @@ -0,0 +1,1733 @@ +# $NetBSD: bsd.own.mk,v 1.874 2015/09/30 22:58:02 rjs Exp $ + +# This needs to be before bsd.init.mk +.if defined(BSD_MK_COMPAT_FILE) +.include <${BSD_MK_COMPAT_FILE}> +.endif + +.if !defined(_BSD_OWN_MK_) +_BSD_OWN_MK_=1 + +.if defined(__MINIX) + +# Some Minix deviations from NetBSD +LDSTATIC?= -static +MKDYNAMICROOT?= no +NO_LIBGOMP?= yes + +BINMODE?= 755 +NONBINMODE?= 644 +MANDIR?= /usr/man + +MKKYUA?= yes +MKMCLINKER?= no +MKCLANGRT?= no +MKGCC?= no +MKGCCCMDS?= no +MKPROFILE?= no +MKSLJIT?= no + +#MINIX-specific variables +MKCOVERAGE?= no + +# LSC MINIX does not support these features ATM. +USE_FORT:= no +USE_SSP:= no +MKCOMPAT:= no +MKGDB:= no +MKGROFF:= no +MKHESIOD:= no +MKHTML:= no +MKIPFILTER:= no +MKISCSI:= no +MKKERBEROS:= no +MKKMOD:= no +MKLDAP:= no +MKLINT:= no +MKLVM:= no +MKMDNS:= no +MKNPF:= no +MKPAM:= no +MKPF:= no +MKPOSTFIX:= no +MKRUMP:= no +MKSKEY:= no +MKYP:= no +MKCROSSGDB:= no + +WEAKALIASOVERRIDEPASS?=${NETBSDSRCDIR}/minix/llvm/bin/weak-alias-module-override.so +GOLD_PLUGIN?=${NETBSDSRCDIR}/minix/llvm/bin/LLVMgold.so + +# By default when running LLVM passes: +# - do not run optimization while running LLVM passes +# - run the passe which allows assembly weak symbols to be +# overriden by bitcode functions +OPTFLAGS?= -disable-opt \ + -disable-inlining \ + -load ${WEAKALIASOVERRIDEPASS} -weak-alias-module-override + +BITCODE_LD_FLAGS_1ST?= \ + -Wl,-plugin=${GOLD_PLUGIN} \ + -Wl,-plugin-opt=-disable-opt \ + -Wl,-plugin-opt=-disable-inlining + +BITCODE_LD_FLAGS_2ND?=${BITCODE_LD_FLAGS_1ST} + +.ifdef CONFIG_SMP +SMP_FLAGS += -DCONFIG_SMP +.ifdef CONFIG_MAX_CPUS +SMP_FLAGS += -DCONFIG_MAX_CPUS=${CONFIG_MAX_CPUS} +.endif +.endif + +CPPFLAGS+= ${SMP_FLAGS} + +__uname_s!= uname -s +.if ${__uname_s:Uunknown} == "Minix" +USETOOLS?= never +. if ${USETOOLS:Uno} != "yes" + HAVE_LLVM?= yes + +# If DESTDIR was specified, and we are not using the tools, then make sure to +# build out-of-tree and to refer only DESTDIR for target binaries +# The case when using tools is already handled below. +. if ${DESTDIR:U} != "" + CPPFLAGS+= --sysroot=${DESTDIR} + LDFLAGS+= --sysroot=${DESTDIR} +. endif # ${DESTDIR:U} != "" + + MKTOOLS?=no +. endif # ${USETOOLS:Uno} != "yes" + +. if !defined(HOSTPROG) && !defined(HOSTLIB) +# LSC FIXME: Override MACHINE as the native minix host make command will set +# it to i686. +. if ${MACHINE_ARCH} == "i386" + MACHINE:= i386 +. endif +# LSC FIXME: On a native ARM system MACHINE_ARCH is earmv7 instead of earm... +. if !empty(MACHINE_ARCH:Mearm*) + MACHINE_ARCH:= earm +. endif +. endif # !defined(HOSTPROG) && !defined(HOSTLIB) +.endif # __uname_s == "Minix" + +# LSC FIXME: RELEASEMACHINEDIR is set to evbarm, instead of evbearm-el +.if !empty(MACHINE:Mevbarm*) +RELEASEMACHINEDIR:= evbearm-el +.endif + +.if ${HAVE_GCC:Dyes} == "yes" || \ + (${MKGCCCMDS:Uno} == "yes" && ${MKLLVM:Uyes} == "no") +# We are building with GCC, means we cannot build LIBCXX, and need LIBSTDCXX +MKLIBCXX?= no # Can't compile with GCC. + +. if ${USETOOLS:Uno} == "yes" || ${MKLIBSTDCXX:Uno} == "yes" +# When cross-compiling, or building MKLIBSTDCXX, use the in-tree LIBSTDCXX +MKLIBSTDCXX?= yes +CXXFLAGS+= -I${DESTDIR}/usr/include/g++ +. endif # ${USETOOLS:Uno} == "yes" + +. if ${MKLIBSTDCXX:Uno} == "no" +# Specify the C++ system header for the host libstdc++, as we are not building +# LIBSTDCXX +CXXFLAGS+= -I/usr/include/g++ +. endif # ${MKLIBSTDCXX:Uno} == "no" + +.endif # ${HAVE_GCC:Dyes} == "yes" || \ + # (${MKGCCCMDS:Uno} == "yes" && ${MKLLVM:Uyes} == "no") + +# MKGCCCMDS == yes implies MKGCC == yes +.if ${MKGCCCMDS} == "yes" +MKGCC= yes +MKBINUTILS?= yes # We are installing GCC, so trigger binutils. +MKLIBSTDCXX?= yes # Also install the GNU C++ library +.endif # ${MKGCCCMDS} == "yes" + +# The default value of MKLIBSTDCXX cannot be set before the previous test. +MKLIBSTDCXX?= no + +.if ${MKGCC} == "yes" +HAVE_GCC?= 5 # Not really, but that's the setting. +HAVE_LIBGCC?= yes +HAVE_LIBGCC_EH?= yes +.endif # ${MKGCC} == "yes" + +.if ${USETOOLS:Uno} == "yes" +MKLLVM?= yes +.endif # ${USETOOLS:Uno} == "yes" + +.if ${MKLLVM:Uno} == "yes" +HAVE_LLVM?= yes +MKBINUTILS?= yes # We are installing clang, so trigger binutils. +.endif # ${MKLLVM:Uno} == "yes" + +.if ${HAVE_LLVM:Dyes} == "yes" +HAVE_LIBGCC?= no +.endif # ${HAVE_LLVM:Dyes} == "yes" + +# The default value has to be set after we have figured out if we are using GCC +# or not. +MKLIBCXX?= yes # Build by default libc++ + +# The default value of MKBINUTILS cannot be set before the previous test. +MKBINUTILS?= no + +.endif # defined(__MINIX) + +MAKECONF?= /etc/mk.conf +.-include "${MAKECONF}" + +# +# CPU model, derived from MACHINE_ARCH +# +MACHINE_CPU= ${MACHINE_ARCH:C/mipse[bl]/mips/:C/mips64e[bl]/mips/:C/sh3e[bl]/sh3/:S/coldfire/m68k/:S/m68000/m68k/:C/arm.*/arm/:C/earm.*/arm/:S/earm/arm/:S/powerpc64/powerpc/:S/aarch64eb/aarch64/:S/or1knd/or1k/:C/riscv../riscv/} + +# +# Subdirectory used below ${RELEASEDIR} when building a release +# +RELEASEMACHINEDIR?= ${MACHINE} + +# +# Subdirectory or path component used for the following paths: +# distrib/${RELEASEMACHINE} +# distrib/notes/${RELEASEMACHINE} +# etc/etc.${RELEASEMACHINE} +# Used when building a release. +# +RELEASEMACHINE?= ${MACHINE} + +# +# NEED_OWN_INSTALL_TARGET is set to "no" by pkgsrc/mk/bsd.pkg.mk to +# ensure that things defined by (default targets, +# INSTALL_FILE, etc.) are not conflicting with bsd.pkg.mk. +# +NEED_OWN_INSTALL_TARGET?= yes + +# +# This lists the platforms which do not have working in-tree toolchains. For +# the in-tree gcc toolchain, this list is empty. +# +# If some future port is not supported by the in-tree toolchain, this should +# be set to "yes" for that port only. +# +.if ${MACHINE} == "playstation2" +TOOLCHAIN_MISSING?= yes +.endif + +TOOLCHAIN_MISSING?= no + +.if ${MACHINE_CPU} == "aarch64" && !defined(EXTERNAL_TOOLCHAIN) && ${MKLLVM:Uyes} != "no" +MKLLVM?= yes +HAVE_LLVM?= yes +MKGCC?= no +.endif + +# +# GCC Using platforms. +# +.if ${MKGCC:Uyes} != "no" + +.if ${MACHINE} == "playstation2" || ${MACHINE_CPU} == "aarch64" +HAVE_GCC?= 0 +.else +# Otherwise, default to GCC4.8 +HAVE_GCC?= 48 +.endif + +# +# Platforms that can't run a modern GCC natively +.if ${MACHINE_ARCH} == "m68000" +MKGCCCMDS?= no +.endif + +# +# We import the old gcc as "gcc.old" when upgrading. EXTERNAL_GCC_SUBDIR is +# set to the relevant subdirectory in src/external/gpl3 for his HAVE_GCC. +# +.if ${HAVE_GCC} == 5 +EXTERNAL_GCC_SUBDIR= gcc +.elif ${HAVE_GCC} == 48 +EXTERNAL_GCC_SUBDIR= gcc.old +.else +EXTERNAL_GCC_SUBDIR= /does/not/exist +.endif +.else +MKGCCCMDS?= no +.endif + +.if !empty(MACHINE_ARCH:Mearm*) +_LIBC_COMPILER_RT.${MACHINE_ARCH}= yes +.endif + +_LIBC_COMPILER_RT.aarch64= yes +_LIBC_COMPILER_RT.i386= yes +_LIBC_COMPILER_RT.powerpc= yes +_LIBC_COMPILER_RT.powerpc64= yes +_LIBC_COMPILER_RT.x86_64= yes + +.if ${HAVE_LLVM:Uno} == "yes" && ${_LIBC_COMPILER_RT.${MACHINE_ARCH}:Uno} == "yes" +HAVE_LIBGCC?= no +.else +HAVE_LIBGCC?= yes +.endif + + +# ia64 is not support +.if ${HAVE_LLVM:Uno} == "yes" || !empty(MACHINE_ARCH:Mearm*) +HAVE_LIBGCC_EH?= no +.else +HAVE_LIBGCC_EH?= yes +.endif + +HAVE_GDB?= 79 + +.if (${MACHINE_ARCH} == "alpha") || \ + (${MACHINE_ARCH} == "hppa") || \ + (${MACHINE_ARCH} == "ia64") || \ + (${MACHINE_CPU} == "mips") +HAVE_SSP?= no +.else +HAVE_SSP?= yes +.if ${USE_FORT:Uno} != "no" +USE_SSP?= yes +.endif +.endif + +.if empty(.MAKEFLAGS:tW:M*-V .OBJDIR*) +.if defined(MAKEOBJDIRPREFIX) || defined(MAKEOBJDIR) +PRINTOBJDIR= ${MAKE} -r -V .OBJDIR -f /dev/null xxx +.else +PRINTOBJDIR= ${MAKE} -V .OBJDIR +.endif +.else +PRINTOBJDIR= echo /error/bsd.own.mk/PRINTOBJDIR # avoid infinite recursion +.endif + +# +# Determine if running in the NetBSD source tree by checking for the +# existence of build.sh and tools/ in the current or a parent directory, +# and setting _SRC_TOP_ to the result. +# +.if !defined(_SRC_TOP_) # { +_SRC_TOP_!= cd "${.CURDIR}"; while :; do \ + here=`pwd`; \ + [ -f build.sh ] && [ -d tools ] && { echo $$here; break; }; \ + case $$here in /) echo ""; break;; esac; \ + cd ..; done + +.MAKEOVERRIDES+= _SRC_TOP_ + +.endif # } + +# +# If _SRC_TOP_ != "", we're within the NetBSD source tree. +# * Set defaults for NETBSDSRCDIR and _SRC_TOP_OBJ_. +# * Define _NETBSD_VERSION_DEPENDS. Targets that depend on the +# NetBSD version, or on variables defined at build time, can +# declare a dependency on ${_NETBSD_VERSION_DEPENDS}. +# +.if (${_SRC_TOP_} != "") # { + +NETBSDSRCDIR?= ${_SRC_TOP_} + +.if !defined(_SRC_TOP_OBJ_) +_SRC_TOP_OBJ_!= cd "${_SRC_TOP_}" && ${PRINTOBJDIR} +.MAKEOVERRIDES+= _SRC_TOP_OBJ_ +.endif + +_NETBSD_VERSION_DEPENDS= ${_SRC_TOP_OBJ_}/params +_NETBSD_VERSION_DEPENDS+= ${NETBSDSRCDIR}/sys/sys/param.h +_NETBSD_VERSION_DEPENDS+= ${NETBSDSRCDIR}/sys/conf/newvers.sh +_NETBSD_VERSION_DEPENDS+= ${NETBSDSRCDIR}/sys/conf/osrelease.sh +${_SRC_TOP_OBJ_}/params: .NOTMAIN .OPTIONAL # created by top level "make build" + +.endif # _SRC_TOP_ != "" # } + + +.if (${_SRC_TOP_} != "") && \ + (${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN)) +USETOOLS?= yes +.endif +USETOOLS?= no + + +.if ${MACHINE_ARCH} == "mips" || ${MACHINE_ARCH} == "mips64" || \ + ${MACHINE_ARCH} == "sh3" +.BEGIN: + @echo "Must set MACHINE_ARCH to one of ${MACHINE_ARCH}eb or ${MACHINE_ARCH}el" + @false +.elif defined(REQUIRETOOLS) && \ + (${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN)) && \ + ${USETOOLS} == "no" +.BEGIN: + @echo "USETOOLS=no, but this component requires a version-specific host toolchain" + @false +.endif + +# +# Host platform information; may be overridden +# +.include + +.if ${USETOOLS} == "yes" # { + +# +# Provide a default for TOOLDIR. +# +.if !defined(TOOLDIR) +TOOLDIR:= ${_SRC_TOP_OBJ_}/tooldir.${HOST_OSTYPE} +.MAKEOVERRIDES+= TOOLDIR +.endif + +# +# This is the prefix used for the NetBSD-sourced tools. +# +_TOOL_PREFIX?= nb + +# +# If an external toolchain base is specified, use it. +# +.if defined(EXTERNAL_TOOLCHAIN) # { +AR= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ar +AS= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-as +LD= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ld +NM= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-nm +OBJCOPY= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-objcopy +OBJDUMP= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-objdump +RANLIB= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ranlib +READELF= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-readelf +SIZE= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-size +STRINGS= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-strings +STRIP= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-strip + +TOOL_CC.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-gcc +TOOL_CPP.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-cpp +TOOL_CXX.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-c++ +TOOL_FC.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-g77 +TOOL_OBJC.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-gcc + +TOOL_CC.clang= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang +TOOL_CPP.clang= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang-cpp +TOOL_CXX.clang= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang++ +TOOL_OBJC.clang= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang +TOOL_OPT.clang= ${EXTERNAL_TOOLCHAIN}/bin/opt +TOOL_LLC.clang= ${EXTERNAL_TOOLCHAIN}/bin/llc +.else # } { +# Define default locations for common tools. +.if ${USETOOLS_BINUTILS:Uyes} == "yes" # { +AR= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ar +AS= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-as +LD= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ld +NM= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-nm +OBJCOPY= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-objcopy +OBJDUMP= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-objdump +RANLIB= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ranlib +READELF= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-readelf +SIZE= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-size +STRINGS= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-strings +STRIP= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-strip + +# GCC supports C, C++, Fortran and Objective C +TOOL_CC.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc +TOOL_CPP.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-cpp +TOOL_CXX.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-c++ +TOOL_FC.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-g77 +TOOL_OBJC.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc +.endif # } + +# Clang supports C, C++ and Objective C +TOOL_CC.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang +TOOL_CPP.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang-cpp +TOOL_CXX.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang++ +TOOL_OBJC.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang +TOOL_OPT.clang= ${TOOLDIR}/bin/opt +TOOL_LLC.clang= ${TOOLDIR}/bin/llc + +# PCC supports C and Fortran +TOOL_CC.pcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-pcc +TOOL_CPP.pcc= ${TOOLDIR}/libexec/${MACHINE_GNU_PLATFORM}-cpp +TOOL_CXX.pcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-p++ + +# +# Make sure DESTDIR is set, so that builds with these tools always +# get appropriate -nostdinc, -nostdlib, etc. handling. The default is +# , meaning start from /, the root directory. +# +DESTDIR?= + +.if !defined(HOSTPROG) && !defined(HOSTLIB) +. if ${DESTDIR} != "" +CPPFLAGS+= --sysroot=${DESTDIR} +LDFLAGS+= --sysroot=${DESTDIR} +. else +CPPFLAGS+= --sysroot=/ +LDFLAGS+= --sysroot=/ +. endif +.endif +.endif # EXTERNAL_TOOLCHAIN # } + +DBSYM= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-dbsym +ELF2AOUT= ${TOOLDIR}/bin/${_TOOL_PREFIX}m68k-elf2aout +ELF2ECOFF= ${TOOLDIR}/bin/${_TOOL_PREFIX}mips-elf2ecoff +INSTALL= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-install +LEX= ${TOOLDIR}/bin/${_TOOL_PREFIX}lex +LINT= CC=${CC:Q} ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-lint +LORDER= NM=${NM:Q} MKTEMP=${TOOL_MKTEMP:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}lorder +MKDEP= CC=${CC:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}mkdep +MKDEPCXX= CC=${CXX:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}mkdep +PAXCTL= ${TOOLDIR}/bin/${_TOOL_PREFIX}paxctl +TSORT= ${TOOLDIR}/bin/${_TOOL_PREFIX}tsort -q +YACC= ${TOOLDIR}/bin/${_TOOL_PREFIX}yacc + +TOOL_AMIGAAOUT2BB= ${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-aout2bb +TOOL_AMIGAELF2BB= ${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-elf2bb +TOOL_AMIGATXLT= ${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-txlt +TOOL_ASN1_COMPILE= ${TOOLDIR}/bin/${_TOOL_PREFIX}asn1_compile +TOOL_AWK= ${TOOLDIR}/bin/${_TOOL_PREFIX}awk +TOOL_CAP_MKDB= ${TOOLDIR}/bin/${_TOOL_PREFIX}cap_mkdb +TOOL_CAT= ${TOOLDIR}/bin/${_TOOL_PREFIX}cat +TOOL_CKSUM= ${TOOLDIR}/bin/${_TOOL_PREFIX}cksum +TOOL_CLANG_TBLGEN= ${TOOLDIR}/bin/${_TOOL_PREFIX}clang-tblgen +TOOL_COMPILE_ET= ${TOOLDIR}/bin/${_TOOL_PREFIX}compile_et +TOOL_CONFIG= ${TOOLDIR}/bin/${_TOOL_PREFIX}config +TOOL_CRUNCHGEN= MAKE=${.MAKE:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}crunchgen +TOOL_CTAGS= ${TOOLDIR}/bin/${_TOOL_PREFIX}ctags +TOOL_CTFCONVERT= ${TOOLDIR}/bin/${_TOOL_PREFIX}ctfconvert +TOOL_CTFMERGE= ${TOOLDIR}/bin/${_TOOL_PREFIX}ctfmerge +TOOL_DB= ${TOOLDIR}/bin/${_TOOL_PREFIX}db +TOOL_DISKLABEL= ${TOOLDIR}/bin/nbdisklabel +TOOL_EQN= ${TOOLDIR}/bin/${_TOOL_PREFIX}eqn +TOOL_FDISK= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-fdisk +TOOL_FGEN= ${TOOLDIR}/bin/${_TOOL_PREFIX}fgen +TOOL_GENASSYM= ${TOOLDIR}/bin/${_TOOL_PREFIX}genassym +TOOL_GENCAT= ${TOOLDIR}/bin/${_TOOL_PREFIX}gencat +TOOL_GMAKE= ${TOOLDIR}/bin/${_TOOL_PREFIX}gmake +TOOL_GREP= ${TOOLDIR}/bin/${_TOOL_PREFIX}grep +TOOL_GROFF= PATH=${TOOLDIR}/lib/groff:$${PATH} ${TOOLDIR}/bin/${_TOOL_PREFIX}groff +TOOL_HEXDUMP= ${TOOLDIR}/bin/${_TOOL_PREFIX}hexdump +TOOL_HP300MKBOOT= ${TOOLDIR}/bin/${_TOOL_PREFIX}hp300-mkboot +TOOL_HPPAMKBOOT= ${TOOLDIR}/bin/${_TOOL_PREFIX}hppa-mkboot +TOOL_INDXBIB= ${TOOLDIR}/bin/${_TOOL_PREFIX}indxbib +TOOL_INSTALLBOOT= ${TOOLDIR}/bin/${_TOOL_PREFIX}installboot +TOOL_INSTALL_INFO= ${TOOLDIR}/bin/${_TOOL_PREFIX}install-info +TOOL_JOIN= ${TOOLDIR}/bin/${_TOOL_PREFIX}join +TOOL_LLVM_TBLGEN= ${TOOLDIR}/bin/${_TOOL_PREFIX}llvm-tblgen +TOOL_M4= ${TOOLDIR}/bin/${_TOOL_PREFIX}m4 +TOOL_MACPPCFIXCOFF= ${TOOLDIR}/bin/${_TOOL_PREFIX}macppc-fixcoff +TOOL_MAKEFS= ${TOOLDIR}/bin/${_TOOL_PREFIX}makefs +TOOL_MAKEINFO= ${TOOLDIR}/bin/${_TOOL_PREFIX}makeinfo +TOOL_MAKEKEYS= ${TOOLDIR}/bin/${_TOOL_PREFIX}makekeys +TOOL_MAKESTRS= ${TOOLDIR}/bin/${_TOOL_PREFIX}makestrs +TOOL_MAKEWHATIS= ${TOOLDIR}/bin/${_TOOL_PREFIX}makewhatis +TOOL_MANDOC_ASCII= ${TOOLDIR}/bin/${_TOOL_PREFIX}mandoc -Tascii +TOOL_MANDOC_HTML= ${TOOLDIR}/bin/${_TOOL_PREFIX}mandoc -Thtml +TOOL_MANDOC_LINT= ${TOOLDIR}/bin/${_TOOL_PREFIX}mandoc -Tlint +TOOL_MDSETIMAGE= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-mdsetimage +TOOL_MENUC= MENUDEF=${TOOLDIR}/share/misc ${TOOLDIR}/bin/${_TOOL_PREFIX}menuc +TOOL_M68KELF2AOUT= ${TOOLDIR}/bin/${_TOOL_PREFIX}m68k-elf2aout +TOOL_MIPSELF2ECOFF= ${TOOLDIR}/bin/${_TOOL_PREFIX}mips-elf2ecoff +TOOL_MKCSMAPPER= ${TOOLDIR}/bin/${_TOOL_PREFIX}mkcsmapper +TOOL_MKESDB= ${TOOLDIR}/bin/${_TOOL_PREFIX}mkesdb +TOOL_MKFSMFS= ${TOOLDIR}/bin/${_TOOL_PREFIX}mkfs.mfs +TOOL_MKLOCALE= ${TOOLDIR}/bin/${_TOOL_PREFIX}mklocale +TOOL_MKMAGIC= ${TOOLDIR}/bin/${_TOOL_PREFIX}file +TOOL_MKNOD= ${TOOLDIR}/bin/${_TOOL_PREFIX}mknod +TOOL_MKTEMP= ${TOOLDIR}/bin/${_TOOL_PREFIX}mktemp +TOOL_MKUBOOTIMAGE= ${TOOLDIR}/bin/${_TOOL_PREFIX}mkubootimage +TOOL_ELFTOSB= ${TOOLDIR}/bin/${_TOOL_PREFIX}elftosb +TOOL_MSGC= MSGDEF=${TOOLDIR}/share/misc ${TOOLDIR}/bin/${_TOOL_PREFIX}msgc +TOOL_MTREE= ${TOOLDIR}/bin/${_TOOL_PREFIX}mtree +TOOL_NBPERF= ${TOOLDIR}/bin/${_TOOL_PREFIX}perf +TOOL_NCDCS= ${TOOLDIR}/bin/${_TOOL_PREFIX}ibmnws-ncdcs +TOOL_PAX= ${TOOLDIR}/bin/${_TOOL_PREFIX}pax +TOOL_PIC= ${TOOLDIR}/bin/${_TOOL_PREFIX}pic +TOOL_PIGZ= ${TOOLDIR}/bin/${_TOOL_PREFIX}pigz +TOOL_PKG_CREATE= ${TOOLDIR}/bin/${_TOOL_PREFIX}pkg_create +TOOL_POWERPCMKBOOTIMAGE=${TOOLDIR}/bin/${_TOOL_PREFIX}powerpc-mkbootimage +TOOL_PWD_MKDB= ${TOOLDIR}/bin/${_TOOL_PREFIX}pwd_mkdb +TOOL_REFER= ${TOOLDIR}/bin/${_TOOL_PREFIX}refer +TOOL_ROFF_ASCII= PATH=${TOOLDIR}/lib/groff:$${PATH} ${TOOLDIR}/bin/${_TOOL_PREFIX}nroff +TOOL_ROFF_DOCASCII= ${TOOL_GROFF} -Tascii +TOOL_ROFF_DOCHTML= ${TOOL_GROFF} -Thtml +TOOL_ROFF_DVI= ${TOOL_GROFF} -Tdvi +TOOL_ROFF_HTML= ${TOOL_GROFF} -Tlatin1 -mdoc2html +TOOL_ROFF_PS= ${TOOL_GROFF} -Tps +TOOL_ROFF_RAW= ${TOOL_GROFF} -Z +TOOL_RPCGEN= RPCGEN_CPP=${CPP:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}rpcgen +TOOL_SED= ${TOOLDIR}/bin/${_TOOL_PREFIX}sed +TOOL_SLC= ${TOOLDIR}/bin/${_TOOL_PREFIX}slc +TOOL_SOELIM= ${TOOLDIR}/bin/${_TOOL_PREFIX}soelim +TOOL_SPARKCRC= ${TOOLDIR}/bin/${_TOOL_PREFIX}sparkcrc +TOOL_STAT= ${TOOLDIR}/bin/${_TOOL_PREFIX}stat +TOOL_STRFILE= ${TOOLDIR}/bin/${_TOOL_PREFIX}strfile +TOOL_SUNLABEL= ${TOOLDIR}/bin/${_TOOL_PREFIX}sunlabel +TOOL_TBL= ${TOOLDIR}/bin/${_TOOL_PREFIX}tbl +TOOL_TIC= ${TOOLDIR}/bin/${_TOOL_PREFIX}tic +TOOL_TOPROTO= ${TOOLDIR}/bin/${_TOOL_PREFIX}toproto +TOOL_UUDECODE= ${TOOLDIR}/bin/${_TOOL_PREFIX}uudecode +TOOL_VGRIND= ${TOOLDIR}/bin/${_TOOL_PREFIX}vgrind -f +TOOL_VFONTEDPR= ${TOOLDIR}/libexec/${_TOOL_PREFIX}vfontedpr +TOOL_ZIC= ${TOOLDIR}/bin/${_TOOL_PREFIX}zic + +.else # USETOOLS != yes # } { + +# Clang supports C, C++ and Objective C +TOOL_CC.clang= clang +.if defined(__MINIX) +TOOL_CPP.clang= clang -E +.else +TOOL_CPP.clang= clang-cpp +.endif # defined(__MINIX) +TOOL_CXX.clang= clang++ +TOOL_OBJC.clang= clang +TOOL_OPT.clang= opt +TOOL_LLC.clang= llc + +# GCC supports C, C++, Fortran and Objective C +TOOL_CC.gcc= gcc +TOOL_CPP.gcc= cpp +TOOL_CXX.gcc= c++ +TOOL_FC.gcc= g77 +TOOL_OBJC.gcc= gcc + +# PCC supports C and Fortran +TOOL_CC.pcc= pcc +TOOL_CPP.pcc= /usr/libexec/pcpp +TOOL_CXX.pcc= p++ + +TOOL_AMIGAAOUT2BB= amiga-aout2bb +TOOL_AMIGAELF2BB= amiga-elf2bb +TOOL_AMIGATXLT= amiga-txlt +TOOL_ASN1_COMPILE= asn1_compile +TOOL_AWK= awk +TOOL_CAP_MKDB= cap_mkdb +TOOL_CAT= cat +TOOL_CKSUM= cksum +.if defined(__MINIX) +# LSC: A full path has to be provided, as this is also used as a make +# target. +. if exists(/usr/pkg/bin/clang-tblgen) +TOOL_CLANG_TBLGEN= /usr/pkg/bin/clang-tblgen +. else +TOOL_CLANG_TBLGEN= /usr/bin/clang-tblgen +. endif # exists(/usr/pkg/bin/clang-tblgen) +.else +TOOL_CLANG_TBLGEN= clang-tblgen +.endif # defined(__MINIX) +TOOL_COMPILE_ET= compile_et +TOOL_CONFIG= config +TOOL_CRUNCHGEN= crunchgen +TOOL_CTAGS= ctags +TOOL_CTFCONVERT= ctfconvert +TOOL_CTFMERGE= ctfmerge +TOOL_DB= db +TOOL_DISKLABEL= disklabel +TOOL_EQN= eqn +TOOL_FDISK= fdisk +TOOL_FGEN= fgen +TOOL_GENASSYM= genassym +TOOL_GENCAT= gencat +TOOL_GMAKE= gmake +TOOL_GREP= grep +TOOL_GROFF= groff +TOOL_HEXDUMP= hexdump +TOOL_HP300MKBOOT= hp300-mkboot +TOOL_HPPAMKBOOT= hppa-mkboot +TOOL_INDXBIB= indxbib +TOOL_INSTALLBOOT= installboot +TOOL_INSTALL_INFO= install-info +TOOL_JOIN= join +.if defined(__MINIX) +# LSC: A full path has to be provided, as this is also used as a make +# target. +. if exists(/usr/pkg/bin/llvm-tblgen) +TOOL_LLVM_TBLGEN= /usr/pkg/bin/llvm-tblgen +. else +TOOL_LLVM_TBLGEN= /usr/bin/llvm-tblgen +. endif # exists(/usr/pkg/bin/llvm-tblgen) +.else +TOOL_LLVM_TBLGEN= llvm-tblgen +.endif # defined(__MINIX) +TOOL_M4= m4 +TOOL_MACPPCFIXCOFF= macppc-fixcoff +TOOL_MAKEFS= makefs +TOOL_MAKEINFO= makeinfo +.if defined(__MINIX) +# LSC: A full path has to be provided, as this is also used as a make +# target. +TOOL_MAKEKEYS= /usr/X11R7/bin/makekeys +.else +TOOL_MAKEKEYS= makekeys +.endif # defined(__MINIX) +.if defined(__MINIX) +# LSC: A full path has to be provided, as this is also used as a make +# target. +TOOL_MAKESTRS= /usr/X11R7/bin/makestrs +.else +TOOL_MAKESTRS= makestrs +.endif # defined(__MINIX) +TOOL_MAKEWHATIS= /usr/libexec/makewhatis +TOOL_MANDOC_ASCII= mandoc -Tascii +TOOL_MANDOC_HTML= mandoc -Thtml +TOOL_MANDOC_LINT= mandoc -Tlint +TOOL_MDSETIMAGE= mdsetimage +TOOL_MENUC= menuc +TOOL_M68KELF2AOUT= m68k-elf2aout +TOOL_MIPSELF2ECOFF= mips-elf2ecoff +TOOL_MKCSMAPPER= mkcsmapper +TOOL_MKESDB= mkesdb +TOOL_MKFSMFS= mkfs.mfs +TOOL_MKLOCALE= mklocale +TOOL_MKMAGIC= file +TOOL_MKNOD= mknod +TOOL_MKTEMP= mktemp +TOOL_MKUBOOTIMAGE= mkubootimage +TOOL_ELFTOSB= elftosb +TOOL_MSGC= msgc +TOOL_MTREE= mtree +TOOL_NBPERF= nbperf +TOOL_NCDCS= ncdcs +TOOL_PAX= pax +TOOL_PIC= pic +TOOL_PIGZ= pigz +TOOL_PKG_CREATE= pkg_create +TOOL_POWERPCMKBOOTIMAGE= powerpc-mkbootimage +TOOL_PWD_MKDB= pwd_mkdb +TOOL_REFER= refer +TOOL_ROFF_ASCII= nroff +TOOL_ROFF_DOCASCII= ${TOOL_GROFF} -Tascii +TOOL_ROFF_DOCHTML= ${TOOL_GROFF} -Thtml +TOOL_ROFF_DVI= ${TOOL_GROFF} -Tdvi +TOOL_ROFF_HTML= ${TOOL_GROFF} -Tlatin1 -mdoc2html +TOOL_ROFF_PS= ${TOOL_GROFF} -Tps +TOOL_ROFF_RAW= ${TOOL_GROFF} -Z +TOOL_RPCGEN= rpcgen +TOOL_SED= sed +TOOL_SOELIM= soelim +TOOL_SPARKCRC= sparkcrc +TOOL_STAT= stat +.if defined(__MINIX) +TOOL_STRFILE= /usr/games/strfile +.else +TOOL_STRFILE= strfile +.endif # defined(__MINIX) +TOOL_SUNLABEL= sunlabel +TOOL_TBL= tbl +.if defined(__MINIX) +# LSC: There is a tic packaged, which has a completly different set of +# options, so make sure to use the base system one, always. +TOOL_TIC= /usr/bin/tic +.else +TOOL_TIC= tic +.endif # defined(__MINIX) +TOOL_TOPROTO= toproto +TOOL_UUDECODE= uudecode +TOOL_VGRIND= vgrind -f +TOOL_VFONTEDPR= /usr/libexec/vfontedpr +TOOL_ZIC= zic + +.endif # USETOOLS != yes # } + +# Fallback to ensure that all variables are defined to something +TOOL_CC.false= false +TOOL_CPP.false= false +TOOL_CXX.false= false +TOOL_FC.false= false +TOOL_OBJC.false= false +TOOL_OPT.false= false +TOOL_LLC.false= false + +AVAILABLE_COMPILER?= ${HAVE_PCC:Dpcc} ${HAVE_LLVM:Dclang} ${HAVE_GCC:Dgcc} ${EXTERNAL_TOOLCHAIN:Dgcc} false + +.for _t in CC CPP CXX FC OBJC OPT LLC +ACTIVE_${_t}= ${AVAILABLE_COMPILER:@.c.@ ${ !defined(UNSUPPORTED_COMPILER.${.c.}) && defined(TOOL_${_t}.${.c.}) :? ${.c.} : }@:[1]} +SUPPORTED_${_t}=${AVAILABLE_COMPILER:Nfalse:@.c.@ ${ !defined(UNSUPPORTED_COMPILER.${.c.}) && defined(TOOL_${_t}.${.c.}) :? ${.c.} : }@} +.endfor +# make bugs prevent moving this into the .for loop +CC= ${TOOL_CC.${ACTIVE_CC}} +CPP= ${TOOL_CPP.${ACTIVE_CPP}} +CXX= ${TOOL_CXX.${ACTIVE_CXX}} +FC= ${TOOL_FC.${ACTIVE_FC}} +OBJC= ${TOOL_OBJC.${ACTIVE_OBJC}} +OPT= ${TOOL_OPT.${ACTIVE_OPT}} +LLC= ${TOOL_LLC.${ACTIVE_LLC}} + +# Override with tools versions if needed +.if ${MKCTF:Uno} != "no" && !defined(NOCTF) +CTFCONVERT= ${TOOL_CTFCONVERT} +CTFMERGE= ${TOOL_CTFMERGE} +.endif + +# For each ${MACHINE_CPU}, list the ports that use it. +MACHINES.aarch64= evbarm64 +MACHINES.alpha= alpha +MACHINES.arm= acorn26 acorn32 cats epoc32 evbarm hpcarm \ + iyonix netwinder shark zaurus +MACHINES.coldfire= evbcf +MACHINES.i386= i386 +MACHINES.ia64= ia64 +MACHINES.hppa= hppa +MACHINES.m68000= sun2 +MACHINES.m68k= amiga atari cesfic hp300 luna68k mac68k \ + news68k next68k sun3 x68k +MACHINES.mips= arc cobalt algor cobalt emips evbmips ews4800mips \ + hpcmips mipsco newsmips pmax sbmips sgimips +MACHINES.or1k= or1k +MACHINES.powerpc= amigappc bebox evbppc ibmnws macppc mvmeppc \ + ofppc prep rs6000 sandpoint +MACHINES.riscv= riscv +MACHINES.sh3= dreamcast evbsh3 hpcsh landisk mmeye +MACHINES.sparc= sparc sparc64 +MACHINES.sparc64= sparc64 +MACHINES.vax= vax +MACHINES.x86_64= amd64 + +# for crunchide & ldd, define the OBJECT_FMTS used by a MACHINE_ARCH +# +OBJECT_FMTS= +.if ${MACHINE_ARCH} != "alpha" +OBJECT_FMTS+= elf32 +.endif +.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH:M*64*} != "" +OBJECT_FMTS+= elf64 +.endif + +# OBJCOPY flags to create a.out binaries for old firmware +# shared among src/distrib and ${MACHINE}/conf/Makefile.${MACHINE}.inc +.if ${MACHINE_CPU} == "arm" +OBJCOPY_ELF2AOUT_FLAGS?= \ + -O a.out-arm-netbsd \ + -R .ident \ + -R .ARM.attributes \ + -R .ARM.exidx \ + -R .ARM.extab \ + -R .arm.atpcs \ + -R .comment \ + -R .debug_abbrev \ + -R .debug_aranges \ + -R .debug_info \ + -R .debug_line \ + -R .debug_frame \ + -R .debug_loc \ + -R .debug_pubnames \ + -R .debug_pubtypes \ + -R .debug_ranges \ + -R .debug_str \ + -R .eh_frame \ + -R .note.netbsd.ident +.endif + +# +# Targets to check if DESTDIR or RELEASEDIR is provided +# +.if !target(check_DESTDIR) +check_DESTDIR: .PHONY .NOTMAIN +.if !defined(DESTDIR) + @echo "setenv DESTDIR before doing that!" + @false +.else + @true +.endif +.endif + +.if !target(check_RELEASEDIR) +check_RELEASEDIR: .PHONY .NOTMAIN +.if !defined(RELEASEDIR) + @echo "setenv RELEASEDIR before doing that!" + @false +.else + @true +.endif +.endif + +# +# Build a dynamically linked /bin and /sbin, with the necessary shared +# libraries moved from /usr/lib to /lib and the shared linker moved +# from /usr/libexec to /lib +# +# Note that if the BINDIR is not /bin or /sbin, then we always use the +# non-DYNAMICROOT behavior (i.e. it is only enabled for programs in /bin +# and /sbin). See . +# +MKDYNAMICROOT?= yes + +# +# Where the system object and source trees are kept; can be configurable +# by the user in case they want them in ~/foosrc and ~/fooobj (for example). +# +BSDSRCDIR?= /usr/src +BSDOBJDIR?= /usr/obj +NETBSDSRCDIR?= ${BSDSRCDIR} + +BINGRP?= wheel +BINOWN?= root +BINMODE?= 555 +NONBINMODE?= 444 + +# These are here mainly because we don't want suid root in case +# a Makefile defines BINMODE. +RUMPBINGRP?= wheel +RUMPBINOWN?= root +RUMPBINMODE?= 555 +RUMPNONBINMODE?=444 + +MANDIR?= /usr/share/man +MANGRP?= wheel +MANOWN?= root +MANMODE?= ${NONBINMODE} +MANINSTALL?= ${_MANINSTALL} + +INFODIR?= /usr/share/info +INFOGRP?= wheel +INFOOWN?= root +INFOMODE?= ${NONBINMODE} + +LIBDIR?= /usr/lib + +LINTLIBDIR?= /usr/libdata/lint +LIBGRP?= ${BINGRP} +LIBOWN?= ${BINOWN} +LIBMODE?= ${NONBINMODE} + +DOCDIR?= /usr/share/doc +DOCGRP?= wheel +DOCOWN?= root +DOCMODE?= ${NONBINMODE} + +NLSDIR?= /usr/share/nls +NLSGRP?= wheel +NLSOWN?= root +NLSMODE?= ${NONBINMODE} + +KMODULEGRP?= wheel +KMODULEOWN?= root +KMODULEMODE?= ${NONBINMODE} + +LOCALEDIR?= /usr/share/locale +LOCALEGRP?= wheel +LOCALEOWN?= root +LOCALEMODE?= ${NONBINMODE} + +FIRMWAREDIR?= /libdata/firmware +FIRMWAREGRP?= wheel +FIRMWAREOWN?= root +FIRMWAREMODE?= ${NONBINMODE} + +DEBUGDIR?= /usr/libdata/debug +DEBUGGRP?= wheel +DEBUGOWN?= root +DEBUGMODE?= ${NONBINMODE} + +# +# Data-driven table using make variables to control how +# toolchain-dependent targets and shared libraries are built +# for different platforms and object formats. +# +# OBJECT_FMT: currently either "ELF" or "a.out". +# +# All platforms are ELF. +# +OBJECT_FMT= ELF + +# +# If this platform's toolchain is missing, we obviously cannot build it. +# +.if ${TOOLCHAIN_MISSING} != "no" +MKBINUTILS:= no +MKGDB:= no +MKGCC:= no +.endif + +# +# If we are using an external toolchain, we can still build the target's +# binutils, but we cannot build GCC's support libraries, since those are +# tightly-coupled to the version of GCC being used. +# +.if defined(EXTERNAL_TOOLCHAIN) +MKGCC:= no +.endif + +# No GDB support for aarch64 +MKGDB.aarch64= no +MKGDB.or1k= no +MKGDB.riscv32= no +MKGDB.riscv64= no + +# No kernel modules for or1k (yet) +MKKMOD.or1k= no +MKKMOD.riscv32= no +MKKMOD.riscv64= no + +# No profiling for or1k (yet) +MKPROFILE.or1k= no +MKPROFILE.riscv32=no +MKPROFILE.riscv64=no + +# +# The m68000 port is incomplete. +# +.if ${MACHINE_ARCH} == "m68000" +NOPIC= # defined +MKISCSI= no +# XXX GCC 4 outputs mcount() calling sequences that try to load values +# from over 64KB away and this fails to assemble. +.if defined(HAVE_GCC) +NOPROFILE= # defined +.endif +.endif + +# +# The ia64 port is incomplete. +# +MKLINT.ia64= no +MKGDB.ia64= no + +# +# On the MIPS, all libs are compiled with ABIcalls (and are thus PIC), +# not just shared libraries, so don't build the _pic version. +# +.if ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \ + ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb" +MKPICLIB:= no +.endif + +# PowerPC64 and AArch64 ABI's are PIC +MKPICLIB.powerpc64= no +#MKPICLIB.aarch64= no + +# +# On VAX using ELF, all objects are PIC, not just shared libraries, +# so don't build the _pic version. +# +MKPICLIB.vax= no + +# +# Location of the file that contains the major and minor numbers of the +# version of a shared library. If this file exists a shared library +# will be built by . +# +SHLIB_VERSION_FILE?= ${.CURDIR}/shlib_version + +# +# GNU sources and packages sometimes see architecture names differently. +# +GNU_ARCH.aarch64eb=aarch64_be +GNU_ARCH.coldfire=m5407 +GNU_ARCH.earm=arm +GNU_ARCH.earmhf=arm +GNU_ARCH.earmeb=armeb +GNU_ARCH.earmhfeb=armeb +GNU_ARCH.earmv4=armv4 +GNU_ARCH.earmv4eb=armv4eb +GNU_ARCH.earmv5=arm +GNU_ARCH.earmv5eb=armeb +GNU_ARCH.earmv6=armv6 +GNU_ARCH.earmv6hf=armv6 +GNU_ARCH.earmv6eb=armv6eb +GNU_ARCH.earmv6hfeb=armv6eb +GNU_ARCH.earmv7=armv7 +GNU_ARCH.earmv7hf=armv7 +GNU_ARCH.earmv7eb=armv7eb +GNU_ARCH.earmv7hfeb=armv7eb +GNU_ARCH.i386=i486 +GCC_CONFIG_ARCH.i386=i486 +GCC_CONFIG_TUNE.i386=nocona +GCC_CONFIG_TUNE.x86_64=nocona +GNU_ARCH.m68000=m68010 +GNU_ARCH.sh3eb=sh +GNU_ARCH.sh3el=shle +GNU_ARCH.mips64eb=mips64 + +.if defined(__MINIX) +# MINIX/arm default +GCC_CONFIG_ARCH.earm=armv7-a + +# MINIX/intel default +GNU_ARCH.i386=i586 +GCC_CONFIG_ARCH.i386=i586 + +.endif # defined(__MINIX) + +MACHINE_GNU_ARCH=${GNU_ARCH.${MACHINE_ARCH}:U${MACHINE_ARCH}} + +# +# In order to identify NetBSD to GNU packages, we sometimes need +# an "elf" tag for historically a.out platforms. +# +.if (!empty(MACHINE_ARCH:Mearm*)) +MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsdelf-${MACHINE_ARCH:C/eb//:C/v[4-7]//:S/earm/eabi/} +.elif (${MACHINE_GNU_ARCH} == "arm" || \ + ${MACHINE_GNU_ARCH} == "armeb" || \ + ${MACHINE_ARCH} == "i386" || \ + ${MACHINE_CPU} == "m68k" || \ + ${MACHINE_GNU_ARCH} == "sh" || \ + ${MACHINE_GNU_ARCH} == "shle" || \ + ${MACHINE_ARCH} == "sparc" || \ + ${MACHINE_ARCH} == "vax") +MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsdelf +.else +MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsd +.endif + +.if defined(__MINIX) +# We have a simpler toolchain naming scheme +MACHINE_GNU_PLATFORM:=${MACHINE_GNU_ARCH}-elf32-minix + +# We need to check for HAVE_GOLD after LD has been set +. if ${_HAVE_GOLD:U} == "" + _HAVE_GOLD!= (exec 2>&1; ${LD} --version || echo "") + _GOLD_MATCH:=${_HAVE_GOLD:Mgold} + _HAVE_GOLD:= ${_HAVE_GOLD:M[0-9]\.[0-9][0-9]} + +. if ${_GOLD_MATCH} != "" && ${_HAVE_GOLD} != "" + HAVE_GOLD?= ${_HAVE_GOLD} + +# Without -Wl,--no-ctors-in-init-array, gold moves the constructors out of +# .ctors into .init_array, which is bad on intel. + LDFLAGS+= -Wl,--no-ctors-in-init-array +. else + USE_BITCODE:=no +. endif +. endif # ${_HAVE_GOLD:U} == "" +.endif # defined(__MINIX) + +.if !empty(MACHINE_ARCH:M*arm*) +# Flags to pass to CC for using the old APCS ABI on ARM for compat or stand. +ARM_APCS_FLAGS= -mabi=apcs-gnu -mfloat-abi=soft +ARM_APCS_FLAGS+=${${ACTIVE_CC} == "gcc":? -marm :} +ARM_APCS_FLAGS+=${${ACTIVE_CC} == "clang":? -target ${MACHINE_GNU_ARCH}--netbsdelf -B ${TOOLDIR}/${MACHINE_GNU_PLATFORM}/bin :} +.endif + +GENASSYM_CPPFLAGS+= ${${ACTIVE_CC} == "clang":? -no-integrated-as :} + +TARGETS+= all clean cleandir depend dependall includes \ + install lint obj regress tags html analyze +PHONY_NOTMAIN = all clean cleandir depend dependall distclean includes \ + install lint obj regress beforedepend afterdepend \ + beforeinstall afterinstall realinstall realdepend realall \ + html subdir-all subdir-install subdir-depend analyze +.PHONY: ${PHONY_NOTMAIN} +.NOTMAIN: ${PHONY_NOTMAIN} + +.if ${NEED_OWN_INSTALL_TARGET} != "no" +.if !target(install) +install: beforeinstall .WAIT subdir-install realinstall .WAIT afterinstall +beforeinstall: +subdir-install: +realinstall: +afterinstall: +.endif +all: realall subdir-all +subdir-all: +realall: +depend: realdepend subdir-depend +subdir-depend: +realdepend: +distclean: cleandir +cleandir: clean + +dependall: .NOTMAIN realdepend .MAKE + @cd "${.CURDIR}"; ${MAKE} realall +.endif + +# +# Define MKxxx variables (which are either yes or no) for users +# to set in /etc/mk.conf and override in the make environment. +# These should be tested with `== "no"' or `!= "no"'. +# The NOxxx variables should only be set by Makefiles. +# +# Please keep etc/Makefile and share/man/man5/mk.conf.5 in sync +# with changes to the MK* variables here. +# + +# +# Supported NO* options (if defined, MK* will be forced to "no", +# regardless of user's mk.conf setting). +# +# Source makefiles should set NO*, and not MK*, and must do so before +# including bsd.own.mk. +# +.for var in \ + NOCRYPTO NODOC NOHTML NOINFO NOLINKLIB NOLINT NOMAN NONLS NOOBJ NOPIC \ + NOPICINSTALL NOPROFILE NOSHARE NOSTATICLIB +.if defined(${var}) +MK${var:S/^NO//}:= no +.endif +.endfor + +# +# Older-style variables that enabled behaviour when set. +# +.for var in MANZ UNPRIVED UPDATE +.if defined(${var}) +MK${var}:= yes +.endif +.endfor + +# +# MK* options which have variable defaults. +# +.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "sparc64" \ + || ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el" \ + || ${MACHINE_ARCH} == "powerpc64" || ${MACHINE_CPU} == "aarch64" \ + || ${MACHINE_ARCH} == "riscv64" \ + || !empty(MACHINE_ARCH:Mearm*) +MKCOMPAT?= yes +.else +# Don't let this build where it really isn't supported. +MKCOMPAT:= no +MKCOMPATTESTS:= no +MKCOMPATX11:= no +.endif + +.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386" \ + || ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el" \ + || (${MACHINE} == "evbppc" && ${MACHINE_ARCH} == "powerpc") +MKCOMPATMODULES?= yes +.else +MKCOMPATMODULES:= no +.endif + +# +# Default mips64 to softfloat now. +# arm is always softfloat unless it isn't +# emips is always softfloat. +# coldfire is always softfloat +# or1k is always softfloat +# +.if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el" || \ + (${MACHINE_CPU} == "arm" && ${MACHINE_ARCH:M*hf*} == "") || \ + ${MACHINE_ARCH} == "coldfire" || ${MACHINE_CPU} == "or1k" || \ + ${MACHINE} == "emips" +MKSOFTFLOAT?= yes +.endif + +.if ${MACHINE} == "emips" +SOFTFLOAT_BITS= 32 +.endif + +.if ${MACHINE_ARCH} == "i386" || \ + ${MACHINE_ARCH} == "x86_64" || \ + ${MACHINE_ARCH} == "sparc" +MKSLJIT?= yes +.else +MKSLJIT?= no +.endif + +# +# MK* backward compatibility. +# +.if defined(MKBFD) +MKBINUTILS?= ${MKBFD} +.endif + +# +# We want to build zfs only for amd64 by default for now. +# +.if ${MACHINE} == "amd64" +MKZFS?= yes +.endif + +# +# MK* options which default to "yes". +# +_MKVARS.yes= \ + MKATF \ + MKBINUTILS \ + MKCRYPTO MKCOMPLEX MKCVS MKCXX \ + MKDOC \ + MKGCC MKGDB MKGROFF \ + MKHESIOD MKHTML \ + MKIEEEFP MKINET6 MKINFO MKIPFILTER MKISCSI \ + MKKERBEROS \ + MKKMOD \ + MKLDAP MKLIBSTDCXX MKLINKLIB MKLVM \ + MKMAN MKMANDOC \ + MKMDNS \ + MKMAKEMANDB \ + MKNLS \ + MKNPF \ + MKOBJ \ + MKPAM MKPERFUSE \ + MKPF MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX MKPROFILE \ + MKRUMP \ + MKSHARE MKSKEY MKSTATICLIB \ + MKX11FONTS \ + MKYP + +#MINIX-specific vars +_MKVARS.yes+= \ + MKSYSDEBUG MKLIVEUPDATE MKLLVMCMDS +.if (${MACHINE_ARCH} == "i386") +_MKVARS.yes+= \ + MKWATCHDOG MKACPI MKAPIC MKDEBUGREG MKINSTALLBOOT MKPCI +.endif + +.for var in ${_MKVARS.yes} +${var}?= ${${var}.${MACHINE_ARCH}:Uyes} +.endfor + +# +# MKGCCCMDS is only valid if we are building GCC so make it dependent on that. +# +_MKVARS.yes += MKGCCCMDS +MKGCCCMDS?= ${MKGCC} + +# +# Exceptions to the above: +# +.if ${MACHINE} == "acorn26" # page size is prohibitive +MKKMOD= no +.endif + +# +# MK* options which default to "no". Note that MKZFS has a different +# default for some platforms, see above. +# +_MKVARS.no= \ + MKBSDGREP MKBSDTAR \ + MKCATPAGES MKCOMPATTESTS MKCOMPATX11 MKCRYPTO_RC5 MKCTF MKDEBUG \ + MKDEBUGLIB MKDTRACE MKEXTSRC MKGROFFHTMLDOC \ + MKKYUA MKLLD MKLLDB MKLINT \ + MKMANZ MKMCLINKER MKOBJDIRS \ + MKLIBCXX MKLLVM MKPCC \ + MKPIGZGZIP \ + MKREPRO \ + MKSOFTFLOAT MKSTRIPIDENT MKTPM \ + MKUNPRIVED MKUPDATE MKX11 MKX11MOTIF MKZFS + +#MINIX-specific vars +_MKVARS.no+= \ + MKIMAGEONLY MKSMALL MKBITCODE MKMAGIC MKPAE MKASR MKSRC +.if !empty(MACHINE_ARCH:Mearm*) +_MKVARS.no+= \ + MKWATCHDOG MKPAE MKACPI MKAPIC MKDEBUGREG MKINSTALLBOOT MKPCI +.endif + +.for var in ${_MKVARS.no} +${var}?= ${${var}.${MACHINE_ARCH}:Uno} +.endfor + +# +# Which platforms build the xorg-server drivers (as opposed +# to just Xnest and Xvfb.) +# +.if ${MACHINE} == "alpha" || \ + ${MACHINE} == "amd64" || \ + ${MACHINE} == "bebox" || \ + ${MACHINE} == "cats" || \ + ${MACHINE} == "dreamcast" || \ + ${MACHINE} == "ews4800mips" || \ + ${MACHINE} == "evbarm" || \ + ${MACHINE} == "evbmips" || \ + ${MACHINE} == "hp300" || \ + ${MACHINE} == "hpcarm" || \ + ${MACHINE} == "hpcmips" || \ + ${MACHINE} == "hpcsh" || \ + ${MACHINE} == "i386" || \ + ${MACHINE} == "luna68k" || \ + ${MACHINE} == "mac68k" || \ + ${MACHINE} == "macppc" || \ + ${MACHINE} == "netwinder" || \ + ${MACHINE} == "newsmips" || \ + ${MACHINE} == "prep" || \ + ${MACHINE} == "ofppc" || \ + ${MACHINE} == "sgimips" || \ + ${MACHINE} == "shark" || \ + ${MACHINE} == "sparc" || \ + ${MACHINE} == "sparc64" || \ + ${MACHINE} == "vax" || \ + ${MACHINE} == "zaurus" +MKXORG_SERVER?=yes +.else +MKXORG_SERVER?=no +.endif + +# +# Force some options off if their dependencies are off. +# + +.if ${MKCXX} == "no" +MKATF:= no +MKGROFF:= no +MKKYUA:= no +.endif + +.if ${MKCRYPTO} == "no" +MKKERBEROS:= no +MKLDAP:= no +.endif + +.if ${MKMAN} == "no" +MKCATPAGES:= no +MKHTML:= no +.endif + +_MANINSTALL= maninstall +.if ${MKCATPAGES} != "no" +_MANINSTALL+= catinstall +.endif +.if ${MKHTML} != "no" +_MANINSTALL+= htmlinstall +.endif + +.if ${MKLINKLIB} == "no" +MKLINT:= no +MKPICINSTALL:= no +MKPROFILE:= no +.endif + +.if ${MKPIC} == "no" +MKPICLIB:= no +.endif + +.if ${MKOBJ} == "no" +MKOBJDIRS:= no +.endif + +.if ${MKSHARE} == "no" +MKCATPAGES:= no +MKDOC:= no +MKINFO:= no +MKHTML:= no +MKMAN:= no +MKNLS:= no +.endif + +# MINIX +.if ${MKSMALL} == "yes" +MKWATCHDOG:= no +MKACPI:= no +MKAPIC:= no +MKDEBUGREG:= no +MKSYSDEBUG:= no +MKLIVEUPDATE:= no +.endif + +# MINIX: MKASR implies MKMAGIC +.if ${MKASR} == "yes" +MKMAGIC:= yes +.endif + +# MINIX: MKMAGIC implies MKBITCODE +.if ${MKMAGIC} == "yes" +MKBITCODE:= yes +.endif + +.if !empty(MACHINE_ARCH:Mearm*) +_NEEDS_LIBCXX.${MACHINE_ARCH}= yes +.endif +_NEEDS_LIBCXX.i386= yes +_NEEDS_LIBCXX.powerpc= yes +_NEEDS_LIBCXX.powerpc64= yes +_NEEDS_LIBCXX.x86_64= yes +_NEEDS_LIBCXX.aarch64= yes + +.if ${MKLLVM} == "yes" && ${_NEEDS_LIBCXX.${MACHINE_ARCH}:Uno} == "yes" +MKLIBCXX:= yes +.endif + +# +# install(1) parameters. +# +COPY?= -c +.if ${MKUPDATE} == "no" +PRESERVE?= +.else +PRESERVE?= -p +.endif +RENAME?= -r +HRDLINK?= -l h +SYMLINK?= -l s + +METALOG?= ${DESTDIR}/METALOG +METALOG.add?= ${TOOL_CAT} -l >> ${METALOG} +.if (${_SRC_TOP_} != "") # only set INSTPRIV if inside ${NETBSDSRCDIR} +.if ${MKUNPRIVED} != "no" +INSTPRIV.unpriv=-U -M ${METALOG} -D ${DESTDIR} -h sha256 +.else +INSTPRIV.unpriv= +.endif +INSTPRIV?= ${INSTPRIV.unpriv} -N ${NETBSDSRCDIR}/etc +.endif +STRIPFLAG?= + +.if ${NEED_OWN_INSTALL_TARGET} != "no" +INSTALL_DIR?= ${INSTALL} ${INSTPRIV} -d +INSTALL_FILE?= ${INSTALL} ${INSTPRIV} ${COPY} ${PRESERVE} ${RENAME} +INSTALL_LINK?= ${INSTALL} ${INSTPRIV} ${HRDLINK} ${RENAME} +INSTALL_SYMLINK?= ${INSTALL} ${INSTPRIV} ${SYMLINK} ${RENAME} +.endif + +# +# Set defaults for the USE_xxx variables. +# + +# +# USE_* options which default to "no" and will be forced to "no" if their +# corresponding MK* variable is set to "no". +# +.for var in USE_SKEY +.if (${${var:S/USE_/MK/}} == "no") +${var}:= no +.else +${var}?= no +.endif +.endfor + +# +# USE_* options which default to "yes" unless their corresponding MK* +# variable is set to "no". +# +.for var in USE_HESIOD USE_INET6 USE_KERBEROS USE_LDAP USE_PAM USE_YP +.if (${${var:S/USE_/MK/}} == "no") +${var}:= no +.else +${var}?= yes +.endif +.endfor + +#MINIX-specific vars +.for var in \ + USE_WATCHDOG USE_ACPI USE_PAE USE_APIC USE_DEBUGREG USE_SYSDEBUG \ + USE_LIVEUPDATE USE_PCI USE_BITCODE USE_MAGIC USE_ASR +.if (${${var:S/USE_/MK/}} == "no") +${var}:= no +.else +${var}?= yes +.endif +.endfor + +# +# USE_* options which default to "yes". +# +.for var in USE_JEMALLOC +${var}?= yes +.endfor + +# +# USE_* options which default to "no". +# +# For now, disable pigz as compressor by default +.for var in USE_PIGZGZIP USE_LIBTRE +${var}?= no +.endfor + +# +# TOOL_GZIP and friends. These might refer to TOOL_PIGZ or to the host gzip. +# +.if ${USE_PIGZGZIP} != "no" +TOOL_GZIP= ${TOOL_PIGZ} +GZIP_N_FLAG?= -nT +.else +TOOL_GZIP= gzip +GZIP_N_FLAG?= -n +.endif +TOOL_GZIP_N= ${TOOL_GZIP} ${GZIP_N_FLAG} + +# +# Where X11 sources are and where it is installed to. +# +.if !defined(X11SRCDIR) +.if exists(${NETBSDSRCDIR}/../xsrc) +X11SRCDIR!= cd "${NETBSDSRCDIR}/../xsrc" && pwd +.else +X11SRCDIR= /usr/xsrc +.endif +.endif # !defined(X11SRCDIR) + +X11SRCDIR.local?= ${X11SRCDIR}/local +X11ROOTDIR?= /usr/X11R7 +X11BINDIR?= ${X11ROOTDIR}/bin +X11ETCDIR?= /etc/X11 +X11FONTDIR?= ${X11ROOTDIR}/lib/X11/fonts +X11INCDIR?= ${X11ROOTDIR}/include +X11LIBDIR?= ${X11ROOTDIR}/lib/X11 +X11MANDIR?= ${X11ROOTDIR}/man +X11SHAREDIR?= ${X11ROOTDIR}/share +X11USRLIBDIR?= ${X11ROOTDIR}/lib${MLIBDIR:D/${MLIBDIR}} + +# +# New modular-xorg based builds +# +X11SRCDIRMIT?= ${X11SRCDIR}/external/mit +.for _lib in \ + FS ICE SM X11 XScrnSaver XTrap Xau Xcomposite Xcursor Xdamage \ + Xdmcp Xevie Xext Xfixes Xfont Xft Xi Xinerama Xmu Xpresent Xpm \ + Xrandr Xrender Xres Xt Xtst Xv XvMC Xxf86dga Xxf86misc Xxf86vm drm \ + fontenc xkbfile xkbui Xaw Xfontcache pciaccess xcb \ + pthread-stubs +X11SRCDIR.${_lib}?= ${X11SRCDIRMIT}/lib${_lib}/dist +.endfor + +.for _proto in \ + xcmisc xext xf86bigfont bigreqs input kb x fonts fixes scrnsaver \ + xinerama dri2 dri3 render resource record video xf86dga xf86misc \ + xf86vidmode composite damage trap gl randr fontcache xf86dri \ + present xcb- +X11SRCDIR.${_proto}proto?= ${X11SRCDIRMIT}/${_proto}proto/dist +.endfor + +.for _dir in \ + xtrans fontconfig freetype evieext mkfontscale bdftopcf \ + xkbcomp xorg-cf-files imake xorg-server xbiff xkeyboard-config \ + xbitmaps appres xeyes xev xedit sessreg pixman \ + beforelight bitmap editres makedepend fonttosfnt fslsfonts fstobdf \ + glu glw mesa-demos MesaGLUT MesaLib MesaLib7 \ + ico iceauth listres lndir \ + luit xproxymanagementprotocol mkfontdir oclock proxymngr rgb \ + rstart setxkbmap showfont smproxy twm viewres \ + x11perf xauth xcalc xclipboard \ + xclock xcmsdb xconsole xditview xdpyinfo xdriinfo xdm \ + xfd xf86dga xfindproxy xfontsel xfwp xgamma xgc xhost xinit \ + xkill xload xlogo xlsatoms xlsclients xlsfonts xmag xmessage \ + xmh xmodmap xmore xman xprop xrandr xrdb xrefresh xset \ + xsetmode xsetpointer xsetroot xsm xstdcmap xvidtune xvinfo \ + xwininfo xwud xkbprint xkbevd \ + xterm xwd xfs xfsinfo xtrap xkbutils xkbcomp \ + xkeyboard-config xinput xcb-util xorg-docs \ + font-adobe-100dpi font-adobe-75dpi font-adobe-utopia-100dpi \ + font-adobe-utopia-75dpi font-adobe-utopia-type1 \ + font-alias \ + font-bh-100dpi font-bh-75dpi font-bh-lucidatypewriter-100dpi \ + font-bh-lucidatypewriter-75dpi font-bh-ttf font-bh-type1 \ + font-bitstream-100dpi font-bitstream-75dpi font-bitstream-type1 \ + font-cursor-misc font-daewoo-misc font-dec-misc font-ibm-type1 \ + font-isas-misc font-jis-misc font-misc-misc font-mutt-misc \ + font-sony-misc font-util ttf-bitstream-vera encodings +X11SRCDIR.${_dir}?= ${X11SRCDIRMIT}/${_dir}/dist +.endfor + +.for _i in \ + elographics keyboard mouse synaptics vmmouse void ws +X11SRCDIR.xf86-input-${_i}?= ${X11SRCDIRMIT}/xf86-input-${_i}/dist +.endfor + +.for _v in \ + ag10e apm ark ast ati ati-kms chips cirrus crime \ + geode glint i128 i740 igs imstt intel intel-old mach64 mga \ + neomagic newport nsc nv nvxbox openchrome pnozz \ + r128 radeonhd rendition \ + s3 s3virge savage siliconmotion sis suncg14 \ + suncg6 sunffb sunleo suntcx \ + tdfx tga trident tseng vesa vga vmware wsfb xgi +X11SRCDIR.xf86-video-${_v}?= ${X11SRCDIRMIT}/xf86-video-${_v}/dist +.endfor + +# Only install the radeon firmware on DRM-happy systems. +.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386" +MKRADEONFIRMWARE?= yes +.endif +MKRADEONFIRMWARE?= no + +X11DRI?= yes +X11LOADABLE?= yes + + +# +# Where extsrc sources are and where it is installed to. +# +.if !defined(EXTSRCSRCDIR) +.if exists(${NETBSDSRCDIR}/../extsrc) +EXTSRCSRCDIR!= cd "${NETBSDSRCDIR}/../extsrc" && pwd +.else +EXTSRCSRCDIR= /usr/extsrc +.endif +.endif # !defined(EXTSRCSRCDIR) + +EXTSRCROOTDIR?= /usr/ext +EXTSRCBINDIR?= ${EXTSRCROOTDIR}/bin +EXTSRCETCDIR?= /etc/ext +EXTSRCINCDIR?= ${EXTSRCROOTDIR}/include +EXTSRCLIBDIR?= ${EXTSRCROOTDIR}/lib/ext +EXTSRCMANDIR?= ${EXTSRCROOTDIR}/man +EXTSRCUSRLIBDIR?= ${EXTSRCROOTDIR}/lib + +# +# MAKEDIRTARGET dir target [extra make(1) params] +# run "cd $${dir} && ${MAKEDIRTARGETENV} ${MAKE} [params] $${target}", with a pretty message +# +MAKEDIRTARGETENV?= +MAKEDIRTARGET=\ + @_makedirtarget() { \ + dir="$$1"; shift; \ + target="$$1"; shift; \ + case "$${dir}" in \ + /*) this="$${dir}/"; \ + real="$${dir}" ;; \ + .) this="${_THISDIR_}"; \ + real="${.CURDIR}" ;; \ + *) this="${_THISDIR_}$${dir}/"; \ + real="${.CURDIR}/$${dir}" ;; \ + esac; \ + show=$${this:-.}; \ + echo "$${target} ===> $${show%/}$${1:+ (with: $$@)}"; \ + cd "$${real}" \ + && ${MAKEDIRTARGETENV} ${MAKE} _THISDIR_="$${this}" "$$@" $${target}; \ + }; \ + _makedirtarget + +# +# MAKEVERBOSE support. Levels are: +# 0 Minimal output ("quiet") +# 1 Describe what is occurring +# 2 Describe what is occurring and echo the actual command +# 3 Ignore the effect of the "@" prefix in make commands +# 4 Trace shell commands using the shell's -x flag +# +MAKEVERBOSE?= 2 + +.if ${MAKEVERBOSE} == 0 +_MKMSG?= @\# +_MKSHMSG?= : echo +_MKSHECHO?= : echo +.SILENT: +.elif ${MAKEVERBOSE} == 1 +_MKMSG?= @echo ' ' +_MKSHMSG?= echo ' ' +_MKSHECHO?= : echo +.SILENT: +.else # MAKEVERBOSE >= 2 +_MKMSG?= @echo '\# ' +_MKSHMSG?= echo '\# ' +_MKSHECHO?= echo +.SILENT: __makeverbose_dummy_target__ +.endif # MAKEVERBOSE >= 2 +.if ${MAKEVERBOSE} >= 3 +.MAKEFLAGS: -dl +.endif # ${MAKEVERBOSE} >= 3 +.if ${MAKEVERBOSE} >= 4 +.MAKEFLAGS: -dx +.endif # ${MAKEVERBOSE} >= 4 + +_MKMSG_BUILD?= ${_MKMSG} " build " +_MKMSG_CREATE?= ${_MKMSG} " create " +_MKMSG_COMPILE?= ${_MKMSG} "compile " +_MKMSG_FORMAT?= ${_MKMSG} " format " +_MKMSG_INSTALL?= ${_MKMSG} "install " +_MKMSG_LINK?= ${_MKMSG} " link " +_MKMSG_LEX?= ${_MKMSG} " lex " +_MKMSG_REMOVE?= ${_MKMSG} " remove " +_MKMSG_YACC?= ${_MKMSG} " yacc " + +_MKSHMSG_CREATE?= ${_MKSHMSG} " create " +_MKSHMSG_INSTALL?= ${_MKSHMSG} "install " + +_MKTARGET_BUILD?= ${_MKMSG_BUILD} ${.CURDIR:T}/${.TARGET} +_MKTARGET_CREATE?= ${_MKMSG_CREATE} ${.CURDIR:T}/${.TARGET} +_MKTARGET_COMPILE?= ${_MKMSG_COMPILE} ${.CURDIR:T}/${.TARGET} +_MKTARGET_FORMAT?= ${_MKMSG_FORMAT} ${.CURDIR:T}/${.TARGET} +_MKTARGET_INSTALL?= ${_MKMSG_INSTALL} ${.TARGET} +_MKTARGET_LINK?= ${_MKMSG_LINK} ${.CURDIR:T}/${.TARGET} +_MKTARGET_LEX?= ${_MKMSG_LEX} ${.CURDIR:T}/${.TARGET} +_MKTARGET_REMOVE?= ${_MKMSG_REMOVE} ${.TARGET} +_MKTARGET_YACC?= ${_MKMSG_YACC} ${.CURDIR:T}/${.TARGET} + +.if ${MKMANDOC} == "yes" +TARGETS+= lintmanpages +.endif + +TESTSBASE= /usr/tests${MLIBDIR:D/${MLIBDIR}} + +.endif # !defined(_BSD_OWN_MK_) diff --git a/src/share/mk/bsd.prog.mk b/src/share/mk/bsd.prog.mk new file mode 100644 index 0000000..ce10cf5 --- /dev/null +++ b/src/share/mk/bsd.prog.mk @@ -0,0 +1,789 @@ +# $NetBSD: bsd.prog.mk,v 1.292 2015/06/07 15:04:28 matt Exp $ +# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94 + +.ifndef HOSTPROG + +.include +.include +.include +.include + +# +# Definitions and targets shared among all programs built by a single +# Makefile. +# + +##### Basic targets +realinstall: proginstall scriptsinstall + +.gdbinit: + rm -f .gdbinit +.if defined(DESTDIR) && !empty(DESTDIR) + echo "set solib-absolute-prefix ${DESTDIR}" > .gdbinit +.else + touch .gdbinit +.endif +.for __gdbinit in ${GDBINIT} + echo "source ${__gdbinit}" >> .gdbinit +.endfor + +CLEANFILES+= a.out [Ee]rrs mklog core *.core .gdbinit + +.if defined(SHAREDSTRINGS) +CLEANFILES+=strings +.c.o: + ${CC} -E ${CPPFLAGS} ${CFLAGS} ${.IMPSRC} | xstr -c - + @${CC} ${CPPFLAGS} ${CFLAGS} -c x.c -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif + @rm -f x.c + +.cc.o .cpp.o .cxx.o .C.o: + ${CXX} -E ${CPPFLAGS} ${CXXFLAGS} ${.IMPSRC} | xstr -c - + @mv -f x.c x.cc + @${CXX} ${CPPFLAGS} ${CXXFLAGS} -c x.cc -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif + @rm -f x.cc +.endif + +.if defined(MKPIE) && (${MKPIE} != "no") +CFLAGS+= ${PIE_CFLAGS} +AFLAGS+= ${PIE_AFLAGS} +LDFLAGS+= ${PIE_LDFLAGS} +.endif + +CFLAGS+= ${COPTS} +.if defined(MKDEBUG) && (${MKDEBUG} != "no") +CFLAGS+= -g +.endif +OBJCFLAGS+= ${OBJCOPTS} +MKDEP_SUFFIXES?= .o .ln .d + +# CTF preserve debug symbols +.if (${MKCTF:Uno} != "no") && (${CFLAGS:M-g} != "") +CTFFLAGS+= -g +CTFMFLAGS+= -g +.if defined(HAVE_GCC) && ${HAVE_GCC} >= 48 +#CFLAGS+=-gdwarf-2 +.endif +.endif + +# ELF platforms depend on crti.o, crtbegin.o, crtend.o, and crtn.o +.ifndef LIBCRTBEGIN +LIBCRTBEGIN= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crti.o ${_GCC_CRTBEGIN} +.MADE: ${LIBCRTBEGIN} +.endif +.ifndef LIBCRTEND +LIBCRTEND= ${_GCC_CRTEND} ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtn.o +.MADE: ${LIBCRTEND} +.endif +_SHLINKER= ${SHLINKDIR}/ld.elf_so + +.ifndef LIBCRT0 +LIBCRT0= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crt0.o +.MADE: ${LIBCRT0} +.endif + +.ifndef LIBCRTI +LIBCRTI= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crti.o +.MADE: ${LIBCRTI} +.endif + +##### Installed system library definitions +# +# E.g. +# LIBC?=${DESTDIR}/usr/lib/libc.a +# LIBX11?=${DESTDIR}/usr/X11R7/lib/libX11.a +# etc.. +# NB: If you are a library here, add it in bsd.README + +.for _lib in \ + archive \ + asn1 \ + atf_c \ + atf_cxx \ + bind9 \ + bluetooth \ + bsdmalloc \ + bz2 \ + c \ + c_pic \ + com_err \ + compat \ + crypt \ + crypto \ + crypto_idea \ + crypto_mdc2 \ + crypto_rc5 \ + curses \ + dbm \ + des \ + dns \ + edit \ + event \ + expat \ + fetch \ + fl \ + form \ + g2c \ + gcc \ + gnumalloc \ + gssapi \ + hdb \ + heimbase \ + heimntlm \ + hx509 \ + intl \ + ipsec \ + isc \ + isccc \ + isccfg \ + kadm5clnt \ + kadm5srv \ + kafs \ + krb5 \ + kvm \ + l \ + lber \ + ldap \ + ldap_r \ + lua \ + lwres \ + m \ + magic \ + menu \ + objc \ + ossaudio \ + pam \ + pcap \ + pci \ + pmc \ + posix \ + pthread \ + pthread_dbg \ + puffs \ + quota \ + radius \ + resolv \ + rmt \ + roken \ + rpcsvc \ + rt \ + rump \ + rumpfs_cd9660fs \ + rumpfs_efs \ + rumpfs_ext2fs \ + rumpfs_ffs \ + rumpfs_hfs \ + rumpfs_lfs \ + rumpfs_msdosfs \ + rumpfs_nfs \ + rumpfs_ntfs \ + rumpfs_syspuffs \ + rumpfs_tmpfs \ + rumpfs_udf \ + rumpfs_ufs \ + rumpuser \ + saslc \ + skey \ + sl \ + sqlite3 \ + ss \ + ssh \ + ssl \ + ssp \ + stdcxx \ + supcxx \ + terminfo \ + tre \ + usbhid \ + util \ + wind \ + wrap \ + y \ + z + +.ifndef LIB${_lib:tu} +LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib:S/xx/++/:S/atf_c/atf-c/}.a +.MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded +.endif +.endfor + +# Minix libraries +.for _lib in \ + audiodriver \ + bdev \ + blockdriver \ + chardriver \ + clkconf \ + ddekit \ + ddekit_usb_client \ + ddekit_usb_server \ + devman \ + elf \ + exec \ + fsdriver \ + gpio \ + hgfs \ + i2cdriver \ + inputdriver \ + lwip \ + minc \ + minixfs \ + mthread \ + netdriver \ + sffs \ + sockdriver \ + sockevent \ + sys \ + timers \ + usb \ + vboxfs \ + virtio \ + vtreefs +.ifndef LIB${_lib:tu} +LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib:S/xx/++/:S/atf_c/atf-c/}.a +.MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded +.endif +.endfor + +# PAM applications, if linked statically, need more libraries +.if (${MKPIC} == "no") +.if (${MKCRYPTO} != "no") +PAM_STATIC_LDADD+= -lssh +PAM_STATIC_DPADD+= ${LIBSSH} +.endif +.if (${MKKERBEROS} != "no") +PAM_STATIC_LDADD+= -lkafs -lkrb5 -lhx509 -lwind -lasn1 \ + -lroken -lcom_err -lheimbase -lcrypto +PAM_STATIC_DPADD+= ${LIBKAFS} ${LIBKRB5} ${LIBHX509} ${LIBWIND} ${LIBASN1} \ + ${LIBROKEN} ${LIBCOM_ERR} ${LIBHEIMBASE} ${LIBCRYPTO} +.endif +.if (${MKSKEY} != "no") +PAM_STATIC_LDADD+= -lskey +PAM_STATIC_DPADD+= ${LIBSKEY} +.endif +PAM_STATIC_LDADD+= -lradius -lcrypt -lrpcsvc -lutil +PAM_STATIC_DPADD+= ${LIBRADIUS} ${LIBCRYPT} ${LIBRPCSVC} ${LIBUTIL} +.else +PAM_STATIC_LDADD= +PAM_STATIC_DPADD= +.endif + +.if defined(__MINIX) && ${MACHINE_ARCH} == "earm" +# LSC: On ARM, when compiling statically, with gcc, lgcc_eh is required +LDFLAGS+= ${${ACTIVE_CC} == "gcc":? -lgcc_eh:} +.endif # defined(__MINIX) && ${MACHINE_ARCH} == "earm" + +# NB: If you are a library here, add it in bsd.README +.for _lib in \ + FS \ + GL \ + GLU \ + ICE \ + SM \ + X11 \ + XTrap \ + Xau \ + Xaw \ + Xdmcp \ + Xext \ + Xfont \ + Xft \ + Xi \ + Xinerama \ + Xmu \ + Xmuu \ + Xpm \ + Xrandr \ + Xrender \ + Xss \ + Xt \ + Xtst \ + Xv \ + Xxf86dga \ + Xxf86misc \ + Xxf86vm \ + dps \ + fntstubs \ + fontcache \ + fontconfig \ + fontenc \ + freetype \ + lbxutil \ + xkbfile +.ifndef LIB${_lib:tu} +LIB${_lib:tu}= ${DESTDIR}${X11USRLIBDIR}/lib${_lib}.a +.MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded +.endif +.endfor + +# Ugly one-offs +LIBX11_XCB= ${DESTDIR}${X11USRLIBDIR}/libX11-xcb.a +LIBXCB= ${DESTDIR}${X11USRLIBDIR}/libxcb.a + +.if defined(RESCUEDIR) +CPPFLAGS+= -DRESCUEDIR=\"${RESCUEDIR}\" +.endif + +_PROGLDOPTS= +.if ${SHLINKDIR} != "/usr/libexec" # XXX: change or remove if ld.so moves +_PROGLDOPTS+= -Wl,-dynamic-linker=${_SHLINKER} +.endif +.if ${SHLIBDIR} != "/usr/lib" +_PROGLDOPTS+= -Wl,-rpath,${SHLIBDIR} \ + -L=${SHLIBDIR} +.elif ${SHLIBINSTALLDIR} != "/usr/lib" +_PROGLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \ + -L=${SHLIBINSTALLDIR} +.endif + +__proginstall: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ + ${STRIPFLAG} ${.ALLSRC} ${.TARGET} + +__progrumpinstall: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${RUMPBINOWN} -g ${RUMPBINGRP} -m ${RUMPBINMODE} \ + ${STRIPFLAG} ${.ALLSRC} ${.TARGET} + +__progdebuginstall: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \ + ${.ALLSRC} ${.TARGET} + + + +# +# Backwards compatibility with Makefiles that assume that bsd.prog.mk +# can only build a single binary. +# + +_APPEND_MANS=yes +_APPEND_SRCS=yes + +_CCLINKFLAGS= + +.if defined(PROG_CXX) +PROG= ${PROG_CXX} +_CCLINK= ${CXX} ${_CCLINKFLAGS} + +.if defined(__MINIX) +# BJG - stack unwinding (for C++ exceptions) doesn't work on static executables when built with llvm. +LDSTATIC= -dynamic +.endif # defined(__MINIX) +.endif + +.if defined(RUMPPRG) +PROG= ${RUMPPRG} +. ifndef CRUNCHEDPROG +. if (${MKRUMP} != "no") +PROGS= ${RUMPPRG} rump.${RUMPPRG} +. else +PROGS= ${RUMPPRG} +. endif +. if defined(SRCS) +. if (${MKRUMP} != "no") +SRCS.rump.${PROG}:= ${SRCS} ${PROG}_rumpops.c ${RUMPSRCS} +. endif +SRCS+= ${PROG}_hostops.c +. else +SRCS= ${PROG}.c ${PROG}_hostops.c +. if (${MKRUMP} != "no") +SRCS.rump.${PROG}= ${PROG}.c ${PROG}_rumpops.c ${RUMPSRCS} +. endif +. endif +. if (${MKRUMP} != "no") +DPSRCS+= ${PROG}_rumpops.c ${RUMPSRCS} +LDADD.rump.${PROG}+= -lrumpclient +DPADD.rump.${PROG}+= ${LIBRUMPCLIENT} +MAN.rump.${PROG}= # defined but feeling empty +_RUMPINSTALL.rump.${PROG}=# defined +. endif +. else # CRUNCHEDPROG +PROGS= ${PROG} +CPPFLAGS+= -DCRUNCHOPS +. endif +.endif + +.if defined(PROG) +_CCLINK?= ${CC} ${_CCLINKFLAGS} +. if defined(MAN) +MAN.${PROG}= ${MAN} +_APPEND_MANS= no +. endif +. if !defined(OBJS) +OBJS= ${OBJS.${PROG}} +. endif +. if defined(PROGNAME) +PROGNAME.${PROG}= ${PROGNAME} +. endif +. if defined(SRCS) +SRCS.${PROG}= ${SRCS} +_APPEND_SRCS= no +. endif +.endif + +# Turn the single-program PROG and PROG_CXX variables into their multi-word +# counterparts, PROGS and PROGS_CXX. +.if !defined(RUMPPRG) +. if defined(PROG_CXX) && !defined(PROGS_CXX) +PROGS_CXX= ${PROG_CXX} +. elif defined(PROG) && !defined(PROGS) +PROGS= ${PROG} +. endif +.endif + +##### Libraries that this may depend upon. +.if defined(PROGDPLIBS) # { +.for _lib _dir in ${PROGDPLIBS} +.if !defined(BINDO.${_lib}) +PROGDO.${_lib}!= cd "${_dir}" && ${PRINTOBJDIR} +.MAKEOVERRIDES+=PROGDO.${_lib} +.endif +LDADD+= -L${PROGDO.${_lib}} -l${_lib} +.if exists(${PROGDO.${_lib}}/lib${_lib}_pic.a) +DPADD+= ${PROGDO.${_lib}}/lib${_lib}_pic.a +.elif exists(${PROGDO.${_lib}}/lib${_lib}.so) +DPADD+= ${PROGDO.${_lib}}/lib${_lib}.so +.else +DPADD+= ${PROGDO.${_lib}}/lib${_lib}.a +.endif +.endfor +.endif # } +# +# Per-program definitions and targets. +# + +_CCLINK.CDEFAULT= ${CC} ${_CCLINKFLAGS} +# Definitions specific to C programs. +.for _P in ${PROGS} +SRCS.${_P}?= ${_P}.c +_CCLINK.${_P}= ${CC} ${_CCLINKFLAGS} +_CFLAGS.${_P}= ${CFLAGS} ${CPUFLAGS} +_CPPFLAGS.${_P}= ${CPPFLAGS} +_COPTS.${_P}= ${COPTS} +.endfor + +_CCLINK.CXXDEFAULT= ${CXX} ${_CCLINKFLAGS} +# Definitions specific to C++ programs. +.for _P in ${PROGS_CXX} +SRCS.${_P}?= ${_P}.cc +_CCLINK.${_P}= ${CXX} ${_CCLINKFLAGS} +.endfor + +# Language-independent definitions. +.if defined(__MINIX) +.if ${USE_BITCODE:Uno} == "yes" +CFLAGS+= -flto +.endif # ${USE_BITCODE:Uno} == "yes" + +.if ${USE_BITCODE:Uyes} == "no" +#LSC Gold linker seems to require the library directory to be set up if +# a sysroot parameter has been given. +LDFLAGS+= -L ${DESTDIR}/usr/lib +.endif # ${USE_BITCODE:U} == "no" +.endif # defined(__MINIX) + +.for _P in ${PROGS} ${PROGS_CXX} # { + +BINDIR.${_P}?= ${BINDIR} +PROGNAME.${_P}?= ${_P} + +.if ${MKDEBUG} != "no" && !commands(${_P}) +_PROGDEBUG.${_P}:= ${PROGNAME.${_P}}.debug +.endif + +.if defined(PAXCTL_FLAGS) +PAXCTL_FLAGS.${_P}?= ${PAXCTL_FLAGS} +.endif + +##### PROG specific flags. + +_DPADD.${_P}= ${DPADD} ${DPADD.${_P}} +_LDADD.${_P}= ${LDADD} ${LDADD.${_P}} +_LDFLAGS.${_P}= ${LDFLAGS} ${LDFLAGS.${_P}} +_LDSTATIC.${_P}= ${LDSTATIC} ${LDSTATIC.${_P}} + +##### Build and install rules +.if !empty(_APPEND_SRCS:M[Yy][Ee][Ss]) +SRCS+= ${SRCS.${_P}} # For bsd.dep.mk +.endif + +_YPSRCS.${_P}= ${SRCS.${_P}:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS.${_P}:M*.y:.y=.h}} + +DPSRCS+= ${_YPSRCS.${_P}} +CLEANFILES+= ${_YPSRCS.${_P}} + +.if !empty(SRCS.${_P}:N*.h:N*.sh:N*.fth) +OBJS.${_P}+= ${SRCS.${_P}:N*.h:N*.sh:N*.fth:R:S/$/.o/g} +LOBJS.${_P}+= ${LSRCS:.c=.ln} ${SRCS.${_P}:M*.c:.c=.ln} +.endif + +.if defined(OBJS.${_P}) && !empty(OBJS.${_P}) # { +.NOPATH: ${OBJS.${_P}} ${_P} ${_YPSRCS.${_P}} + +.if (defined(USE_COMBINE) && ${USE_COMBINE} != "no" && !commands(${_P}) \ + && (${_CCLINK.${_P}} == ${_CCLINK.CDEFAULT} \ + || ${_CCLINK.${_P}} == ${_CCLINK.CXXDEFAULT}) \ + && !defined(NOCOMBINE.${_P}) && !defined(NOCOMBINE)) +.for f in ${SRCS.${_P}:N*.h:N*.sh:N*.fth:C/\.[yl]$/.c/g} +#_XFLAGS.$f := ${CPPFLAGS.$f:D1} ${CPUFLAGS.$f:D2} \ +# ${COPTS.$f:D3} ${OBJCOPTS.$f:D4} ${CXXFLAGS.$f:D5} +.if (${CPPFLAGS.$f:D1} == "1" || ${CPUFLAGS.$f:D2} == "2" \ + || ${COPTS.$f:D3} == "3" || ${OBJCOPTS.$f:D4} == "4" \ + || ${CXXFLAGS.$f:D5} == "5") \ + || ("${f:M*.[cyl]}" == "" || commands(${f:R:S/$/.o/})) +XOBJS.${_P}+= ${f:R:S/$/.o/} +.else +XSRCS.${_P}+= ${f} +NODPSRCS+= ${f} +.endif +.endfor + +${_P}: .gdbinit ${LIBCRT0} ${LIBCRTI} ${XOBJS.${_P}} ${SRCS.${_P}} \ + ${DPSRCS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${_DPADD.${_P}} + ${_MKTARGET_LINK} +.if defined(DESTDIR) + ${_CCLINK.${_P}} -Wl,-nostdlib \ + ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} ${_PROGLDOPTS} \ + -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/ \ + -MD --combine ${_CPPFLAGS.${_P}} ${_CFLAGS.${_P}} ${_COPTS.${_P}} \ + ${XSRCS.${_P}:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} ${XOBJS.${_P}} \ + ${_LDADD.${_P}} -L${_GCC_LIBGCCDIR} -L${DESTDIR}/usr/lib +.else + ${_CCLINK.${_P}} ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} ${_PROGLDOPTS} \ + -MD --combine ${_CPPFLAGS.${_P}} ${_COPTS.${_P}} + ${XSRCS.${_P}:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} ${XOBJS.${_P}} \ + ${_LDADD.${_P}} +.endif # defined(DESTDIR) +.if defined(CTFMERGE) + ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}} +.endif +.if defined(PAXCTL_FLAGS.${_P}) + ${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET} +.endif +.if ${MKSTRIPIDENT} != "no" + ${OBJCOPY} -R .ident ${.TARGET} +.endif + +CLEANFILES+= ${_P}.d +.if exists(${_P}.d) +.include "${_P}.d" # include -MD depend for program. +.endif +.else # USE_COMBINE + +${OBJS.${_P}} ${LOBJS.${_P}}: ${DPSRCS} + +.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" +CLEANFILES+= ${_P}.opt.bcl ${_P}.bcl ${_P}.bcl.o + +OPTFLAGS.${_P}?= ${OPTFLAGS} +BITCODE_LD_FLAGS_1ST.${_P}+= ${BITCODE_LD_FLAGS_1ST} +BITCODE_LD_FLAGS_2ND.${_P}+= ${BITCODE_LD_FLAGS_2ND} + +${_P}.bcl: .gdbinit ${LIBCRT0} ${LIBCRTI} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} \ + ${LIBCRTEND} ${_DPADD.${_P}} + ${_MKTARGET_LINK} + ${_CCLINK.${_P}} \ + -o ${.TARGET} \ + -nostartfiles \ + -L${DESTDIR}/usr/lib/bc \ + ${OBJS.${_P}} ${LLVM_LINK_ARGS} ${_LDADD.${_P}:N-shared} \ + ${_LDSTATIC.${_P}} ${_PROGLDOPTS} \ + -Wl,-r \ + ${BITCODE_LD_FLAGS_1ST.${_P}} \ + -Wl,-plugin-opt=emit-llvm + +${_P}.opt.bcl: ${_P}.bcl ${LLVM_PASS} + ${_MKTARGET_LINK} + ${OPT} ${OPTFLAGS.${_P}} -o ${.TARGET} ${_P}.bcl + +${_P}.bcl.o: ${_P}.opt.bcl + ${_MKTARGET_LINK} + ${LLC} -O1 -march=x86 -mcpu=i586 -filetype=obj -o ${.TARGET} ${.ALLSRC} + +${_P}: ${_P}.bcl.o +.if !commands(${_P}) + ${_MKTARGET_LINK} + ${_CCLINK.${_P}} \ + ${_LDFLAGS.${_P}} \ + -L${DESTDIR}/usr/lib \ + ${_LDSTATIC.${_P}} -o ${.TARGET} \ + ${.TARGET}.bcl.o ${_PROGLDOPTS} ${_LDADD.${_P}} \ + ${BITCODE_LD_FLAGS_2ND.${_P}} \ + -Wl,--allow-multiple-definition +.endif # !commands(${_P}) + +.else +${_P}: .gdbinit ${LIBCRT0} ${LIBCRTI} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} \ + ${LIBCRTEND} ${_DPADD.${_P}} +.if !commands(${_P}) + ${_MKTARGET_LINK} + ${_CCLINK.${_P}} \ + ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} \ + ${OBJS.${_P}} ${_PROGLDOPTS} ${_LDADD.${_P}} +.if defined(CTFMERGE) + ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}} +.endif +.if defined(PAXCTL_FLAGS.${_P}) + ${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET} +.endif +.if ${MKSTRIPIDENT} != "no" + ${OBJCOPY} -R .ident ${.TARGET} +.endif +.endif # !commands(${_P}) +.endif # defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" +.endif # USE_COMBINE + +${_P}.ro: ${OBJS.${_P}} ${_DPADD.${_P}} + ${_MKTARGET_LINK} + ${CC} ${LDFLAGS:N-Wl,-pie} -nostdlib -r -Wl,-dc -o ${.TARGET} ${OBJS.${_P}} + +.if defined(_PROGDEBUG.${_P}) +${_PROGDEBUG.${_P}}: ${_P} + ${_MKTARGET_CREATE} + ( ${OBJCOPY} --only-keep-debug ${_P} ${_PROGDEBUG.${_P}} \ + && ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \ + --add-gnu-debuglink=${_PROGDEBUG.${_P}} ${_P} \ + ) || (rm -f ${_PROGDEBUG.${_P}}; false) +.endif + +.endif # defined(OBJS.${_P}) && !empty(OBJS.${_P}) # } + +.if !defined(MAN.${_P}) +MAN.${_P}= ${_P}.1 +.endif # !defined(MAN.${_P}) +.if !empty(_APPEND_MANS:M[Yy][Ee][Ss]) +MAN+= ${MAN.${_P}} +.endif + +realall: ${_P} ${_PROGDEBUG.${_P}} + +CLEANFILES+= ${_P} ${_PROGDEBUG.${_P}} + +.if defined(OBJS.${_P}) && !empty(OBJS.${_P}) +CLEANFILES+= ${OBJS.${_P}} ${LOBJS.${_P}} +.endif + +_PROG_INSTALL+= proginstall-${_P} + +.if !target(proginstall-${_P}) # { +proginstall-${_P}:: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \ + ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}} +.PRECIOUS: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \ + ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}} + +.if ${MKUPDATE} == "no" +.if defined(_RUMPINSTALL.${_P}) +${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __progrumpinstall +.else +${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __proginstall +.endif +.if !defined(BUILD) && !make(all) && !make(${_P}) +${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! .MADE +.endif +.if defined(_PROGDEBUG.${_P}) +${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! ${_PROGDEBUG.${_P}} __progdebuginstall +.if !defined(BUILD) && !make(all) && !make(${_P}) +${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! .MADE +.endif +.endif # define(_PROGDEBUG.${_P}) +.else # MKUPDATE != no +.if defined(_RUMPINSTALL.${_P}) +${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __progrumpinstall +.else +${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __proginstall +.endif +.if !defined(BUILD) && !make(all) && !make(${_P}) +${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: .MADE +.endif +.if defined(_PROGDEBUG.${_P}) +${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: ${_PROGDEBUG.${_P}} __progdebuginstall +.if !defined(BUILD) && !make(all) && !make(${_P}) +${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: .MADE +.endif +.endif # defined(_PROGDEBUG.${_P}) +.endif # MKUPDATE != no + +.endif # !target(proginstall-${_P}) # } + +lint: lint-${_P} +lint-${_P}: ${LOBJS.${_P}} +.if defined(LOBJS.${_P}) && !empty(LOBJS.${_P}) + ${LINT} ${LINTFLAGS} ${_LDFLAGS.${_P}:C/-L[ ]*/-L/Wg:M-L*} ${LOBJS.${_P}} ${_LDADD.${_P}} +.endif + +.endfor # _P in ${PROGS} ${PROGS_CXX} # } + +.if defined(OBJS) && !empty(OBJS) && \ + (empty(PROGS) && empty(PROGS_CXX)) +CLEANFILES+= ${OBJS} ${LOBJS} +.endif + +.if !target(proginstall) +proginstall:: ${_PROG_INSTALL} +.endif +.PHONY: proginstall + + + +realall: ${SCRIPTS} +.if defined(SCRIPTS) && !target(scriptsinstall) # { +SCRIPTSDIR?=${BINDIR} +SCRIPTSOWN?=${BINOWN} +SCRIPTSGRP?=${BINGRP} +SCRIPTSMODE?=${BINMODE} + +scriptsinstall:: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@} +.PRECIOUS: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@} + +__scriptinstall: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} \ + -o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \ + -g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \ + -m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \ + ${.ALLSRC} ${.TARGET} + +.for S in ${SCRIPTS:O:u} +.if ${MKUPDATE} == "no" +${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! ${S} __scriptinstall +.if !defined(BUILD) && !make(all) && !make(${S}) +${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! .MADE +.endif +.else +${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: ${S} __scriptinstall +.if !defined(BUILD) && !make(all) && !make(${S}) +${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: .MADE +.endif +.endif +.endfor +.endif # } + +.if !target(scriptsinstall) +scriptsinstall:: +.endif +.PHONY: scriptsinstall + +##### Pull in related .mk logic +LINKSOWN?= ${BINOWN} +LINKSGRP?= ${BINGRP} +LINKSMODE?= ${BINMODE} +.include +.include +.include +.include +.include +.include +.include +.include +.include + +${TARGETS}: # ensure existence + +.endif # HOSTPROG diff --git a/src/share/mk/bsd.rpc.mk b/src/share/mk/bsd.rpc.mk new file mode 100644 index 0000000..39d8c41 --- /dev/null +++ b/src/share/mk/bsd.rpc.mk @@ -0,0 +1,76 @@ +# $NetBSD: bsd.rpc.mk,v 1.13 2013/12/15 00:28:45 christos Exp $ + +.include + +RPC_XDIR?= ${.CURDIR}/ +RPCGEN_FLAGS?= -B + +# We don't use implicit suffix rules here to avoid dependencies in the +# Installed files. + +.if defined(RPC_INCS) # { + +.for I in ${RPC_INCS} +${I}: ${I:.h=.x} + ${_MKTARGET_CREATE} + ${TOOL_RPCGEN} ${RPCGEN_FLAGS} -h ${RPC_XDIR}${I:.h=.x} -o ${.TARGET} +.endfor + +DPSRCS+= ${RPC_INCS} +CLEANFILES+= ${RPC_INCS} + +.endif # } + + +.if defined(RPC_XDRFILES) # { + +.for I in ${RPC_XDRFILES} +${I}: ${RPC_XDIR}${I:_xdr.c=.x} + ${_MKTARGET_CREATE} + ${TOOL_RPCGEN} ${RPCGEN_FLAGS} -c ${RPC_XDIR}${I:_xdr.c=.x} -o ${.TARGET} +.endfor + +DPSRCS+= ${RPC_XDRFILES} +CLEANFILES+= ${RPC_XDRFILES} + +.endif # } + + +.if defined(RPC_SVCFILES) # { + +.for I in ${RPC_SVCCLASS} +_RPCS += -s ${I} +.endfor + +.for I in ${RPC_SVCFILES} + +${I}: ${RPC_XDIR}${I:_svc.c=.x} + ${_MKTARGET_CREATE} + ${TOOL_RPCGEN} ${RPCGEN_FLAGS} ${_RPCS} ${RPC_SVCFLAGS} ${RPC_XDIR}${I:_svc.c=.x} \ + -o ${.TARGET} +.endfor + +DPSRCS+= ${RPC_SVCFILES} +CLEANFILES+= ${RPC_SVCFILES} + +.endif # } + +.if defined(RPC_CLNTFILES) # { + +.for I in ${RPC_CLNTFILES} + +${I}: ${RPC_XDIR}${I:_clnt.c=.x} + ${_MKTARGET_CREATE} + ${TOOL_RPCGEN} ${RPCGEN_FLAGS} -l ${_RPCS} ${RPC_CLNTFLAGS} \ + ${RPC_XDIR}${I:_clnt.c=.x} -o ${.TARGET} +.endfor + +DPSRCS+= ${RPC_CLNTFILES} +CLEANFILES+= ${RPC_CLNTFILES} + +.endif # } + +##### Pull in related .mk logic +.include +.include +.include diff --git a/src/share/mk/bsd.shlib.mk b/src/share/mk/bsd.shlib.mk new file mode 100644 index 0000000..bb058c2 --- /dev/null +++ b/src/share/mk/bsd.shlib.mk @@ -0,0 +1,40 @@ +# $NetBSD: bsd.shlib.mk,v 1.8 2012/08/23 21:21:17 joerg Exp $ + +.if !defined(_BSD_SHLIB_MK_) +_BSD_SHLIB_MK_=1 + +.if ${MKDYNAMICROOT} == "no" +SHLIBINSTALLDIR?= /usr/lib +.else +SHLIBINSTALLDIR?= /lib +.endif + +.if ${MKDYNAMICROOT} == "no" || \ + (${BINDIR:Ux} != "/bin" && ${BINDIR:Ux} != "/sbin" && \ + ${BINDIR:Ux} != "/libexec" && ${USE_SHLIBDIR:Uno} == "no") +SHLIBDIR?= /usr/lib +.else +SHLIBDIR?= /lib +.endif + +.if ${USE_SHLIBDIR:Uno} != "no" +_LIBSODIR?= ${SHLIBINSTALLDIR} +.else +_LIBSODIR?= ${LIBDIR} +.endif + +.if ${MKDYNAMICROOT} == "no" +SHLINKINSTALLDIR?= /usr/libexec +.else +SHLINKINSTALLDIR?= /libexec +.endif + +.if ${MKDYNAMICROOT} == "no" || \ + (${BINDIR:Ux} != "/bin" && ${BINDIR:Ux} != "/sbin" && \ + ${BINDIR:Ux} != "/libexec") +SHLINKDIR?= /usr/libexec +.else +SHLINKDIR?= /libexec +.endif + +.endif # !defined(_BSD_SHLIB_MK_) diff --git a/src/share/mk/bsd.subdir.mk b/src/share/mk/bsd.subdir.mk new file mode 100644 index 0000000..0692f40 --- /dev/null +++ b/src/share/mk/bsd.subdir.mk @@ -0,0 +1,59 @@ +# $NetBSD: bsd.subdir.mk,v 1.52 2010/05/26 00:48:15 uwe Exp $ +# @(#)bsd.subdir.mk 8.1 (Berkeley) 6/8/93 + +.include + +.if !defined(NOSUBDIR) # { + +.for dir in ${SUBDIR} +.if "${dir}" == ".WAIT" +# Don't play with .WAIT +__REALSUBDIR+=${dir} +.else +.if "${dir:H}" != "" +# It is a relative path; make it absolute so exists can't search the path. +.if exists(${.CURDIR}/${dir}.${MACHINE}) +__REALSUBDIR+=${dir}.${MACHINE} +.else +__REALSUBDIR+=${dir} +.endif +.else +# It is an absolute path; leave it alone +.if exists(${dir}.${MACHINE}) +__REALSUBDIR+=${dir}.${MACHINE} +.else +__REALSUBDIR+=${dir} +.endif +.endif +.endif +.endfor + +__recurse: .USE + @${MAKEDIRTARGET} ${.TARGET:C/^[^-]*-//} ${.TARGET:C/-.*$//} + +.if make(cleandir) +__RECURSETARG= ${TARGETS:Nclean} +clean: +.else +__RECURSETARG= ${TARGETS} +.endif + +# for obscure reasons, we can't do a simple .if ${dir} == ".WAIT" +# but have to assign to __TARGDIR first. +.for targ in ${__RECURSETARG} +.for dir in ${__REALSUBDIR} +__TARGDIR := ${dir} +.if ${__TARGDIR} == ".WAIT" +SUBDIR_${targ} += .WAIT +.elif !commands(${targ}-${dir}) +${targ}-${dir}: .PHONY .MAKE __recurse +SUBDIR_${targ} += ${targ}-${dir} +.endif +.endfor +subdir-${targ}: .PHONY ${SUBDIR_${targ}} +${targ}: subdir-${targ} +.endfor + +.endif # ! NOSUBDIR # } + +${TARGETS}: # ensure existence diff --git a/src/share/mk/bsd.sys.mk b/src/share/mk/bsd.sys.mk new file mode 100644 index 0000000..322fc2d --- /dev/null +++ b/src/share/mk/bsd.sys.mk @@ -0,0 +1,289 @@ +# $NetBSD: bsd.sys.mk,v 1.245 2014/09/03 19:22:53 matt Exp $ +# +# Build definitions used for NetBSD source tree builds. + +.if !defined(_BSD_SYS_MK_) +_BSD_SYS_MK_=1 + +.if !empty(.INCLUDEDFROMFILE:MMakefile*) +error1: + @(echo "bsd.sys.mk should not be included from Makefiles" >& 2; exit 1) +.endif +.if !defined(_BSD_OWN_MK_) +error2: + @(echo "bsd.own.mk must be included before bsd.sys.mk" >& 2; exit 1) +.endif + +.if defined(__MINIX) +#LSC: Be a bit smarter about the default compiler +.if exists(/usr/pkg/bin/clang) || exists(/usr/bin/clang) +CC?= clang +.endif + +.if exists(/usr/pkg/bin/gcc) || exists(/usr/bin/gcc) +CC?= gcc +.endif + +MKDEP?= CC=${CC:Q} mkdep +MKDEPCXX?= CC=${CXX:Q} mkdep +.endif # defined(__MINIX) + +.if ${MKREPRO:Uno} == "yes" +CPPFLAGS+= -Wp,-iremap,${NETBSDSRCDIR}:/usr/src +CPPFLAGS+= -Wp,-iremap,${DESTDIR}/:/ +CPPFLAGS+= -Wp,-iremap,${X11SRCDIR}:/usr/xsrc +.endif + +# NetBSD sources use C99 style, with some GCC extensions. +CFLAGS+= ${${ACTIVE_CC} == "clang":? -std=gnu99 :} +CFLAGS+= ${${ACTIVE_CC} == "gcc":? -std=gnu99 :} +CFLAGS+= ${${ACTIVE_CC} == "pcc":? -std=gnu99 :} + +.if defined(WARNS) +CFLAGS+= ${${ACTIVE_CC} == "clang":? -Wno-sign-compare -Wno-pointer-sign :} +.if ${WARNS} > 0 +CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith +#CFLAGS+= -Wmissing-declarations -Wredundant-decls -Wnested-externs +# Add -Wno-sign-compare. -Wsign-compare is included in -Wall as of GCC 3.3, +# but our sources aren't up for it yet. Also, add -Wno-traditional because +# gcc includes #elif in the warnings, which is 'this code will not compile +# in a traditional environment' warning, as opposed to 'this code behaves +# differently in traditional and ansi environments' which is the warning +# we wanted, and now we don't get anymore. +CFLAGS+= -Wno-sign-compare +CFLAGS+= ${${ACTIVE_CC} == "gcc" :? -Wno-traditional :} +.if !defined(NOGCCERROR) && !defined(USE_BITCODE) +# Set assembler warnings to be fatal +CFLAGS+= -Wa,--fatal-warnings +.endif +# Set linker warnings to be fatal +# XXX no proper way to avoid "FOO is a patented algorithm" warnings +# XXX on linking static libs +.if (!defined(MKPIC) || ${MKPIC} != "no") && \ + (!defined(LDSTATIC) || ${LDSTATIC} != "-static") +# XXX there are some strange problems not yet resolved +. if defined(HAVE_LLVM) && !defined(USE_BITCODE) +LDFLAGS+= -Wl,--fatal-warnings +. endif +.endif +.endif +.if ${WARNS} > 1 +CFLAGS+= -Wreturn-type -Wswitch -Wshadow +.endif +.if ${WARNS} > 2 +CFLAGS+= -Wcast-qual -Wwrite-strings +CFLAGS+= -Wextra -Wno-unused-parameter +# Readd -Wno-sign-compare to override -Wextra with clang +CFLAGS+= -Wno-sign-compare +CXXFLAGS+= -Wabi +CXXFLAGS+= -Wold-style-cast +CXXFLAGS+= -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder \ + -Wno-deprecated -Woverloaded-virtual -Wsign-promo -Wsynth +CXXFLAGS+= ${${ACTIVE_CXX} == "gcc":? -Wno-non-template-friend -Wno-pmf-conversions :} +.endif +.if ${WARNS} > 3 && (defined(HAVE_GCC) || defined(HAVE_LLVM)) +.if ${WARNS} > 4 +CFLAGS+= -Wold-style-definition +.endif +.if ${WARNS} > 5 && !(defined(HAVE_GCC) && ${HAVE_GCC} <= 45) +CFLAGS+= -Wconversion +.endif +CFLAGS+= -Wsign-compare -Wformat=2 +CFLAGS+= ${${ACTIVE_CC} == "gcc":? -Wno-format-zero-length :} +.endif +.if ${WARNS} > 3 && defined(HAVE_LLVM) +CFLAGS+= ${${ACTIVE_CC} == "clang":? -Wpointer-sign -Wmissing-noreturn :} +.endif +.if (defined(HAVE_GCC) \ + && (${MACHINE_ARCH} == "coldfire" || \ + ${MACHINE_ARCH} == "sh3eb" || \ + ${MACHINE_ARCH} == "sh3el" || \ + ${MACHINE_ARCH} == "m68k" || \ + ${MACHINE_ARCH} == "m68000")) +# XXX GCC 4.5 for sh3 and m68k (which we compile with -Os) is extra noisy for +# cases it should be better with +CFLAGS+= -Wno-uninitialized +.if ${HAVE_GCC} >= 48 +CFLAGS+= -Wno-maybe-uninitialized +.endif +.endif +.endif + +CWARNFLAGS+= ${CWARNFLAGS.${ACTIVE_CC}} + +CPPFLAGS+= ${AUDIT:D-D__AUDIT__} +_NOWERROR= ${defined(NOGCCERROR) || (${ACTIVE_CC} == "clang" && defined(NOCLANGERROR)):?yes:no} +.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" +_NOWERROR= yes +.endif # defined(__MINIX) && ${USE_BITCODE} == "yes" +CFLAGS+= ${${_NOWERROR} == "no" :?-Werror:} ${CWARNFLAGS} +LINTFLAGS+= ${DESTDIR:D-d ${DESTDIR}/usr/include} + +.if (${USE_SSP:Uno} != "no") && (${BINDIR:Ux} != "/usr/mdec") +.if !defined(KERNSRCDIR) && !defined(KERN) # not for kernels nor kern modules +CPPFLAGS+= -D_FORTIFY_SOURCE=2 +.endif +COPTS+= -fstack-protector -Wstack-protector + +# gcc 4.8 on m68k erroneously does not protect functions with +# variables needing special alignement, see +# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59674 +# (the underlying issue for sh and vax may be different, needs more +# investigation, symptoms are similar but for different sources) +.if "${ACTIVE_CC}" == "gcc" && "${HAVE_GCC}" == "48" && \ + ( ${MACHINE_CPU} == "sh3" || \ + ${MACHINE_ARCH} == "vax" || \ + ${MACHINE_CPU} == "m68k" || \ + ${MACHINE_CPU} == "or1k" ) +COPTS+= -Wno-error=stack-protector +.endif + +COPTS+= ${${ACTIVE_CC} == "clang":? --param ssp-buffer-size=1 :} +COPTS+= ${${ACTIVE_CC} == "gcc":? --param ssp-buffer-size=1 :} +.endif + +.if ${MKSOFTFLOAT:Uno} != "no" +COPTS+= ${${ACTIVE_CC} == "gcc":? -msoft-float :} +FOPTS+= -msoft-float +.elif ${MACHINE_ARCH} == "coldfire" +COPTS+= -mhard-float +FOPTS+= -mhard-float +.endif + +.if ${MKIEEEFP:Uno} != "no" +.if ${MACHINE_ARCH} == "alpha" +CFLAGS+= -mieee +FFLAGS+= -mieee +.endif +.endif + +.if ${MACHINE} == "sparc64" && ${MACHINE_ARCH} == "sparc" +CFLAGS+= -Wa,-Av8plus +.endif + +.if !defined(NOGCCERROR) +.if (${MACHINE_ARCH} == "mips64el") || (${MACHINE_ARCH} == "mips64eb") +CPUFLAGS+= -Wa,--fatal-warnings +.endif +.endif + +#.if ${MACHINE} == "sbmips" +#CFLAGS+= -mips64 -mtune=sb1 +#.endif + +#.if (${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb") && \ +# (defined(MKPIC) && ${MKPIC} == "no") +#CPUFLAGS+= -mno-abicalls -fno-PIC +#.endif +CFLAGS+= ${CPUFLAGS} +AFLAGS+= ${CPUFLAGS} + +.if !defined(LDSTATIC) || ${LDSTATIC} != "-static" +# Position Independent Executable flags +PIE_CFLAGS?= -fPIC +PIE_LDFLAGS?= -Wl,-pie ${${ACTIVE_CC} == "gcc":? -shared-libgcc :} +PIE_AFLAGS?= -fPIC +.endif + +ELF2ECOFF?= elf2ecoff +MKDEP?= mkdep +MKDEPCXX?= mkdep +OBJCOPY?= objcopy +OBJDUMP?= objdump +PAXCTL?= paxctl +STRIP?= strip + +.SUFFIXES: .o .ln .lo .c .cc .cpp .cxx .C .m ${YHEADER:D.h} + +# C +.c.o: + ${_MKTARGET_COMPILE} + ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif + +.c.ln: + ${_MKTARGET_COMPILE} + ${LINT} ${LINTFLAGS} ${LINTFLAGS.${.IMPSRC:T}} \ + ${CPPFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ + ${CPPFLAGS.${.IMPSRC:T}:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ + -i ${.IMPSRC} + +# C++ +.cc.o .cpp.o .cxx.o .C.o: + ${_MKTARGET_COMPILE} + ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} + +# Objective C +# (Defined here rather than in because `.m' is not just +# used for Objective C source) +.m.o: + ${_MKTARGET_COMPILE} + ${COMPILE.m} ${OBJCOPTS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif + +# Host-compiled C objects +# The intermediate step is necessary for Sun CC, which objects to calling +# object files anything but *.o +.c.lo: + ${_MKTARGET_COMPILE} + ${HOST_COMPILE.c} -o ${.TARGET}.o ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} + mv ${.TARGET}.o ${.TARGET} + +# C++ +.cc.lo .cpp.lo .cxx.lo .C.lo: + ${_MKTARGET_COMPILE} + ${HOST_COMPILE.cc} -o ${.TARGET}.o ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} + mv ${.TARGET}.o ${.TARGET} + +# Assembly +.s.o: + ${_MKTARGET_COMPILE} + ${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif + +.S.o: + ${_MKTARGET_COMPILE} + ${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif + +# Lex +LFLAGS+= ${LPREFIX.${.IMPSRC:T}:D-P${LPREFIX.${.IMPSRC:T}}} +LFLAGS+= ${LPREFIX:D-P${LPREFIX}} + +.l.c: + ${_MKTARGET_LEX} + ${LEX.l} -o${.TARGET} ${.IMPSRC} + +# Yacc +YFLAGS+= ${YPREFIX.${.IMPSRC:T}:D-p${YPREFIX.${.IMPSRC:T}}} ${YHEADER.${.IMPSRC:T}:D-d} +YFLAGS+= ${YPREFIX:D-p${YPREFIX}} ${YHEADER:D-d} + +.y.c: + ${_MKTARGET_YACC} + ${YACC.y} -o ${.TARGET} ${.IMPSRC} + +.ifdef YHEADER +.if empty(.MAKEFLAGS:M-n) +.y.h: ${.TARGET:.h=.c} +.endif +.endif + +# Objcopy +.if ${MACHINE_ARCH} == aarch64eb +# AARCH64 big endian needs to preserve $x/$d symbols for the linker. +OBJCOPYLIBFLAGS_EXTRA=-w -K '[$$][dx]' -K '[$$][dx]\.*' +.elif !empty(MACHINE_ARCH:M*arm*eb) +# ARM big endian needs to preserve $a/$d/$t symbols for the linker. +OBJCOPYLIBFLAGS_EXTRA=-w -K '[$$][adt]' -K '[$$][adt]\.*' +.endif +OBJCOPYLIBFLAGS?=${"${.TARGET:M*.po}" != "":?-X:-x} ${OBJCOPYLIBFLAGS_EXTRA} + +.endif # !defined(_BSD_SYS_MK_) diff --git a/src/share/mk/bsd.syscall.mk b/src/share/mk/bsd.syscall.mk new file mode 100644 index 0000000..6a3e160 --- /dev/null +++ b/src/share/mk/bsd.syscall.mk @@ -0,0 +1,16 @@ +# $NetBSD: bsd.syscall.mk,v 1.2 2014/01/16 01:19:46 christos Exp $ +# +.include + +SYSCALL_OBJS?= ${SYSCALL_PREFIX}_sysent.c ${SYSCALL_PREFIX}_syscalls.c \ + ${SYSCALL_PREFIX}_syscall.h ${SYSCALL_PREFIX}_syscallargs.h + +SYSCALL_DEPS?= ${NETBSDSRCDIR}/sys/kern/makesyscalls.sh \ + syscalls.conf syscalls.master + +all: ${SYSCALL_OBJS} + +${SYSCALL_OBJS}: ${SYSCALL_DEPS} + ${HOST_SH} ${.ALLSRC} + +.include diff --git a/src/share/mk/bsd.test.mk b/src/share/mk/bsd.test.mk new file mode 100644 index 0000000..7f9954d --- /dev/null +++ b/src/share/mk/bsd.test.mk @@ -0,0 +1,207 @@ +# $NetBSD: bsd.test.mk,v 1.24 2013/02/23 22:01:51 jmmv Exp $ +# + +.include + +_TESTS:= # empty + +.if defined(TESTS_SUBDIRS) +SUBDIR+= ${TESTS_SUBDIRS} +.endif + +.include + +.if defined(TESTS_C) +_TESTS+= ${TESTS_C} +PROGS+= ${TESTS_C} +. for _T in ${TESTS_C} +BINDIR.${_T}= ${TESTSDIR} +LDADD.${_T}+= -latf-c +DPADD.${_T}+= ${LIBATF_C} +MAN.${_T}?= # empty +. endfor +.endif + +.if defined(TESTS_CXX) +_TESTS+= ${TESTS_CXX} +PROGS_CXX+= ${TESTS_CXX} +. for _T in ${TESTS_CXX} +BINDIR.${_T}= ${TESTSDIR} +LDADD.${_T}+= -latf-c++ -latf-c +DPADD.${_T}+= ${LIBATF_CXX} ${LIBATF_C} +MAN.${_T}?= # empty +. endfor +.endif + +.if defined(TESTS_SH) +_TESTS+= ${TESTS_SH} +CLEANDIRFILES+= ${TESTS_SH} + +. for _T in ${TESTS_SH} +SCRIPTS+= ${_T} +SCRIPTSDIR_${_T}= ${TESTSDIR} + +CLEANDIRFILES+= ${_T}.tmp + +TESTS_SH_SRC_${_T}?= ${_T}.sh +${_T}: ${TESTS_SH_SRC_${_T}} + ${_MKTARGET_BUILD} + echo '#! /usr/bin/atf-sh' >${.TARGET}.tmp + cat ${.ALLSRC} >>${.TARGET}.tmp + chmod +x ${.TARGET}.tmp + mv ${.TARGET}.tmp ${.TARGET} +. endfor +.endif + +ATFFILE?= auto +.if ${MKKYUA} != "no" +KYUAFILE?= ${ATFFILE} +.else +KYUAFILE= no +.endif + +# Additional list of 'tp' entries to add to the Atffile when ATFFILE=auto. +# These entries must all correspond to subdirectories to descend into. +# +# This is useful in the cases where the tests in a single directory come +# from various sources (e.g. src/tests and src/external/.../tests) and +# the installation of some of those tests rely on MK* variables being set. +ATFFILE_EXTRA_SUBDIRS?= + +.if ${ATFFILE:tl} != "no" +FILES+= Atffile +FILESDIR_Atffile= ${TESTSDIR} + +. if ${ATFFILE:tl} == "auto" +CLEANDIRFILES+= Atffile Atffile.tmp + +realall: Atffile +Atffile: Makefile + ${_MKTARGET_CREATE} + @{ echo 'Content-Type: application/X-atf-atffile; version="1"'; \ + echo; \ + echo '# Automatically generated by bsd.test.mk.'; \ + echo; \ + echo 'prop: test-suite = "NetBSD"'; \ + echo; \ + for tp in ${TESTS_SUBDIRS:N.WAIT} ${_TESTS} ${ATFFILE_EXTRA_SUBDIRS}; \ + do \ + echo "tp: $${tp}"; \ + done; } >Atffile.tmp + @mv Atffile.tmp Atffile +. endif +.endif + +.if ${KYUAFILE:tl} != "no" +FILES+= Kyuafile +FILESDIR_Kyuafile= ${TESTSDIR} + +. if ${KYUAFILE:tl} == "auto" +CLEANDIRFILES+= Kyuafile Kyuafile.tmp + +realall: Kyuafile +Kyuafile: Makefile + ${_MKTARGET_CREATE} + @{ \ + echo '-- Automatically generated by bsd.test.mk.'; \ + echo; \ + echo 'syntax(2)'; \ + echo; \ + echo 'test_suite("NetBSD")'; \ + if [ -n "${_TESTS}" ]; then \ + echo; \ + for tp in ${_TESTS}; do \ + echo "atf_test_program{name=\"$${tp}\"}"; \ + done; \ + fi; \ + if [ -n "${TESTS_SUBDIRS:N.WAIT}" -o \ + -n "${ATFFILE_EXTRA_SUBDIRS}" ]; then \ + echo; \ + for subdir in ${TESTS_SUBDIRS:N.WAIT} \ + ${ATFFILE_EXTRA_SUBDIRS}; do \ + echo "include(\"$${subdir}/Kyuafile\")"; \ + done; \ + fi; \ + } >Kyuafile.tmp + @mv Kyuafile.tmp Kyuafile +. endif +.endif + +.if ${ATFFILE:tl} != "no" || ${KYUAFILE:tl} != "no" +. include +.endif + +.if !empty(SCRIPTS) || !empty(PROGS) || !empty(PROGS_CXX) +. include +.endif + +# +# Definition of the "make test" target and supporting variables. +# +# This target, by necessity, can only work for native builds (i.e. a NetBSD +# host building a release for the same system). The target runs ATF, which is +# not in the toolchain, and the tests execute code built for the target host. +# +# Due to the dependencies of the binaries built by the source tree and how they +# are used by tests, it is highly possible for a execution of "make test" to +# report bogus results unless the new binaries are put in place. +# + +TESTS_PATH += ${DESTDIR}/bin ${DESTDIR}/sbin ${DESTDIR}/usr/bin ${DESTDIR}/usr/sbin +TESTS_LD_LIBRARY_PATH += ${DESTDIR}/lib ${DESTDIR}/usr/lib + +TESTS_ENV += ATF_BUILD_CC=${DESTDIR}/usr/bin/cc +TESTS_ENV += ATF_BUILD_CPP=${DESTDIR}/usr/bin/cpp +TESTS_ENV += ATF_BUILD_CXX=${DESTDIR}/usr/bin/c++ +TESTS_ENV += ATF_CONFDIR=${DESTDIR}/etc +TESTS_ENV += ATF_INCLUDEDIR=${DESTDIR}/usr/include +TESTS_ENV += ATF_LIBDIR=${DESTDIR}/usr/lib +TESTS_ENV += ATF_LIBEXECDIR=${DESTDIR}/usr/libexec +TESTS_ENV += ATF_PKGDATADIR=${DESTDIR}/usr/share/atf +TESTS_ENV += ATF_SHELL=${DESTDIR}/bin/sh +TESTS_ENV += LD_LIBRARY_PATH=${TESTS_LD_LIBRARY_PATH:tW:S/ /:/g} +TESTS_ENV += PATH=${TESTS_PATH:tW:S/ /:/g} + +_TESTS_FIFO = ${.OBJDIR}/atf-run.fifo +_TESTS_LOG = ${.OBJDIR}/atf-run.log +CLEANDIRFILES += ${_TESTS_FIFO} ${_TESTS_LOG} + +.PHONY: test +.if defined(TESTSDIR) +. if ${TESTSDIR} == ${TESTSBASE} +# Forbid this case. It is likely to cause false positives/negatives and it +# does not cover all the tests (e.g. it misses testing software in external). +test: + @echo "*** Sorry, you cannot use make test from src/tests. Install the" + @echo "*** tests into their final location and run them from /usr/tests" + @false +. else +test: + @echo "*** WARNING: make test is experimental" + @echo "***" + @echo "*** Using this test does not preclude you from running the tests" + @echo "*** installed in /usr/tests. This test run may raise false" + @echo "*** positives and/or false negatives." + @echo + @set -e; \ + cd ${DESTDIR}${TESTSDIR}; \ + rm -f ${_TESTS_FIFO}; \ + mkfifo ${_TESTS_FIFO}; \ + cat ${_TESTS_FIFO} | tee ${_TESTS_LOG} | \ + ${TESTS_ENV} ${DESTDIR}/usr/bin/atf-report & \ + result=0; \ + ${TESTS_ENV} ${DESTDIR}/usr/bin/atf-run >>${_TESTS_FIFO} || result=1; \ + wait; \ + rm -f ${_TESTS_FIFO}; \ + echo; \ + echo "*** The verbatim output of atf-run has been saved to ${_TESTS_LOG}"; \ + echo "*** Once again, note that "make test" is unsupported."; \ + test $${result} -eq 0 +. endif +.else +test: + @echo "*** No TESTSDIR defined; nothing to do." +.endif + +##### Pull in related .mk logic +.include diff --git a/src/share/mk/bsd.x11.mk b/src/share/mk/bsd.x11.mk new file mode 100644 index 0000000..92c5e2a --- /dev/null +++ b/src/share/mk/bsd.x11.mk @@ -0,0 +1,433 @@ +# $NetBSD: bsd.x11.mk,v 1.117 2015/07/23 08:03:26 mrg Exp $ + +.include + +BINDIR= ${X11BINDIR} +LIBDIR= ${X11USRLIBDIR} +MANDIR= ${X11MANDIR} + +COPTS+= -fno-strict-aliasing + +.include + +.if defined(USE_SSP) && (${USE_SSP} != "no") +CPPFLAGS+= -DNO_ALLOCA +.endif + +X11FLAGS.VERSION= -DOSMAJORVERSION=5 -DOSMINORVERSION=99 # XXX + +# THREADS_DEFINES +# LSC (MINIX): Not supported: -D_REENTRANT-DXTHREADS -DXUSE_MTSAFE_API +X11FLAGS.THREADS= -DXNO_MTSAFE_PWDAPI + +# CONNECTION_FLAGS +# LSC (MINIX): Not supported: -DHAS_FCHOWN +X11FLAGS.CONNECTION= -DTCPCONN -DUNIXCONN -DHAS_STICKY_DIR_BIT \ + + +.if (${USE_INET6} != "no") +X11FLAGS.CONNECTION+= -DIPv6 +.endif + +# EXT_DEFINES +X11FLAGS.BASE_EXTENSION= -DMITMISC -DXTEST -DXTRAP -DXSYNC -DXCMISC \ + -DXRECORD -DMITSHM -DBIGREQS -DXF86VIDMODE \ + -DXF86MISC -DDPMSExtension -DEVI \ + -DSCREENSAVER -DXV -DXVMC -DGLXEXT \ + -DRES + +X11FLAGS.PERVASIVE_EXTENSION= -DSHAPE -DXINPUT -DXKB -DLBX -DXAPPGROUP \ + -DXCSECURITY -DTOGCUP -DXF86BIGFONT \ + -DDPMSExtension -DPIXPRIV -DPANORAMIX \ + -DRENDER -DRANDR -DXFIXES -DDAMAGE \ + -DCOMPOSITE -DXEVIE +X11FLAGS.EXTENSION= ${X11FLAGS.BASE_EXTENSION} \ + ${X11FLAGS.PERVASIVE_EXTENSION} + +X11FLAGS.DIX= -DHAVE_DIX_CONFIG_H -D_BSD_SOURCE -DHAS_FCHOWN \ + -DHAS_STICKY_DIR_BIT -D_POSIX_THREAD_SAFE_FUNCTIONS \ + -DHAVE_XORG_CONFIG_H +X11INCS.DIX= -I${X11INCSDIR}/freetype2 \ + -I${X11INCSDIR}/pixman-1 \ + -I$(X11SRCDIR.xorg-server)/include \ + -I$(X11SRCDIR.xorg-server)/Xext \ + -I$(X11SRCDIR.xorg-server)/composite \ + -I$(X11SRCDIR.xorg-server)/damageext \ + -I$(X11SRCDIR.xorg-server)/xfixes \ + -I$(X11SRCDIR.xorg-server)/Xi \ + -I$(X11SRCDIR.xorg-server)/mi \ + -I$(X11SRCDIR.xorg-server)/miext/shadow \ + -I$(X11SRCDIR.xorg-server)/miext/damage \ + -I$(X11SRCDIR.xorg-server)/render \ + -I$(X11SRCDIR.xorg-server)/randr \ + -I$(X11SRCDIR.xorg-server)/fb \ + -I$(X11SRCDIR.xorg-server)/../include + +X11FLAGS.DRI= -DGLXEXT -DXF86DRI -DGLX_DIRECT_RENDERING \ + -DGLX_USE_DLOPEN -DGLX_USE_MESA + +.if ${X11DRI} != "no" +X11FLAGS.EXTENSION+= ${X11FLAGS.DRI} +.endif + +# ServerDefines +X11FLAGS.SERVER= -DSHAPE -DXKB -DLBX -DXAPPGROUP -DXCSECURITY \ + -DTOGCUP -DXF86BIGFONT -DDPMSExtension -DPIXPRIV \ + -DPANORAMIX -DRENDER -DRANDR -DGCCUSESGAS \ + -DAVOID_GLYPHBLT -DSINGLEDEPTH -DXvExtension \ + -DXFree86Server -DXvMCExtension -DSMART_SCHEDULE \ + -DBUILDDEBUG -DXResExtension -DNDEBUG + +# OS_DEFINES +X11FLAGS.OS_DEFINES= -DDDXOSINIT -DSERVER_LOCK -DDDXOSFATALERROR \ + -DDDXOSVERRORF -DDDXTIME -DUSB_HID + +.if defined(__MINIX) +X11FLAGS.OS_DEFINES+= -DXOS_USE_NO_LOCKING +.endif # defined(__MINIX) + +.if !(${MACHINE} == "acorn32" || \ + ${MACHINE} == "amiga" || \ + ${MACHINE} == "pmax" || \ + ${MACHINE} == "sun3" || \ + ${MACHINE} == "vax") +# EXT_DEFINES +X11FLAGS.EXTENSION+= -DXF86VIDMODE + +# ServerDefines +X11FLAGS.SERVER+= -DXINPUT -DXFreeXDGA -DXF86VIDMODE +.endif + +.if ${MACHINE_ARCH} == "alpha" || \ + ${MACHINE_ARCH} == "sparc64" || \ + ${MACHINE_ARCH} == "x86_64" +# ServerDefines +X11FLAGS.SERVER+= -D_XSERVER64 +X11FLAGS.EXTENSION+= -D__GLX_ALIGN64 +.endif + +.if ${MACHINE} == "amd64" || \ + ${MACHINE} == "cats" || \ + ${MACHINE} == "i386" || \ + ${MACHINE} == "macppc" || \ + ${MACHINE} == "netwinder" || \ + ${MACHINE} == "ofppc" || \ + ${MACHINE} == "prep" || \ + ${MACHINE} == "sgimips" || \ + ${MACHINE} == "sparc64" || \ + ${MACHINE} == "sparc" || \ + ${MACHINE} == "shark" || \ + ${MACHINE} == "zaurus" +# LOADABLE +X11FLAGS.LOADABLE= -DXFree86LOADER -DIN_MODULE -DXFree86Module \ + ${${ACTIVE_CXX} == "gcc":? -fno-merge-constants :} +.endif + +# XXX FIX ME +XVENDORNAMESHORT= '"X.Org"' +XVENDORNAME= '"The X.Org Foundation"' +XORG_RELEASE= '"Release 1.10.6"' +__XKBDEFRULES__= '"xorg"' +XLOCALE.DEFINES= -DXLOCALEDIR=\"${X11LIBDIR}/locale\" \ + -DXLOCALELIBDIR=\"${X11LIBDIR}/locale\" + +# XXX oh yeah, fix me later +XORG_VERSION_CURRENT="(((1) * 10000000) + ((10) * 100000) + ((6) * 1000) + 0)" + +PRINT_PACKAGE_VERSION= awk '/^PACKAGE_VERSION=/ { \ + match($$1, "([0-9]+\\.)+[0-9]+"); \ + version = substr($$1, RSTART, RLENGTH); \ + } END { print version }' + + +# Commandline to convert 'XCOMM' comments and 'XHASH' to '#', among other +# things. Transformed from the "CppSedMagic" macro from "Imake.rules". +# +X11TOOL_UNXCOMM= ${TOOL_SED} -e '/^\# *[0-9][0-9]* *.*$$/d' \ + -e '/^\#line *[0-9][0-9]* *.*$$/d' \ + -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \ + -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \ + -e '/^[ ]*XHASH/s/XHASH/\#/' \ + -e '/\@\@$$/s/\@\@$$/\\/' + + +CPPFLAGS+= -DCSRG_BASED -DFUNCPROTO=15 -DNARROWPROTO +CPPFLAGS+= -I${DESTDIR}${X11INCDIR} + +.if ${MACHINE_ARCH} == "x86_64" +CPPFLAGS+= -D__AMD64__ +.endif + +.if !defined(__MINIX) +LDFLAGS+= -Wl,-rpath,${X11USRLIBDIR} -L=${X11USRLIBDIR} +.else +LDFLAGS+= -Wl,-rpath,${X11USRLIBDIR} -L${DESTDIR}${X11USRLIBDIR} +.endif # !defined(__MINIX) + + +# +# .cpp -> "" handling +# CPPSCRIPTS list of files/scripts to run through cpp +# CPPSCRIPTFLAGS extra flags to ${CPP} +# CPPSCRIPTFLAGS_fn extra flags to ${CPP} for file `fn' +# +.if defined(CPPSCRIPTS) # { +.SUFFIXES: .cpp + +.cpp: + ${_MKTARGET_CREATE} + rm -f ${.TARGET} + ${CC} -E -undef -traditional - \ + ${CPPSCRIPTFLAGS_${.TARGET}:U${CPPSCRIPTFLAGS}} \ + < ${.IMPSRC} | ${X11TOOL_UNXCOMM} > ${.TARGET} + +realall: ${CPPSCRIPTS} + +CLEANFILES+= ${CPPSCRIPTS} +.endif # } + +# +# X.Org pkgconfig files handling +# +# PKGCONFIG is expected to contain a list of pkgconfig module names. +# They will produce the files .pc, .pc, etc, to be +# put in X11USRLIBDIR/pkgconfig. +# +# PKGDIST contains the name of a X11SRCDIR subscript where to find the +# source file for the pkgconfig files. +# +# If PKGDIST is not suitable, a consumer can set PKGDIST. with +# the full path to the source file. +# +# Also, the consumer can use PKGDIST alone, and a PKGCONFIG will be +# derived from it. Many times, PKGDIST is capitalized and PKGCONFIG is +# the lower case version. +# + +.if defined(PKGDIST) && !defined(PKGCONFIG) +PKGCONFIG= ${PKGDIST:tl} +.endif +.if defined(PKGCONFIG) && !defined(MLIBDIR) + +.include + +_PKGCONFIG_FILES= ${PKGCONFIG:C/$/.pc/} + +.PHONY: pkgconfig-install +pkgconfig-install: + +realall: ${_PKGCONFIG_FILES:O:u} +realinstall: pkgconfig-install + +.for _pkg in ${PKGCONFIG:O:u} # { + +PKGDIST.${_pkg}?= ${X11SRCDIR.${PKGDIST:U${_pkg}}} +_PKGDEST.${_pkg}= ${DESTDIR}${X11USRLIBDIR}/pkgconfig/${_pkg}.pc + +.PATH: ${PKGDIST.${_pkg}} + +FILESOWN_${_pkg}.pc= ${BINOWN} +FILESGRP_${_pkg}.pc= ${BINGRP} +FILESMODE_${_pkg}.pc= ${NONBINMODE} + +${_PKGDEST.${_pkg}}: ${_pkg}.pc __fileinstall +pkgconfig-install: ${_PKGDEST.${_pkg}} + +# Add a dependancy on the configure file if it exists; this way we +# will rebuild the .pc file if the version in configure changes. +.if exists(${PKGDIST.${_pkg}}/configure) +${_pkg}.pc: ${PKGDIST.${_pkg}}/configure Makefile +.endif + +.endfor # } + +# XXX +# The sed script is very, very ugly. What we actually need is a +# mknative-xorg script that will generate all the .pc files from +# running the autoconfigure script. +# And yes, it has to be split in multiple parts otherwise it's +# too long for sed to handle. + +# hacky transforms: +# @XCBPROTO_VERSION@ + +.SUFFIXES: .pc.in .pc +.pc.in.pc: + ${_MKTARGET_CREATE} + rm -f ${.TARGET} + if [ -n '${PKGCONFIG_VERSION.${.PREFIX}}' ]; then \ + _pkg_version='${PKGCONFIG_VERSION.${.PREFIX}}'; \ + else \ + _pkg_version=$$(${PRINT_PACKAGE_VERSION} \ + ${PKGDIST.${.PREFIX}}/configure); \ + fi; \ + ${TOOL_SED} \ + ${PKGCONFIG_SED_FLAGS} \ + -e "s,@prefix@,${X11ROOTDIR},; \ + s,@INSTALL_DIR@,${X11ROOTDIR},; \ + s,@exec_prefix@,\\$$\{prefix\},; \ + s,@libdir@,\\$$\{prefix\}/lib,; \ + s,@includedir@,\\$$\{prefix\}/include,; \ + s,@datarootdir@,\\$$\{prefix\}/share,; \ + s,@datadir@,\\$$\{datarootdir\},; \ + s,@appdefaultdir@,\\$$\{libdir}/X11/app-defaults,; \ + s,@MAPDIR@,\\$$\{libdir\}/X11/fonts/util,; \ + s,@ICONDIR@,\\$$\{datarootdir\}/icons,; \ + s,@PACKAGE_VERSION@,$${_pkg_version},; \ + s,@VERSION@,$${_pkg_version},; \ + s,@COMPOSITEEXT_VERSION@,$${_pkg_version%.*},; \ + s,@DAMAGEEXT_VERSION@,$${_pkg_version%.*},; \ + s,@FIXESEXT_VERSION@,$${_pkg_version%.*},; \ + s,@RANDR_VERSION@,$${_pkg_version%.*},; \ + s,@RENDER_VERSION@,$${_pkg_version%.*}," \ + -e "s,@LIBS@,,; \ + s,@Z_LIBS@,-lz,; \ + s,@LIBZ@,-lz,; \ + s,@LIBBZ2@,-lbz2,; \ + s,@xkb_base@,\\$$\{prefix\}/lib/X11/xkb,; \ + s,@xcbincludedir@,\\$$\{prefix\}/share/xcb,; \ + s,@fontrootdir@,\\$$\{libdir\}/X11/fonts,; \ + s,@LIBXML2_LIBS@,,; \ + s,@LIBXML2_CFLAGS@,,; \ + s,@ICONV_CFLAGS@,,; \ + s,@ICONV_LIBS@,,; \ + s,@NEEDED@,,; \ + s,@FT2_EXTRA_LIBS@,," \ + -e "s,@moduledir@,\\$$\{libdir\}/modules,; \ + s,@sdkdir@,\\$$\{includedir\}/xorg,; \ + s,@PIXMAN_CFLAGS@,,; \ + s,@LIB_DIR@,/lib,; \ + s,@INSTALL_LIB_DIR@,\\$$\{prefix\}/lib,; \ + s,@INSTALL_INC_DIR@,\\$$\{prefix\}/include,; \ + s,@XKBPROTO_REQUIRES@,kbproto,; \ + s,@XCBPROTO_VERSION@,1.7,; \ + s,@FREETYPE_REQUIRES@,freetype2,; \ + s,@EXPAT_LIBS@,-lexpat,; \ + s,@FREETYPE_LIBS@,-lfreetype,; \ + s,@DEP_CFLAGS@,,; \ + s,@DEP_LIBS@,,; \ + s,@X11_EXTRA_DEPS@,,; \ + s,@XTHREAD_CFLAGS@,-D_REENTRANT,; \ + s,@XTHREADLIB@,-lpthread,; \ + s,@GL_LIB@,GL,; \ + s,@GL_PC_REQ_PRIV@,x11 xext,; \ + s,@GL_PC_LIB_PRIV@,-lm -lpthread,; \ + s,@GL_PC_CFLAGS@,,; \ + s,@GLX_TLS@,no," \ + -e "s,@GLU_LIB@,GLU,; \ + s,@GLU_PC_REQ@,gl,; \ + s,@GLU_PC_REQ_PRIV@,,; \ + s,@GLU_PC_LIB_PRIV@,-lGLU,; \ + s,@GLU_PC_CFLAGS@,,; \ + s,@GLUT_LIB@,glut,; \ + s,@GLUT_PC_REQ_PRIV@,gl glu,; \ + s,@GLUT_PC_LIB_PRIV@,-lglut,; \ + s,@GLUT_PC_CFLAGS@,,; \ + s,@GLW_PC_CFLAGS@,,; \ + s,@GLW_PC_REQ_PRIV@,x11 xt,; \ + s,@GLW_PC_LIB_PRIV@,,; \ + s,@DRI_DRIVER_DIR@,\\$$\{libdir\}/modules/dri,; \ + s,@DRI_PC_REQ_PRIV@,,; \ + s,@GLW_LIB@,GLw,; \ + s,@GBM_PC_REQ_PRIV@,,; \ + s,@GBM_PC_LIB_PRIV@,,; \ + s,@abi_ansic@,0.4,; \ + s,@abi_videodrv@,5.0,; \ + s,@abi_xinput@,4.0,; \ + s,@abi_extension@,2.0,; \ + s,@abi_font@,0.6,; \ + s,@fchown_define@,-DHAS_FCHOWN,; \ + s,@sticky_bit_define@,-DHAS_STICKY_DIR_BIT,;" \ + -e "s,@PKG_CONFIG_LIBS@,${PKG_CONFIG_LIBS},; \ + s,@PACKAGE@,${PKGDIST},; \ + s,@PKGCONFIG_REQUIRES@,${PKGCONFIG_REQUIRES},; \ + s,@PKGCONFIG_REQUIRES_PRIVATELY@,${PKGCONFIG_REQUIRES_PRIVATELY},; \ + s,@ERRORDBDIR@,${X11LIBDIR},; \ + s,@EXPAT_CFLAGS@,,; \ + s,@FREETYPE_CFLAGS@,-I${X11ROOTDIR}/include/freetype2 -I${X11ROOTDIR}/include,;" \ + -e '/^Libs:/ s%-L\([^ ]*\)%-Wl,-rpath,\1 &%g' \ + < ${.IMPSRC} > ${.TARGET}.tmp && \ + mv -f ${.TARGET}.tmp ${.TARGET} + +CLEANFILES+= ${_PKGCONFIG_FILES} ${_PKGCONFIG_FILES:C/$/.tmp/} +.endif + +# +# APPDEFS (app defaults) handling +# +.if defined(APPDEFS) # { +appdefsinstall:: .PHONY ${APPDEFS:@S@${DESTDIR}${X11LIBDIR}/app-defaults/${S:T:R}@} +.PRECIOUS: ${APPDEFS:@S@${DESTDIR}${X11LIBDIR}/app-defaults/${S:T:R}@} + +__appdefinstall: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \ + ${.ALLSRC} ${.TARGET} + +.for S in ${APPDEFS:O:u} +${DESTDIR}${X11LIBDIR}/app-defaults/${S:T:R}: ${S} __appdefinstall +.endfor + +realinstall: appdefsinstall +.endif # } + + +# +# .man page handling +# +.if (${MKMAN} != "no" && (${MAN:U} != "" || ${PROG:U} != "")) # { +CLEANDIRFILES+= ${MAN:U${PROG:D${PROG.1}}} +.endif # } + +.SUFFIXES: .man .man.pre .1 .3 .4 .5 .7 + +_X11MANTRANSFORM= \ + __adminmansuffix__ 8 \ + __apploaddir__ ${X11ROOTDIR}/lib/X11/app-defaults \ + __appmansuffix__ 1 \ + __bindir__ ${X11BINDIR} \ + __drivermansuffix__ 4 \ + __filemansuffix__ 5 \ + __LIB_MAN_SUFFIX__ 3 \ + __libmansuffix__ 3 \ + __logdir__ /var/log \ + __mandir__ ${X11MANDIR} \ + __miscmansuffix__ 7 \ + __oslibmansuffix__ 3 \ + __projectroot__ ${X11ROOTDIR} \ + ${X11EXTRAMANTRANSFORMS} + +# Note the escaping trick for _X11MANTRANSFORM using % to replace spaces +XORGVERSION= '"X Version 11"' +X11MANCPP?= no +_X11MANTRANSFORM+= \ + __vendorversion__ ${XORGVERSION:C/ /%/gW} \ + __XCONFIGFILE__ xorg.conf \ + __xconfigfile__ xorg.conf \ + __XCONFIGFILEMAN__ '__XCONFIGFILE__%(__filemansuffix__)' \ + __xorgversion__ ${XORGVERSION:C/ /%/gW} \ + __XSERVERNAME__ Xorg \ + __xservername__ Xorg + +_X11MANTRANSFORMCMD= ${TOOL_SED} -e 's/\\$$/\\ /' ${.IMPSRC} + +.if ${X11MANCPP} != "no" +_X11MANTRANSFORMCMD+= | ${CC} -E -undef -traditional - +. for __def__ __value__ in ${_X11MANTRANSFORM} +_X11MANTRANSFORMCMD+= -D${__def__}=${__value__:C/%/ /gW} +. endfor +.else +_X11MANTRANSFORMCMD+= | ${TOOL_SED} +. for __def__ __value__ in ${_X11MANTRANSFORM} +_X11MANTRANSFORMCMD+= -e s,${__def__},${__value__:C/%/ /gW},g +. endfor +.endif +_X11MANTRANSFORMCMD+= ${X11EXTRAMANDEFS} + +.man.1 .man.3 .man.4 .man.5 .man.7 .man.pre.1 .man.pre.4 .man.pre.5: + ${_MKTARGET_CREATE} + rm -f ${.TARGET} + ${_X11MANTRANSFORMCMD} | ${X11TOOL_UNXCOMM} > ${.TARGET} + +##### Pull in related .mk logic +.include diff --git a/src/share/mk/minix.gcov.mk b/src/share/mk/minix.gcov.mk new file mode 100644 index 0000000..42ae988 --- /dev/null +++ b/src/share/mk/minix.gcov.mk @@ -0,0 +1,51 @@ +LCOV=lcov.$(PROG) +CLEANFILES+= *.gcno *.gcda $(LCOV) + +# Right now we support obtaining coverage information for system services only, +# and for their main program code (not including their libraries) only. +# +# Why not userland as well: because we do not care as much, and it should be +# possible to produce coverage information for system services without +# recompiling the entire system with coverage support. Moreover, as of writing +# we do not have libprofile_rt, making it impossible to compile regular +# programs with coverage support altogether. +# +# Why not system service libraries (eg libsys) as well: practical concerns.. +# 1) As of writing, even for such libraries we make a regular and a PIC +# version, both producing a .gcno file for each object. The PIC version is +# compiled last, while the regular version is used for the library archive. +# The result is a potential mismatch between the compile-time coverage +# metadata and the run-time coverage counts. +# 2) The kernel has no coverage support, and with its self-relocation it would +# be tricky to add support for it. As a result, libraries used by the +# kernel would have to be excluded from being compiled with coverage support +# so as not to create problems. One could argue that that is a good thing +# because eg libminc and libsys create too many small result units (see also +# the current hardcoded limit in libsys/llvm_gcov.c). +# 3) gcov-pull(8) strips paths, which results in lots of manual work to figure +# out what file belongs to which library, even ignoring object name +# conflicts, for example between libraries. +# 4) In order to produce practically useful results ("how much of libsockevent +# is covered by the combination of LWIP and UDS" etc), gcov-pull(8) would +# have to be extended with support for merging .gcda files. The standard +# LLVM libprofile_rt implementation supports this, but we do not. +# All of these issues are solvable, but for now anyone interested in coverage +# for a particular system service library will have to mess with individual +# makefiles themselves. + +.if ${MKCOVERAGE:Uno} == "yes" +.if ${ACTIVE_CC} == "gcc" +# Leftovers for GCC. It is not clear whether these still work at all. +COVCPPFLAGS?= -fno-builtin -fprofile-arcs -ftest-coverage +COVLDADD?= -lgcov +.else # ${ACTIVE_CC} != "gcc" +# We assume LLVM/clang here. For other compilers this will likely break the +# MKCOVERAGE compilation, which is a good indication that support for them +# should be added here. +COVCPPFLAGS?= --coverage -g -O0 +COVLDADD?= +.endif # ${ACTIVE_CC} != "gcc" +.endif # ${MKCOVERAGE:Uno} == "yes" + +lcov: + lcov -c -d . >$(LCOV) diff --git a/src/share/mk/minix.service.mk b/src/share/mk/minix.service.mk new file mode 100644 index 0000000..daf7f15 --- /dev/null +++ b/src/share/mk/minix.service.mk @@ -0,0 +1,102 @@ +# MINIX-specific servers/drivers options +.include + +# LSC: Our minimal c library has no putchar, which is called by the builtin +# functions of the compiler, so prevent using them. + +AFLAGS+= -D__ASSEMBLY__ +COPTS+= -fno-builtin + +# For MKCOVERAGE builds, enable coverage options. +.if ${MKCOVERAGE:Uno} == "yes" +CPPFLAGS+= ${COVCPPFLAGS} +LDADD+= ${COVLDADD} +.endif # ${MKCOVERAGE:Uno} == "yes" + +# LSC Static linking, order matters! +# We can't use --start-group/--end-group as they are not supported by our +# version of clang. + +# 1. No default libs +LDADD:= -nodefaultlibs ${LDADD} + +# 2. Services system library +LDADD+= -lsys +DPADD+= ${LIBSYS} + +# 3. Minimal C library, if libc had not yet been added +.if ${LDADD:M-lc} == "" +LDADD+= -lminc +DPADD+= ${LIBMINC} +.endif # empty(${LDADD:M-lc}) + +.if ${MACHINE_ARCH} == "earm" + +# LSC: On ARM, when compiling statically, with gcc, lgcc_eh is required +.if ${PROG:U} != "kernel" && !empty(CC:M*gcc) +# gcc_eh uses abort(), which is provided by minc +LDFLAGS+= ${${ACTIVE_CC} == "gcc":? -lgcc_eh:} +.endif # ${PROG:U} != "kernel" && !empty(CC:M*gcc) + +.endif # ${MACHINE_ARCH} == "earm" + +# Get (more) internal minix definitions and declarations. +CPPFLAGS += -D_MINIX_SYSTEM=1 + +# For MKMAGIC builds, link services against libmagicrt and run the magic pass +# on them, unless they have specifically requested to be built without bitcode. +.if ${USE_BITCODE:Uno} == "yes" && ${USE_MAGIC:Uno} == "yes" +LIBMAGICST?= ${DESTDIR}${LIBDIR}/libmagicrt.bcc +MAGICPASS?= ${NETBSDSRCDIR}/minix/llvm/bin/magic.so + +DPADD+= ${LIBMAGICST} ${MAGICPASS} + +.for _P in ${PROGS:U${PROG}} +BITCODE_LD_FLAGS_1ST.${_P}?= ${LIBMAGICST} +.endfor + +MAGICFLAGS?= +OPTFLAGS+= -load ${MAGICPASS} -magic ${MAGICFLAGS} + +# For MKASR builds, generate an additional set of rerandomized service +# binaries. +.if ${USE_ASR:Uno} == "yes" +ASRPASS?= ${NETBSDSRCDIR}/minix/llvm/bin/asr.so +ASRCOUNT?= 3 +ASRDIR?= /usr/service/asr + +DPADD+= ${ASRPASS} + +OPTFLAGS+= -load ${ASRPASS} -asr + +# Produce a variable _RANGE that contains "1 2 3 .. ${ASRCOUNT}". We do not +# want to invoke a shell command to do this; what if the host platform does not +# have seq(1) ? So, we do it with built-in BSD make features instead. There +# are probably substantially better ways to do this, though. Right now the +# maximum ASRCOUNT is 65536 (16**4), which should be plenty. An ASRCOUNT of 0 +# is not supported, nor would it be very useful. +_RANGE= 0 +_G0= xxxxxxxxxxxxxxxx +_G= ${_G0:S/x/${_G0}/g:S/x/${_G0}/g:S/x/${_G0}/g} +.for _X in ${_G:C/^(.{${ASRCOUNT}}).*/\1/:S/x/x /g} +_RANGE:= ${_RANGE} ${_RANGE:[#]} +.endfor +_RANGE:= ${_RANGE:[2..-1]} + +# Add progname-1, progname-2, progname-3 (etc) to the list of programs to +# generate, and install (just) these to ASRDIR. +PROGS?= ${PROG} +_PROGLIST:= ${PROGS} +.for _N in ${_RANGE} +.for _P in ${_PROGLIST} +PROGS+= ${_P}-${_N} +SRCS.${_P}-${_N}= ${SRCS.${_P}:U${SRCS}} +BITCODE_LD_FLAGS_1ST.${_P}-${_N}:= ${BITCODE_LD_FLAGS_1ST.${_P}} +BINDIR.${_P}-${_N}= ${ASRDIR} +.endfor +.endfor + +.endif # ${USE_ASR:Uno} == "yes" +.endif # ${USE_BITCODE:Uno} == "yes" && ${USE_MAGIC:Uno} == "yes" + +.include diff --git a/src/share/mk/sys.mk b/src/share/mk/sys.mk new file mode 100644 index 0000000..dc031d2 --- /dev/null +++ b/src/share/mk/sys.mk @@ -0,0 +1,271 @@ +# $NetBSD: sys.mk,v 1.128 2015/07/06 00:21:51 chs Exp $ +# @(#)sys.mk 8.2 (Berkeley) 3/21/94 +# +# 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. + +# This variable should be used to differentiate Minix builds in Makefiles. +__MINIX= yes + +.if !defined(__MINIX) +unix?= We run NetBSD. + +.SUFFIXES: .a .o .ln .s .S .c .cc .cpp .cxx .C .f .F .r .p .l .y .sh +.else +unix?= We run MINIX. + +.SUFFIXES: .a .o .bc .ln .s .S .c .cc .cpp .cxx .C .f .F .r .p .l .y .sh + +.if ${MKSMALL:U} == "yes" +CPPFLAGS+= -DNDEBUG +DBG= -Os +.endif + +.if ${MKMAGIC:Uno} == "yes" || ${MKASR:Uno} == "yes" +CPPFLAGS+= -D_MINIX_MAGIC=1 +STRIPFLAG= -s +DBG=-g +.endif + +#LSC: Be a bit smarter about the default compiler +.if exists(/usr/pkg/bin/clang) || exists(/usr/bin/clang) +CC?= clang +.endif + +.if exists(/usr/pkg/bin/gcc) || exists(/usr/bin/gcc) +CC?= gcc +.endif +.endif # defined(__MINIX) + +.LIBS: .a + +AR?= ar +ARFLAGS?= rl +RANLIB?= ranlib + +AS?= as +AFLAGS?= +COMPILE.s?= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} -c +LINK.s?= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${LDFLAGS} +_ASM_TRADITIONAL_CPP= -x assembler-with-cpp +COMPILE.S?= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} ${_ASM_TRADITIONAL_CPP} -c +LINK.S?= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} ${LDFLAGS} + +CC?= cc +.if ${MACHINE_ARCH} == "sh3el" || ${MACHINE_ARCH} == "sh3eb" +# -O2 is too -falign-* zealous for low-memory sh3 machines +DBG?= -Os -freorder-blocks +.elif ${MACHINE_ARCH} == "m68k" || ${MACHINE_ARCH} == "m68000" +# -freorder-blocks (enabled by -O2) produces much bigger code +DBG?= -O2 -fno-reorder-blocks +.elif ${MACHINE_ARCH} == "coldfire" +DBG?= -O1 +.elif !empty(MACHINE_ARCH:Maarch64*) +DBG?= -O2 ${"${.TARGET:M*.po}" == "":? -fomit-frame-pointer:} +.elif ${MACHINE_ARCH} == "vax" +DBG?= -O1 -fgcse -fstrength-reduce -fgcse-after-reload +.else +DBG?= -O2 +.endif +.if !defined(__MINIX) +CFLAGS?= ${DBG} +.else +CFLAGS+= ${DBG} +.endif # !defined(__MINIX) +LDFLAGS?= +COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c +LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} + +# C Type Format data is required for DTrace +CTFFLAGS ?= -g -L VERSION +CTFMFLAGS ?= -t -g -L VERSION + +CXX?= c++ +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} + +__ALLSRC1= ${empty(DESTDIR):?${.ALLSRC}:${.ALLSRC:S|^${DESTDIR}|^destdir|}} +__ALLSRC2= ${empty(MAKEOBJDIR):?${__ALLSRC1}:${__ALLSRC1:S|^${MAKEOBJDIR}|^obj|}} +__ALLSRC3= ${empty(NETBSDSRCDIR):?${__ALLSRC2}:${__ALLSRC2:S|^${NETBSDSRCDIR}|^src|}} +__BUILDSEED= ${BUILDSEED}/${__ALLSRC3:O}/${.TARGET} +_CXXSEED?= ${BUILDSEED:D-frandom-seed=${__BUILDSEED:hash}} + +COMPILE.cc?= ${CXX} ${_CXXSEED} ${CXXFLAGS} ${CPPFLAGS} -c +LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} + +OBJC?= ${CC} +OBJCFLAGS?= ${CFLAGS} +COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c +LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS} + +CPP?= cpp +CPPFLAGS?= + +FC?= f77 +FFLAGS?= -O +RFLAGS?= +COMPILE.f?= ${FC} ${FFLAGS} -c +LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS} +COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c +LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS} +COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c +LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS} + +INSTALL?= install + +LD?= ld + +LEX?= lex +LFLAGS?= +LEX.l?= ${LEX} ${LFLAGS} + +LINT?= lint +LINTFLAGS?= -chapbxzgFS + +LORDER?= lorder + +MAKE?= make + +NM?= nm + +PC?= pc +PFLAGS?= +COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c +LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS} + +SHELL?= sh + +SIZE?= size + +TSORT?= tsort -q + +YACC?= yacc +YFLAGS?= +YACC.y?= ${YACC} ${YFLAGS} + +# C +.c: + ${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} +# XXX: disable for now +# ${defined(CTFCONVERT):?${CTFCONVERT} ${CTFFLAGS} ${.TARGET}:} +.c.o: + ${COMPILE.c} ${.IMPSRC} + ${defined(CTFCONVERT):?${CTFCONVERT} ${CTFFLAGS} ${.TARGET}:} +.c.a: + ${COMPILE.c} ${.IMPSRC} + ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o + rm -f ${.PREFIX}.o +.c.ln: + ${LINT} ${LINTFLAGS} \ + ${CPPFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ + -i ${.IMPSRC} + +# C++ +.cc .cpp .cxx .C: + ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} +.cc.o .cpp.o .cxx.o .C.o: + ${COMPILE.cc} ${.IMPSRC} +.cc.a .cpp.a .cxx.a .C.a: + ${COMPILE.cc} ${.IMPSRC} + ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o + rm -f ${.PREFIX}.o + +# Fortran/Ratfor +.f: + ${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} +.f.o: + ${COMPILE.f} ${.IMPSRC} + ${defined(CTFCONVERT):?${CTFCONVERT} ${CTFFLAGS} ${.TARGET}:} +.f.a: + ${COMPILE.f} ${.IMPSRC} + ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o + rm -f ${.PREFIX}.o + +.F: + ${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} + ${defined(CTFCONVERT):?${CTFCONVERT} ${CTFFLAGS} ${.TARGET}:} +.F.o: + ${COMPILE.F} ${.IMPSRC} + ${defined(CTFCONVERT):?${CTFCONVERT} ${CTFFLAGS} ${.TARGET}:} +.F.a: + ${COMPILE.F} ${.IMPSRC} + ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o + rm -f ${.PREFIX}.o + +.r: + ${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} +.r.o: + ${COMPILE.r} ${.IMPSRC} + ${defined(CTFCONVERT):?${CTFCONVERT} ${CTFFLAGS} ${.TARGET}:} +.r.a: + ${COMPILE.r} ${.IMPSRC} + ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o + rm -f ${.PREFIX}.o + +# Pascal +.p: + ${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} + ${defined(CTFCONVERT):?${CTFCONVERT} ${CTFFLAGS} ${.TARGET}:} +.p.o: + ${COMPILE.p} ${.IMPSRC} + ${defined(CTFCONVERT):?${CTFCONVERT} ${CTFFLAGS} ${.TARGET}:} +.p.a: + ${COMPILE.p} ${.IMPSRC} + ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o + rm -f ${.PREFIX}.o + +# Assembly +.s: + ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} + ${defined(CTFCONVERT):?${CTFCONVERT} ${CTFFLAGS} ${.TARGET}:} +.s.o: + ${COMPILE.s} ${.IMPSRC} + ${defined(CTFCONVERT):?${CTFCONVERT} ${CTFFLAGS} ${.TARGET}:} +.s.a: + ${COMPILE.s} ${.IMPSRC} + ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o + rm -f ${.PREFIX}.o +.S: + ${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} + ${defined(CTFCONVERT):?${CTFCONVERT} ${CTFFLAGS} ${.TARGET}:} +.S.o: + ${COMPILE.S} ${.IMPSRC} + ${defined(CTFCONVERT):?${CTFCONVERT} ${CTFFLAGS} ${.TARGET}:} +.S.a: + ${COMPILE.S} ${.IMPSRC} + ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o + rm -f ${.PREFIX}.o + +# Lex +.l: + ${LEX.l} ${.IMPSRC} + ${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll + rm -f lex.yy.c +.l.c: + ${LEX.l} ${.IMPSRC} + mv lex.yy.c ${.TARGET} +.l.o: + ${LEX.l} ${.IMPSRC} + ${COMPILE.c} -o ${.TARGET} lex.yy.c + ${defined(CTFCONVERT):?${CTFCONVERT} ${CTFFLAGS} ${.TARGET}:} + rm -f lex.yy.c + +# Yacc +.y: + ${YACC.y} ${.IMPSRC} + ${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS} + rm -f y.tab.c +.y.c: + ${YACC.y} ${.IMPSRC} + mv y.tab.c ${.TARGET} +.y.o: + ${YACC.y} ${.IMPSRC} + ${COMPILE.c} -o ${.TARGET} y.tab.c + ${defined(CTFCONVERT):?${CTFCONVERT} ${CTFFLAGS} ${.TARGET}:} + rm -f y.tab.c + +# Shell +.sh: + rm -f ${.TARGET} + cp ${.IMPSRC} ${.TARGET} + chmod a+x ${.TARGET} diff --git a/src/share/mk/ubix.README b/src/share/mk/ubix.README new file mode 100644 index 0000000..597a34a --- /dev/null +++ b/src/share/mk/ubix.README @@ -0,0 +1,2032 @@ +# $NetBSD: bsd.README,v 1.346 2015/07/23 08:03:26 mrg Exp $ +# @(#)bsd.README 8.2 (Berkeley) 4/2/94 + +This is the README file for the make "include" files for the NetBSD +source tree. The files are installed in /usr/share/mk, and are, +by convention, named with the suffix ".mk". + +Note, this file is not intended to replace reading through the .mk +files for anything tricky. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +RANDOM THINGS WORTH KNOWING: + +The files are simply C-style #include files, and pretty much behave like +you'd expect. The syntax is slightly different in that a single '.' is +used instead of the hash mark, i.e. ".include ". + +One difference that will save you lots of debugging time is that inclusion +of the file is normally done at the *end* of the Makefile. The reason for +this is because .mk files often modify variables and behavior based on the +values of variables set in the Makefile. To make this work, remember that +the FIRST target found is the target that is used, i.e. if the Makefile has: + + a: + echo a + a: + echo a number two + +the command "make a" will echo "a". To make things confusing, the SECOND +variable assignment is the overriding one, i.e. if the Makefile has: + + a= foo + a= bar + + b: + echo ${a} + +the command "make b" will echo "bar". This is for compatibility with the +way the V7 make behaved. + +It's fairly difficult to make the BSD .mk files work when you're building +multiple programs in a single directory. It's a lot easier to split up the +programs than to deal with the problem. Most of the agony comes from making +the "obj" directory stuff work right, not because we switched to a new version +of make. So, don't get mad at us, figure out a better way to handle multiple +architectures so we can quit using the symbolic link stuff. (Imake doesn't +count.) + +The file .depend in the source directory is expected to contain dependencies +for the source files. This file is read automatically by make after reading +the Makefile. + +The variable DESTDIR works as before. It's not set anywhere but will change +the tree where the file gets installed. + +The profiled libraries are no longer built in a different directory than +the regular libraries. A new suffix, ".po", is used to denote a profiled +object, and ".pico" denotes a shared (position-independent) object. + +There are various make variables used during the build. + +Many variables support a (case sensitive) value of "no" or "yes", +and are tested with ${VAR} == "no" and ${VAR} != "no" . + + +The basic rule for the variable naming scheme is as follows: + +HOST_xxx A command that runs on the host machine regardless of + whether or not the system is being cross compiled, or + flags for such a command. + +MKxxx Can be set to "no" to disable functionality, or + "yes" to enable it. + Usually defaults to "yes", although some variables + default to "no". + Due to make(1) implementation issues, if a temporary + command-line override of a mk.conf(5) or + setting is required whilst still honoring a particular + Makefile's setting of MKxxx, use + env MKxxx=value make + instead of + make MKxxx=value + +NOxxx If defined, disables a feature. + Not intended for users. + This is to allow Makefiles to disable functionality + that they don't support (such as missing man pages). + NOxxx variables must be defined before + is included. + +TOOL_xxx A tool that is provided as part of the USETOOLS + framework. When not using the USETOOLS framework, + TOOL_xxx variables should refer to tools that are + already installed on the host system. + +The following variables that control how things are made/installed that +are not set by default. These should not be set by Makefiles; they're for +the user to define in MAKECONF (see , below, or mk.conf(5)) +or on the make(1) command line: + +BUILD If defined, 'make install' checks that the targets in the + source directories are up-to-date and remakes them if they + are out of date, instead of blindly trying to install + out of date or non-existent targets. + +MAKEVERBOSE Control how "verbose" the standard make(1) rules are. + Default: 2 + Supported values: + 0 Minimal output ("quiet") + 1 Describe what is occurring + 2 Describe what is occurring and echo the actual command + 3 Ignore the effect of the "@" prefix in make commands + 4 Trace shell commands using the shell's -x flag + +MKATF If "no", don't build the Automated Testing Framework (ATF), + which includes the libatf-c, libatf-c++ and libatf-sh libraries + and the various command line tools. Also, because the build of + the libraries is disabled, don't build the NetBSD test suite + either. + Default: yes + +MKBFD Obsolete, use MKBINUTILS + +MKBINUTILS If "no", don't build binutils (gas, ld, etc and libbfd, + libopcodes) + Default: yes + +MKBSDTAR If "yes", use the libarchive based cpio and tar instead of + the pax frontends. + Default: no + +MKCATPAGES If "no", don't build or install the catman pages. + Default: no + +MKCOMPAT If "no", don't build or install the src/compat. + Default: yes on amd64/mips64/sparc64, no elsewhere. + +MKCOMPATTESTS If "yes", build and install the NetBSD test suite when + building and installing src/compat. + Default: no + +MKCOMPATX11 If "yes", build and install the X11 libraries when + building and installing src/compat. + Default: no + +MKCOMPLEX If "no", don't build libm support for + Default: yes + +MKCRYPTO If "no", no cryptography support will be built into the system, + and also acts as "MKKERBEROS=no". + Default: yes + +MKCRYPTO_RC5 If not "no", RC5 support will be built into libcrypto_rc5 + Default: no + +MKCTF If "no", do not build and install CTF tools, and also + don't generate and manipulate CTF data of ELF binaries + during build. + Default: no + +MKCVS If "no", don't build or install cvs(1). + Default: yes + +MKDEBUG If "no", don't build and install separate debugging symbols + into /usr/libdata/debug. + Default: no + +MKDEBUGLIB Build *_g.a debugging libraries, which are compiled + with -DDEBUG. + Default: no + +MKDEPINCLUDES If "yes" issue .include statements in the .depend file + instead of inlining the contents of the .d files. Useful + when stale dependencies are present, to list the exact + files that need refreshing. It is off by default because + it is possibly slower. + Default "no" + +MKDOC If "no", don't build or install the documentation. + Default: yes + +MKDTRACE If "no", do not build and install the kernel modules, + utilities and libraries used to implement the dtrace(1) + facility. + Default: no + +MKDYNAMICROOT If "no", build programs in /bin and /sbin statically, + don't install certain libraries in /lib, and don't + install the shared linker into /libexec. + Default: yes + +MKEXTSRC If not "no", 'make build' also descends into either src/extsrc + to cross-build programs and libraries externally added by + users, and automatically enables creation of those sets. + Default: no + +MKGCC If "no", don't build gcc(1) or any of the GCC-related + libraries (libgcc, libobjc, libstdc++). + Default: yes + +MKGCCCMDS If "no", don't build gcc(1), but do build the GCC-related + libraries (libgcc, libobjc, libstdc++). + Default: yes + +MKGDB If "no", don't build gdb(1). + Default: yes + +MKGROFFHTMLDOC If "no", avoid trying to use groff to generate html for + miscellaneous articles, as this seems to sometimes want + to run software not in base. Does not affect html man + pages. + Default: no + +MKHESIOD If "no", disables building of Hesiod infrastructure + (libraries and support programs). + Default: yes + +MKHOSTOBJ If not "no", for programs intended to be run on the compile + host, the name, release, and architecture of the host + operating system will be suffixed to the name of the object + directory created by "make obj". + Default: no + +MKHTML If "no", don't build or install the HTML man pages. + Default: yes + +MKIEEEFP If "no", don't add code for IEEE754/IEC60559 conformance. + Has no effect on most platforms. + Default: yes + +MKSTRIPIDENT Strip the RCS IDs from program binaries and shared libraries. + Default: no + +MKINET6 If "no", disables building of INET6 (IPv6) infrastructure + (libraries and support programs). This option must not be + set to "no" if MKX11 is not "no". + Default: yes + +MKINFO If "no", don't build or install Info documentation from + Texinfo source files. + Default: yes + +MKIPFILTER If "no", don't build or install the IP Filter programs and LKM. + Default: yes + +MKISCSI If "no", don't build or install iSCSI library or applications + (depends on libpthread.) + Default: yes + +MKKDEBUG If "yes", force building of kernel symbol info and creation + of netbsd.gdb in all kernel builds, independently of the + settings for "makeoptions DEBUG" in the kernel config file. + +MKKERBEROS If "no", disables building of Kerberos v5 + infrastructure (libraries and support programs). + Default: yes + +MKKMOD If "no", disables building of kernel modules. + Default: yes + +MKKYUA If "no", don't build Kyua nor its dependent library Lutok. + Note that setting this to "no" does not disable the build of + the NetBSD test suite itself; the build of the tests is + controlled by the MKATF knob. + Default: no (until the import is done and validated) + +MKLDAP If "no", disables building of LDAP infrastructure + (libraries and support programs). + Default: yes + +MKLIBCXX If not "no", build and install libc++. + Default: no + +MKLIBSTDCXX If not "no", build and install libstdc++. + Default: yes + +MKLINKLIB If "no", act as "MKLINT=no MKPICINSTALL=no MKPROFILE=no". + Also: + - don't install the .a libraries + - don't install _pic.a libraries on PIC systems + - don't build .a libraries on PIC systems + - don't install the .so symlink on ELF systems + I.e, only install the shared library (and the .so.major + symlink on ELF). + Default: yes + +MKLINT If "no", don't build or install the lint libraries. + Default: yes + +MKLVM If "no", don't build or install the logical volume manager + and device mapper tools and libraries + Default: yes + +MKMAN If "no", don't build or install the man or catman pages, + and also acts as "MKCATPAGES=no MKHTML=no". + Default: yes + +MKMANDOC If "yes", mandoc is built as tool and used to compile + catman or html pages. A directory can be exempted by + defining NOMANDOC. Individual man pages are exempted + if NOMANDOC.${target} is set to "yes". + Default: yes + +MKMANZ If not "no", compress manual pages at installation time. + Default: no + +MKMDNS If "no", disables building of mDNS infrastructure + (libraries and support programs). + Default: yes + +MKNLS If "no", don't build or install the NLS files and locale + definition files. + Default: yes + +MKNPF If "no", don't build or install the NPF and its modules. + Default: yes + +MKOBJ If "no", don't enable the rule which creates objdirs, + and also acts as "MKOBJDIRS=no". + Default: yes + +MKOBJDIRS If "no", don't create objdirs during a "make build". + Default: no + +MKPAM If "no", disables building of PAM authentication + infrastructure (libraries and support programs). + Default: yes + +MKPCC If "no", don't build pcc(1) or any of the PCC-related + libraries (libpcc, libpccsoftfloat). + Default: no + +MKPF If "no", don't build or install the pf programs and LKM. + Default: yes + +MKPIC If "no", don't build or install shared libraries, and + also acts as "MKPICLIB=no" + Default: yes (for MACHINE_ARCHs that support it) + +MKPICINSTALL If "no", don't install the *_pic.a libraries. + Default: yes + +MKPICLIB If "no", don't build *_pic.a libraries, and build the + shared object libraries from the .a libraries. + A symlink is installed in ${DESTDIR}/usr/lib for the + _pic.a library pointing to the .a library. + Default: yes + +MKPIE If "no", create regular executables. Otherwise create + PIE (Position Independent Executables). + Default: no + +MKPIGZGZIP If "no", only install pigz as pigz, not gzip. + Default: no + +MKPOSTFIX If "no", don't build or install postfix(1). + Default: yes + +MKPROFILE If "no", don't build or install the profiling (*_p.a) libraries. + Default: yes + +MKREPRO If "yes", create reproducable builds. This enables + different switches to make two builds from the same source tree + result in the same build results. + Default: no + +MKSHARE If "no", act as "MKCATPAGES=no MKDOC=no MKHTML=no MKINFO=no + MKMAN=no MKNLS=no". + I.e, don't build catman pages, documentation, Info + documentation, man pages, NLS files, ... + Default: yes + +MKSKEY If "no", disables building of S/key authentication + infrastructure (libraries and support programs). + Default: yes + +MKSLJIT If "no", disables building of sljit (stack-less platform + independent JIT compiler) private library and tests. + Default: yes on amd64, i386 and sparc, no elsewhere. + +MKSOFTFLOAT If not "no", build with options to enable the compiler to + generate output containing library calls for floating + point and possibly soft-float library support. + Default: no + +MKSTATICLIB If "no", don't build or install the normal static (*.a) + libraries. + Default: yes + +MKTPM If "no" then don't build the Trusted Platform Module + infrastructure. + Default: no + +MKUNPRIVED If not "no", don't set the owner/group/mode when installing + files or directories, and keep a metadata log of what + the owner/group/mode should be. This allows a + non-root "make install". + Default: no + +MKUPDATE If not "no", 'make install' only installs targets that are + more recently modified in the source directories that their + installed counterparts. + Default: no + +MKX11 If not "no", 'make build' also descends into + src/external/mit/xorg to cross-build X11 and automatically + enables creation of X sets. + Default: no + +MKX11FONTS If not "no", do not build or install the X fonts. The xfont + set is still created but will be empty. + Default: yes + +MKX11MOTIF: If "yes", build the native X11 libGLw with Motif stubs. If + Motif is not installed in the default location /usr/pkg, the + location can be specified using the X11MOTIFPATH variable. + Default: no + +MKRADEONFIRMWARE If "no", install the /libdata/firmware/radeon directory, + which is necessary for the radeon DRM driver. + Default: yes on i386 and amd64, no elsewhere. + +MKYP If "no", disables building of YP (NIS) + infrastructure (libraries and support programs). + Default: yes + +MKZFS If "no", do not build and install utilities and libraries + used to manage ZFS file system. Do not build zfs and solaris + compatibility kernel modules. Note: ZFS requires 64bit + atomic operations. + Default: yes on amd64, no elsewhere. + +MKRUMP If "no", do not build and install rump related headers, + libraries, and programs. + Default: yes + +USE_HESIOD If "no", disables building Hesiod support into + various system utilities/libraries that support it. + If ${MKHESIOD} is "no", USE_HESIOD will also be + forced to "no". + +USE_INET6 If "no", disables building INET6 (IPv6) support into + various system utilities/libraries that support it. + If ${MKINET6} is "no", USE_INET6 will also be + forced to "no". + +USE_JEMALLOC If "no", disables building the "jemalloc" allocator + designed for improved performance with threaded + applications. The "phkmalloc" allocator as used up + before NetBSD-5.0 will be substituted. + +USE_KERBEROS If "no", disables building Kerberos v5 + support into various system utilities/libraries that + support it. If ${MKKERBEROS} is "no", USE_KERBEROS + will also be forced to "no". + +USE_LDAP If "no", disables building LDAP support into various + system utilities/libraries that support it. + If ${MKLDAP} is "no", USE_LDAP will also be forced to "no". + +USE_PAM If "no", disables building PAM authentication support + into various system utilities/libraries that support it. + If ${MKPAM} is "no", USE_PAM will also be forced to "no". + +USE_SKEY If "no", disables building S/key authentication + support into various system utilities/libraries that + support it. If ${MKSKEY} is "no", USE_SKEY will + also be forced to "no". + Default: no + +USE_SSP If "no", disables GCC stack protection code, which + detects stack overflows and aborts the program. The + stack protection code imposes a performance penalty + of about 5%. + Default: "no", unless "USE_FORT" is set to "yes" + +USE_FORT If "yes" turns on substitute wrappers for commonly used + functions that do not do bounds checking regularly, but + they could in some cases by using the gcc + __builtin_object_size() function to determine the buffer + size where it is known and detect buffer overflows. + These substitute functions are in /usr/include/ssp. + Default: depends on the part of the source tree + +USE_YP If "no", disables building YP (NIS) support into + various system utilities/libraries that support it. + If ${MKYP} is "no", USE_YP will also be forced to "no". + +USE_PIGZGZIP If "no", use the host "gzip" program to compress things. + Otherwise, build tools/pigz, set TOOL_GZIP=${TOOL_PIGZ}, + and use nbpigz to compress things. + Default: "no". + +COPTS.lib +OBJCOPTS.lib +LDADD.lib +CPPFLAGS.lib +CXXFLAGS.lib +COPTS. +OBJCCOPTS. +LDADD. +CPPFLAGS. +CXXFLAGS. These provide a way to specify additions to the associated + variables in a way that applies only to a particular library + or program. corresponds to the LIB variable set in + the library's makefile. corresponds to either PROG + or PROG_CXX (if set). For example, if COPTS.libcrypto is + set to "-g", "-g" will be added to COPTS only when compiling + the crypto library. + +The active compiler is selected using the following variables: +AVAILABLE_COMPILER + List of available compiler suites. Processed in order + for selecting the active compiler for each frontend. +HAVE_PCC If defined, PCC is present and enabled. +HAVE_LLVM If defined, LLVM/Clang is present and enabled. +UNSUPPORTED_COMPILER.xxx + If defined, the support for compiler "xxx" is disabled. + +For the frontends (CC, CPP, CXX, FC and OBJC) the following variables exist: +ACTIVE_CC Active compile suite for the CC frontend. +SUPPORTED_CC Compile suite with support for the CC frontend. +TOOL_CC.xxx Path to the CC frontend for compiler "xxx" + +=-=-=-=-= sys.mk =-=-=-=-= + +The include file has the default rules for all makes, in the BSD +environment or otherwise. You probably don't want to touch this file. + +=-=-=-=-= bsd.own.mk =-=-=-=-= + +The include file contains source tree configuration parameters, +such as the owners, groups, etc. for both manual pages and binaries, and +a few global "feature configuration" parameters. + +It has no targets. + +To get system-specific configuration parameters, will try to +include the file specified by the "MAKECONF" variable. If MAKECONF is not +set, or no such file exists, the system make configuration file, /etc/mk.conf +is included. These files may define any of the variables described below. + + sets the following variables, if they are not already defined +(defaults are in brackets): + +NETBSDSRCDIR Top of the NetBSD source tree. + If _SRC_TOP_ != "", that will be used as the default, + otherwise BSDSRCDIR will be used as the default. + Various makefiles within the NetBSD source tree will + use this to reference the top level of the source tree. + +_SRC_TOP_ Top of the system source tree, as determined by + based on the presence of tools/ and build.sh. This variable + is "internal" to , although its value is only + determined once and then propagated to all sub-makes. + +_NETBSD_VERSION_DEPENDS + A list of files which contain information about + the version of the NetBSD being built. This is + defined only if the current directory appears + to be inside a NetBSD source tree. The list of + files includes ${NETBSDSRCDIR}/sys/sys/param.h + (which contains the kernel version number), + ${NETBSDSRCDIR}/sys/conf/newvers.sh and + ${NETBSDSRCDIR}/sys/conf/osrelease.sh (which + interpret the information in sys/sys/param.h), and + ${_SRC_TOP_OBJ_}/params (which is an optional file, + created by "make build" in ${_SRC_TOP_}/Makefile, + containing all the variables that may influence the + build). + + Targets that depend on the NetBSD version, or on + variables defined at build time, can declare a + dependency on ${_NETBSD_VERSION_DEPENDS}, like this: + + version.c: ${_NETBSD_VERSION_DEPENDS} + commands to create version.c + +BSDSRCDIR The real path to the system sources, so that 'make obj' + will work correctly. [/usr/src] + +BSDOBJDIR The real path to the system 'obj' tree, so that 'make obj' + will work correctly. [/usr/obj] + +BINGRP Binary group. [wheel] + +BINOWN Binary owner. [root] + +BINMODE Binary mode. [555] + +NONBINMODE Mode for non-executable files. [444] + +MANDIR Base path for manual installation. [/usr/share/man/cat] + +MANGRP Manual group. [wheel] + +MANOWN Manual owner. [root] + +MANMODE Manual mode. [${NONBINMODE}] + +MANINSTALL Manual installation type. Space separated list: + catinstall, htmlinstall, maninstall + Default value derived from MKCATPAGES and MKHTML. + +LDSTATIC Control program linking; if set blank, link everything + dynamically. If set to "-static", link everything statically. + If not set, programs link according to their makefile. + +LIBDIR Base path for library installation. [/usr/lib] + +LINTLIBDIR Base path for lint(1) library installation. [/usr/libdata/lint] + +LIBGRP Library group. [${BINGRP}] + +LIBOWN Library owner. [${BINOWN}] + +LIBMODE Library mode. [${NONBINMODE}] + +DOCDIR Base path for system documentation (e.g. PSD, USD, etc.) + installation. [/usr/share/doc] + +DOCGRP Documentation group. [wheel] + +DOCOWN Documentation owner. [root] + +DOCMODE Documentation mode. [${NONBINMODE}] + +GZIP_N_FLAG Flags to pass to TOOL_GZIP to prevent it from inserting + file names or timestamps in the compressed output. + [-n, or -nT when TOOL_GZIP is really TOOL_PIGZ] + +NLSDIR Base path for Native Language Support files installation. + [/usr/share/nls] + +NLSGRP Native Language Support files group. [wheel] + +NLSOWN Native Language Support files owner. [root] + +NLSMODE Native Language Support files mode. [${NONBINMODE}] + +X11SRCDIR The path to the xsrc tree. [${NETBSDSRCDIR}/../xsrc, + if that exists; otherwise /usr/xsrc] + +X11SRCDIR.local The path to the local X11 src tree. [${X11SRCDIR}/local] + +X11SRCDIR.lib +X11SRCDIR. + The path to the xorg src tree for the specificed package>. + [${X11SRCDIR}/external/mit/xorg//dist] + +X11ROOTDIR Root directory of the X11 installation. [/usr/X11R6 or + [/usr/X11R7] + +X11BINDIR X11 bin directory. [${X11ROOTDIR}/bin] + +X11FONTDIR X11 font directory. [${X11ROOTDIR}/lib/X11/fonts] + +X11INCDIR X11 include directory. [${X11ROOTDIR}/include] + +X11LIBDIR X11 lib/x11 (config) directory. [${X11ROOTDIR}/lib/X11] + +X11MANDIR X11 manual directory. [${X11ROOTDIR}/man] + +X11USRLIBDIR X11 library directory. [${X11ROOTDIR}/lib] + +STRIPFLAG The flag passed to the install program to cause the binary + to be stripped. This is to be used when building your + own install script so that the entire system can be made + stripped/not-stripped using a single knob. [] + +COPY The flag passed to the install program to cause the binary + to be copied rather than moved. This is to be used when + building our own install script so that the entire system + can either be installed with copies, or with moves using + a single knob. [-c] + +MAKEDIRTARGETENV + Environment variables passed to the child make process + invoked by MAKEDIRTARGET. + +MAKEDIRTARGET dir target [params] + Runs "cd $${dir} && ${MAKE} [params] $${target}", + displaying a "pretty" message whilst doing so. + +RELEASEMACHINEDIR + Subdirectory used below RELEASEDIR when building + a release. [${MACHINE}] + +RELEASEMACHINE Subdirectory or path component used for the following + paths: + distrib/${RELEASEMACHINE} + distrib/notes/${RELEASEMACHINE} + etc/etc.${RELEASEMACHINE} + Used when building a release. [${MACHINE}] + +Additionally, the following variables may be set by or in a +make configuration file to modify the behavior of the system build +process (default values are in brackets along with comments, if set by +): + +USETOOLS Indicates whether the tools specified by ${TOOLDIR} should + be used as part of a build in progress. + Supported values: + + yes Use the tools from TOOLDIR. + Must be set to this if cross-compiling. + + no Do not use the tools from TOOLDIR, but refuse to + build native compilation tool components that are + version-specific for that tool. + + never Do not use the tools from TOOLDIR, even when + building native tool components. This is similar to + the traditional NetBSD build method, but does not + verify that the compilation tools in use are + up-to-date enough in order to build the tree + successfully. This may cause build or runtime + problems when building the whole NetBSD source tree. + + Default: "yes" if building all or part of a whole NetBSD + source tree (detected automatically); "no" otherwise + (to preserve traditional semantics of the + make(1) include files). + +OBJECT_FMT Object file format. [set to "ELF" on architectures that + use ELF -- currently all architectures]. + +TOOLCHAIN_MISSING + If not "no", this indicates that the platform being built + does not have a working in-tree toolchain. If the + ${MACHINE_ARCH} in question falls into this category, + TOOLCHAIN_MISSING is conditionally assigned the value "yes". + Otherwise, the variable is unconditionally assigned the + value "no". + If not "no", ${MKBINUTILS}, ${MKGCC}, and ${MKGDB} are + unconditionally assigned the value "no". + +EXTERNAL_TOOLCHAIN + This variable is not directly set by , but + including is the canonical way to gain + access to this variable. The variable should be defined + either in the user's environment or in the user's mk.conf + file. If defined, this variable indicates the root of + an external toolchain which will be used to build the + tree. For example, if a platform is a ${TOOLCHAIN_MISSING} + platform, EXTERNAL_TOOLCHAIN can be used to re-enable the + cross-compile framework. + + If EXTERNAL_TOOLCHAIN is defined, ${MKGCC} is unconditionally + assigned the value "no", since the external version of the + compiler may not be able to build the library components of + the in-tree compiler. + + NOTE: This variable is not yet used in as many places as + it should be. Expect the exact semantics of this variable + to change in the short term as parts of the cross-compile + framework continue to be cleaned up. + +The following variables are defined to commands to perform the +appropriate operation, with the default in [brackets]. Note that +the defaults change if USETOOLS == "yes": + +TOOL_AMIGAAOUT2BB aout to Amiga bootblock converter. [amiga-aout2bb] + +TOOL_AMIGAELF2BB ELF to Amiga bootblock converter. [amiga-elf2bb] + +TOOL_AMIGATXLT Amige assembly language format translator. [amiga-txlt] + +TOOL_ASN1_COMPILE ASN1 compiler. [asn1_compile] + +TOOL_AWK Pattern-directed scanning/processing language. [awk] + +TOOL_CAP_MKDB Create capability database. [cap_mkdb] + +TOOL_CAT Concatenate and print files. [cat] + +TOOL_CKSUM Display file checksums. [cksum] + +TOOL_COMPILE_ET Error table compiler. [compile_et] + +TOOL_CONFIG Build kernel compilation directories. [config] + +TOOL_CRUNCHGEN Generate crunched binary build environment. [crunchgen] + +TOOL_CTAGS Create a tags file. [ctags] + +TOOL_DB Manipulate db(3) databases. [db] + +TOOL_DISKLABEL Read and write disk pack label. [disklabel] + +TOOL_EQN Format equations for groff. [eqn] + +TOOL_FDISK MS-DOS partition maintenance program. [fdisk] + +TOOL_FGEN IEEE 1275 Open Firmware FCode Tokenizer. [fgen] + +TOOL_GENASSYM Generate constants for assembly files. [genassym] + +TOOL_GENCAT Generate NLS message catalogs. [gencat] + +TOOL_GMAKE GNU make utility. [gmake] + +TOOL_GREP Print lines matching a pattern. [grep] + +TOOL_GROFF Front end for groff document formatting system. [groff] + +TOOL_GZIP Compression/decompression tool. [gzip] + +TOOL_GZIP_N Same as TOOL_GZIP, plus a command line option to + prevent it from inserting file names or timestamps + into the compressed output. + [${TOOL_GZIP} ${GZIP_N_FLAG}] + +TOOL_HEXDUMP Ascii, decimal, hexadecimal, octal dump. [hexdump] + +TOOL_HP300MKBOOT Make bootable image for hp300. [hp300-mkboot] + +TOOL_HPPAMKBOOT Make bootable image for hppa. [hppa-mkboot] + +TOOL_INDXBIB Make bibliographic database's inverted index. [indxbib] + +TOOL_INSTALLBOOT Install disk bootstrap software. [installboot] + +TOOL_INSTALL_INFO Update info/dir entries. [install-info] + +TOOL_JOIN Relational database operator. [join] + +TOOL_M4 M4 macro language processor. [m4] + +TOOL_MACPPCFIXCOFF Fix up xcoff headers for macppc. [macppc-fixcoff] + +TOOL_MAKEFS Create file system image from directory tree. [makefs] + +TOOL_MAKEINFO Translate Texinfo documents. [makeinfo] + +TOOL_MAKEWHATIS Create a whatis.db database. [makewhatis] + +TOOL_MDSETIMAGE Set kernel RAM disk image. [mdsetimage] + +TOOL_MENUC Menu compiler. [menuc] + +TOOL_MIPSELF2ECOFF Convert ELF-format executable to ECOFF for mips. + [mips-elf2ecoff] + +TOOL_MKCSMAPPER Make charset mapping table. [mkcsmapper] + +TOOL_MKESDB Make encoding scheme database. [mkesdb] + +TOOL_MKLOCALE Make LC_CTYPE locale files. [mklocale] + +TOOL_MKMAGIC Create database for file(1). [file] + +TOOL_MKNOD Make device special file. [mknod] + +TOOL_MKTEMP Make (unique) temporary file name. [mktemp] + +TOOL_MSGC Simple message list compiler. [msgc] + +TOOL_MTREE Map a directory hierarchy. [mtree] + +TOOL_NCDCS Turn ELF kernel into a NCD firmware image. [ncdcs] + +TOOL_PAX Manipulate file archives and copy directories. [pax] + +TOOL_PIC Compile pictures for groff. [pic] + +TOOL_PIGZ Parallel compressor. [pigz] + +TOOL_POWERPCMKBOOTIMAGE Make bootable image for powerpc. [powerpc-mkbootimage] + +TOOL_PWD_MKDB Generate the password databases. [pwd_mkdb] + +TOOL_REFER Preprocess bibliographic references for groff. [refer] + +TOOL_ROFF_ASCII Generate ASCII groff output. [nroff] + +TOOL_ROFF_DVI Generate DVI groff output. [${TOOL_GROFF} -Tdvi] + +TOOL_ROFF_HTML Generate HTML groff output. + [${TOOL_GROFF} -Tlatin1 -mdoc2html] + +TOOL_ROFF_PS Generate PS groff output. [${TOOL_GROFF} -Tps] + +TOOL_ROFF_RAW Generate "raw" groff output. [${TOOL_GROFF} -Z] + +TOOL_RPCGEN Remote Procedure Call (RPC) protocol compiler. [rpcgen] + +TOOL_SED Stream editor. [sed] + +TOOL_SOELIM Eliminate .so's from groff input. [soelim] + +TOOL_SPARKCRC Generate a crc suitable for use in a sparkive file. + [sparkcrc] + +TOOL_STAT Display file status. [stat] + +TOOL_STRFILE Create a random access file for storing strings. + [strfile] + +TOOL_SUNLABEL Read or modify a SunOS disk label. [sunlabel] + +TOOL_TBL Format tables for groff. [tbl] + +TOOL_UUDECODE Uudecode a binary file. [uudecode] + +TOOL_VGRIND Grind nice listings of programs. [vgrind -f] + +TOOL_ZIC Time zone compiler. [zic] + +For each possible value of MACHINE_CPU, MACHINES.${MACHINE_CPU} contain a +list of what ports can be built for it. This keeps those definitions in +centralized place. + + is generally useful when building your own Makefiles so that +they use the same default owners etc. as the rest of the tree. + + +=-=-=-=-= bsd.clean.mk =-=-=-=-= + +The include file defines the clean and cleandir +targets. It uses the following variables: + +CLEANFILES Files to remove for both the clean and cleandir targets. + +CLEANDIRFILES Files to remove for the cleandir target, but not for + the clean target. + +MKCLEANSRC Controls whether or not the clean and cleandir targets + will delete files from both the object directory, + ${.OBJDIR}, and the source directory, ${.CURDIR}. + + If MKCLEANSRC is set to "no", then the file names in + CLEANFILES or CLEANDIRFILES are interpreted relative + to the object directory, ${.OBJDIR}. This is the + traditional behaviour. + + If MKCLEANSRC is set to "yes", then the file deletion + is performed relative to both the object directory, + ${.OBJDIR}, and the source directory, ${.CURDIR}. (This + has no effect if ${.OBJDIR} is the same as ${.CURDIR}.) + Deleting files from ${.CURDIR} is intended to remove + stray output files that had been left in the source + directory by an earlier build that did not use object + directories. + + The default is MKCLEANSRC=yes. If you always build with + separate object directories, and you are sure that there + are no stray files in the source directories, then you + may set MKCLEANSRC=no to save some time. + +MKCLEANVERIFY Controls whether or not the clean and cleandir targets + will verify that files have been deleted. + + If MKCLEANVERIFY is set to "no", then the files will + be deleted using a "rm -f" command, and its success or + failure will be ignored. + + If MKCLEANVERIFY is set to "yes", then the success of + the "rm -f" command will be verified using an "ls" + command. + + The default is MKCLEANVERIFY=yes. If you are sure that + there will be no problems caused by file permissions, + read-only file systems, or the like, then you may set + MKCLEANVERIFY=no to save some time. + +To use the clean and cleandir targets defined in , other +Makefiles or bsd.*.mk files should append file names to the CLEANFILES +or CLEANDIRFILES variables. For example: + + CLEANFILES+= a.out + CLEANDIRFILES+= .depend + + .include + +The files listed in CLEANFILES and CLEANDIRFILES must not be +directories, because the potential risk from running "rm -rf" commands +in bsd.clean.mk is considered too great. If you want to recursively +delete a directory as part of "make clean" or "make cleandir" then you +need to provide your own target. + +=-=-=-=-= bsd.dep.mk =-=-=-=-= + +The include file contains the default targets for building +.depend files. It creates .d files from entries in SRCS and DPSRCS +that are C, C++, or Objective C source files, and builds .depend from the +.d files. All other files in SRCS and all of DPSRCS will be used as +dependencies for the .d files. In order for this to function correctly, +it should be .included after all other .mk files and directives that may +modify SRCS or DPSRCS. It uses the following variables: + +SRCS List of source files to build the program. + +DPSRCS List of source files which are needed for generating + dependencies, but are not needed in ${SRCS}. + + +=-=-=-=-= bsd.files.mk =-=-=-=-= + +The include file handles the FILES variables and is included +from and , and uses the following variables: + +FILES The list of files to install. + +CONFIGFILES Similar semantics to FILES, except that the files + are installed by the `configinstall' target, + not the `install' target. + The FILES* variables documented below also apply. + +FILESOWN File owner. [${BINOWN}] + +FILESGRP File group. [${BINGRP}] + +FILESMODE File mode. [${NONBINMODE}] + +FILESDIR The location to install the files. + +FILESNAME Optional name to install each file as. + +FILESOWN_ File owner of the specific file . + +FILESGRP_ File group of the specific file . + +FILESMODE_ File mode of the specific file . + +FILESDIR_ The location to install the specific file . + +FILESNAME_ Optional name to install as. + +FILESBUILD If this variable is defined, then its value will be + used as the default for all FILESBUILD_ variables. + Otherwise, the default will be "no". + +FILESBUILD_ A value different from "no" will add the file to the list of + targets to be built by `realall'. Users of that variable + should provide a target to build the file. + + +BUILDSYMLINKS List of two word items: + lnsrc lntgt + For each lnsrc item, create a symlink named lntgt. + The lntgt symlinks are removed by the cleandir target. + +UUDECODE_FILES List of files which are stored as .uue in the source + tree. Each one will be decoded with ${TOOL_UUDECODE}. + The source files have a `.uue' suffix, the generated files do + not. + +UUDECODE_FILES_RENAME_ + Rename the output from the decode to the provided name. + + *NOTE: These files are simply decoded, with no install or other + rule applying implicitly except being added to the clean + target. + +=-=-=-=-= bsd.gcc.mk =-=-=-=-= + +The include file computes various parameters related to GCC +support libraries. It defines no targets. MUST be included +before . + +The primary users of are and , each +of which need to know where to find certain GCC support libraries. + +The behavior of is influenced by the EXTERNAL_TOOLCHAIN variable, +which is generally set by the user. If EXTERNAL_TOOLCHAIN it set, then +the compiler is asked where to find the support libraries, otherwise the +support libraries are found in ${DESTDIR}/usr/lib. + + sets the following variables: + +_GCC_CRTBEGIN The full path name to crtbegin.o. + +_GCC_CRTBEGINS The full path name to crtbeginS.o. + +_GCC_CRTEND The full path name to crtend.o. + +_GCC_CRTENDS The full path name to crtendS.o. + +_GCC_LIBGCCDIR The directory where libgcc.a is located. + + +=-=-=-=-= bsd.inc.mk =-=-=-=-= + +The include file defines the includes target and uses the +variables: + +INCS The list of include files. + +INCSDIR The location to install the include files. + +INCSNAME Target name of the include file, if only one; same as + FILESNAME, but for include files. + +INCSYMLINKS Similar to SYMLINKS in , except that these + are installed in the 'includes' target and not the + (much later) 'install' target. + +INCSNAME_ The name file should be installed as, if not , + same as FILESNAME_, but for include files. + + +=-=-=-=-= bsd.info.mk =-=-=-=-= + +The include file is used to generate and install GNU Info +documentation from respective Texinfo source files. It defines three +implicit targets (.txi.info, .texi.info, and .texinfo.info), and uses the +following variables: + +TEXINFO List of Texinfo source files. Info documentation will + consist of single files with the extension replaced by + .info. + +INFOFLAGS Flags to pass to makeinfo. [] + + +=-=-=-=-= bsd.kernobj.mk =-=-=-=-= + +The include file defines variables related to the +location of kernel sources and object directories. + +KERNSRCDIR Is the location of the top of the kernel src. + [${_SRC_TOP_}/sys] + +KERNARCHDIR Is the location of the machine dependent kernel sources. + [arch/${MACHINE}] + +KERNCONFDIR Is where the configuration files for kernels are found. + [${KERNSRCDIR}/${KERNARCHDIR}/conf] + +KERNOBJDIR Is the kernel build directory. The kernel GENERIC for + instance will be compiled in ${KERNOBJDIR}/GENERIC. + The default value is + ${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile + if it exists or the target 'obj' is being made. + Otherwise the default is + ${KERNSRCDIR}/${KERNARCHDIR}/compile. + +It is important that Makefiles (such as those under src/distrib) that +wish to find compiled kernels use and ${KERNOBJDIR} +rather than make assumptions about the location of the compiled kernel. + + +=-=-=-=-= bsd.kinc.mk =-=-=-=-= + +The include file defines the many targets (includes, +subdirectories, etc.), and is used by kernel makefiles to handle +include file installation. It is intended to be included alone, by +kernel Makefiles. It uses similar variables to . +Please see for more details, and keep the documentation +in that file up to date. + +=-=-=-=-= bsd.syscall.mk =-=-=-=-= + +The include file contains the logic to create syscall +files for various emulations. It includes to handle the +rest of the targets. + +=-=-=-=-= bsd.lib.mk =-=-=-=-= + +The include file has support for building libraries. It has +the same eight targets as : all, clean, cleandir, depend, +includes, install, lint, and tags. Additionally, it has a checkver target +which checks for installed shared object libraries whose version is greater +that the version of the source. It has a limited number of suffixes, +consistent with the current needs of the BSD tree. includes + to get shared library parameters. + +It sets/uses the following variables: + +LIB The name of the library to build. + +LIBDIR Target directory for libraries. + +MKARZERO Normally, ar(1) sets the timestamps, uid, gid and + permissions in files inside its archives to those of + the file it was fed. This leads to non-reproduceable + builds. If MKARZERO is set to "yes" (default is the + same as MKREPRO, or "no" if MKREPRO is not defined), + then the "D" flag is passed to ar, causing the + timestamp, uid and gid to be zeroed and the file + permissions to be set to 644. This allows .a files + from different builds to be bit identical. + +SHLIBINSTALLDIR Target directory for shared libraries if ${USE_SHLIBDIR} + is not "no". + +SHLIB_MAJOR +SHLIB_MINOR +SHLIB_TEENY Major, minor, and teeny version numbers of shared library + +USE_SHLIBDIR If not "no", use ${SHLIBINSTALLDIR} instead of ${LIBDIR} + as the path to install shared libraries to. + USE_SHLIBDIR must be defined before is included. + Default: no + +LIBISMODULE If not "no", install as ${LIB}.so (without the "lib" prefix), + and act as "MKDEBUGLIB=no MKLINT=no MKPICINSTALL=no + MKPROFILE=no MKSTATICLIB=no". + Default: no + +LIBISPRIVATE If not "no", act as "MKDEBUGLIB=no MKLINT=no MKPIC=no + MKPROFILE=no", and don't install the (.a) library. + This is useful for "build only" helper libraries. + Default: no + +LIBISCXX If not "no", Use ${CXX} instead of ${CC} to link + shared libraries. + This is useful for C++ libraries. + Default: no + +LINTLIBDIR Target directory for lint libraries. + +LIBGRP Library group. + +LIBOWN Library owner. + +LIBMODE Library mode. + +LDADD Additional loader objects. + +MAN The manual pages to be installed (use a .1 - .9 suffix). + +NOCHECKVER_ +NOCHECKVER If set, disables checking for installed shared object + libraries with versions greater than the source. A + particular library name, without the "lib" prefix, may + be appended to the variable name to disable the check for + only that library. + +SRCS List of source files to build the library. Suffix types + .s, .c, and .f are supported. Note, .s files are preferred + to .c files of the same name. (This is not the default for + versions of make.) + +LIBDPLIBS A list of the tuples: + libname path-to-srcdir-of-libname + + For each tuple; + * LIBDO.libname contains the .OBJDIR of the library + `libname', and if it is not set it is determined + from the srcdir and added to MAKEOVERRIDES (the + latter is to allow for build time optimization). + * LDADD gets -L${LIBDO.libname} -llibname added. + * DPADD gets ${LIBDO.libname}/liblibname.so or + ${LIBDO.libname}/liblibname.a added. + + The special value "_external" for LIBDO.lib makes the + build system to assume the library comes from outside + of the NetBSD source tree and only causes -llibname + to be added to LDADD. + + This variable may be used for individual libraries, as + well as in parent directories to cache common libraries + as a build-time optimization. + +The include file includes the file named "../Makefile.inc" +if it exists, as well as the include file . + +It has rules for building profiled objects; profiled libraries are +built by default. + +Libraries are ranlib'd when made. + + +=-=-=-=-= bsd.links.mk =-=-=-=-= + +The include file handles the LINKS and SYMLINKS variables +and is included from from and . + +LINKSOWN, LINKSGRP, and LINKSMODE, are relevant only if a metadata log +is used. The defaults may be modified by other bsd.*.mk files which +include bsd.links.mk. In the future, these variables may be replaced +by a method for explicitly recording hard links in a metadata log. + +LINKS The list of hard links, consisting of pairs of paths: + source-file target-file + ${DESTDIR} is prepended to both paths before linking. + For example, to link /bin/test and /bin/[, use: + LINKS=/bin/test /bin/[ + +CONFIGLINKS Similar semantics to LINKS, except that the links + are installed by the `configinstall' target, + not the `install' target. + +SYMLINKS The list of symbolic links, consisting of pairs of paths: + source-file target-file + ${DESTDIR} is only prepended to target-file before linking. + For example, to symlink /usr/bin/tar to /bin/tar resulting + in ${DESTDIR}/usr/bin/tar -> /bin/tar: + SYMLINKS=/bin/tar /usr/bin/tar + +CONFIGSYMLINKS Similar semantics to SYMLINKS, except that the symbolic links + are installed by the `configinstall' target, + not the `install' target. + +LINKSOWN Link owner. [${BINOWN}] + +LINKSGRP Link group. [${BINGRP}] + +LINKSMODE Link mode. [${NONBINMODE}] + +LINKSOWN_ Link owner of the specific file . + +LINKSGRP_ Link group of the specific file . + +LINKSMODE_ Link mode of the specific file . + + +=-=-=-=-= bsd.man.mk =-=-=-=-= + +The include file handles installing manual pages and their +links. + +It has a three targets: + + catinstall: + Install the preformatted manual pages and their links. + htmlinstall: + Install the HTML manual pages and their links. + maninstall: + Install the manual page sources and their links. + +It sets/uses the following variables: + +MANDIR Base path for manual installation. + +MANGRP Manual group. + +MANOWN Manual owner. + +MANMODE Manual mode. + +MANSUBDIR Subdirectory under the manual page section, i.e. "/vax" + or "/tahoe" for machine specific manual pages. + +MAN The manual pages to be installed (use a .1 - .9 suffix). + +MLINKS List of manual page links (using a .1 - .9 suffix). The + linked-to file must come first, the linked file second, + and there may be multiple pairs. + +The include file includes a file named "../Makefile.inc" if +it exists. + + +=-=-=-=-= bsd.obj.mk =-=-=-=-= + +The include file defines targets related to the creation +and use of separated object and source directories. + +If an environment variable named MAKEOBJDIRPREFIX is set, make(1) uses +${MAKEOBJDIRPREFIX}${.CURDIR} as the name of the object directory if +it exists. Otherwise make(1) looks for the existence of a +subdirectory (or a symlink to a directory) of the source directory +into which built targets should be placed. If an environment variable +named MAKEOBJDIR is set, make(1) uses its value as the name of the +object directory; failing that, make first looks for a subdirectory +named "obj.${MACHINE}", and if that doesn't exist, it looks for "obj". + +Object directories are not created automatically by make(1) if they +don't exist; you need to run a separate "make obj". (This will happen +during a top-level build if "MKOBJDIRS" is set to a value other than +"no"). When the source directory is a subdirectory of ${BSDSRCDIR} -- +and this is determined by a simple string prefix comparison -- object +directories are created in a separate object directory tree, and a +symlink to the object directory in that tree is created in the source +directory; otherwise, "make obj" assumes that you're not in the main +source tree and that it's not safe to use a separate object tree. + +Several variables used by control exactly what +directories and links get created during a "make obj": + +MAKEOBJDIR If set, this is the component name of the object + directory. + +OBJMACHINE If this is set but MAKEOBJDIR is not set, creates + object directories or links named "obj.${MACHINE}"; + otherwise, just creates ones named "obj". + +USR_OBJMACHINE If set, and the current directory is a subdirectory of + ${BSDSRCDIR}, create object directory in the + corresponding subdirectory of ${BSDOBJDIR}.${MACHINE}; + otherwise, create it in the corresponding subdirectory + of ${BSDOBJDIR} + +BUILDID If set, the contents of this variable are appended + to the object directory name. If OBJMACHINE is also + set, ".${BUILDID}" is added after ".${MACHINE}". + + +=-=-=-=-= bsd.prog.mk =-=-=-=-= + +The include file handles building programs from one or +more source files, along with their manual pages. It has a limited number +of suffixes, consistent with the current needs of the BSD tree. + includes to get shared library parameters. + +It has eight targets: + + all: + build the program and its manual page. This also + creates a GDB initialization file (.gdbinit) in + the objdir. The .gdbinit file sets the shared library + prefix to ${DESTDIR} to facilitate cross-debugging. + clean: + remove the program, any object files and the files a.out, + Errs, errs, mklog, and ${PROG}.core. + cleandir: + remove all of the files removed by the target clean, as + well as .depend, tags, and any manual pages. + `distclean' is a synonym for `cleandir'. + depend: + make the dependencies for the source files, and store + them in the file .depend. + includes: + install any header files. + install: + install the program and its manual pages; if the Makefile + does not itself define the target install, the targets + beforeinstall and afterinstall may also be used to cause + actions immediately before and after the install target + is executed. + lint: + run lint on the source files + tags: + create a tags file for the source files. + +It sets/uses the following variables: + +BINGRP Binary group. + +BINOWN Binary owner. + +BINMODE Binary mode. + +CLEANDIRFILES Additional files to remove for the cleandir target. + +CLEANFILES Additional files to remove for the clean and cleandir targets. + +CONFIGOPTS Additional flags to config(1) when building kernels. + +COPTS Additional flags to the compiler when creating C objects. + +COPTS. Additional flags to the compiler when creating the + C objects for . + For .[ly], ".c" must be used. + +CPUFLAGS Additional flags to the compiler/assembler to select + CPU instruction set options, CPU tuning options, etc. + +CPUFLAGS. Additional flags to the compiler/assembler for . + For .[ly], ".c" must be used. + +CPPFLAGS Additional flags to the C pre-processor. + +CPPFLAGS. Additional flags to the C pre-processor for . + For .[ly], ".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. + +LDADD Additional loader objects. Usually used for libraries. + For example, to load with the compatibility and utility + libraries, use: + + LDADD+=-lutil -lcompat + +LDFLAGS Additional linker flags (passed to ${CC} during link). + +LINKS See + +OBJCOPTS Additional flags to the compiler when creating ObjC objects. + +OBJCOPTS. Additional flags to the compiler when creating the + ObjC objects for . + For .[ly], ".c" must be used. + +SYMLINKS See + +MAN Manual pages (should end in .1 - .9). If no MAN variable is + defined, "MAN=${PROG}.1" is assumed. + +PAXCTL_FLAGS If defined, run paxctl(1) on the program binary after link + time, with the value of this variable as args to paxctl(1). + +PAXCTL_FLAGS.${PROG} Custom override for PAXCTL_FLAGS. + +PROG The name of the program to build. If not supplied, nothing + is built. + +PROG_CXX If defined, the name of the program to build. Also + causes to link the program with the C++ + compiler rather than the C compiler. PROG_CXX overrides + the value of PROG if PROG is also set. + +PROGNAME The name that the above program will be installed as, if + different from ${PROG}. + +SRCS List of source files to build the program. If SRCS is not + defined, it's assumed to be ${PROG}.c. + +DPSRCS List of source files which are needed for generating + dependencies, but are not needed in ${SRCS}. + +DPADD Additional dependencies for the program. Usually used for + libraries. For example, to depend on the compatibility and + utility libraries use: + + DPADD+=${LIBCOMPAT} ${LIBUTIL} + + The following system libraries are predefined for DPADD: + + LIBARCHIVE?= ${DESTDIR}/usr/lib/libarchive.a + LIBASN1?= ${DESTDIR}/usr/lib/libasn1.a + LIBATF_C?= ${DESTDIR}/usr/lib/libatf-c.a + LIBATF_CXX?= ${DESTDIR}/usr/lib/libatf-c++.a + LIBBIND9?= ${DESTDIR}/usr/lib/libbind9.a + LIBBLUETOOTH?= ${DESTDIR}/usr/lib/libbluetooth.a + LIBBSDMALLOC?= ${DESTDIR}/usr/lib/libbsdmalloc.a + LIBBZ2?= ${DESTDIR}/usr/lib/libbz2.a + LIBC?= ${DESTDIR}/usr/lib/libc.a + LIBCOMPAT?= ${DESTDIR}/usr/lib/libcompat.a + LIBCOM_ERR?= ${DESTDIR}/usr/lib/libcom_err.a + LIBCRT0?= ${DESTDIR}/usr/lib/crt0.o + LIBCRTI?= ${DESTDIR}/usr/lib/crti.o + LIBCRYPT?= ${DESTDIR}/usr/lib/libcrypt.a + LIBCRYPTO?= ${DESTDIR}/usr/lib/libcrypto.a + LIBCRYPTO_IDEA?=${DESTDIR}/usr/lib/libcrypto_idea.a + LIBCRYPTO_MDC2?=${DESTDIR}/usr/lib/libcrypto_mdc2.a + LIBCRYPTO_RC5?= ${DESTDIR}/usr/lib/libcrypto_rc5.a + LIBCURSES?= ${DESTDIR}/usr/lib/libcurses.a + LIBC_PIC?= ${DESTDIR}/usr/lib/libc_pic.a + LIBDBM?= ${DESTDIR}/usr/lib/libdbm.a + LIBDES?= ${DESTDIR}/usr/lib/libdes.a + LIBDNS?= ${DESTDIR}/usr/lib/libdns.a + LIBEDIT?= ${DESTDIR}/usr/lib/libedit.a + LIBEVENT?= ${DESTDIR}/usr/lib/libevent.a + LIBEVENT_OPENSSL?= ${DESTDIR}/usr/lib/libevent_openssl.a + LIBEVENT_PTHREADS?= ${DESTDIR}/usr/lib/libevent_pthreads.a + LIBEXPAT?= ${DESTDIR}/usr/lib/libexpat.a + LIBFETCH?= ${DESTDIR}/usr/lib/libfetch.a + LIBFORM?= ${DESTDIR}/usr/lib/libform.a + LIBFL?= ${DESTDIR}/usr/lib/libfl.a + LIBG2C?= ${DESTDIR}/usr/lib/libg2c.a + LIBGCC?= ${DESTDIR}/usr/lib/libgcc.a + LIBGNUMALLOC?= ${DESTDIR}/usr/lib/libgnumalloc.a + LIBGSSAPI?= ${DESTDIR}/usr/lib/libgssapi.a + LIBHDB?= ${DESTDIR}/usr/lib/libhdb.a + LIBHEIMBASE?= ${DESTDIR}/usr/lib/libheimbase.a + LIBHEIMNTLM?= ${DESTDIR}/usr/lib/libheimntlm.a + LIBHX500?= ${DESTDIR}/usr/lib/libhx500.a + LIBINTL?= ${DESTDIR}/usr/lib/libintl.a + LIBIPSEC?= ${DESTDIR}/usr/lib/libipsec.a + LIBISC?= ${DESTDIR}/usr/lib/libisc.a + LIBISCCC?= ${DESTDIR}/usr/lib/libisccc.a + LIBISCFG?= ${DESTDIR}/usr/lib/libiscfg.a + LIBKADM5CLNT?= ${DESTDIR}/usr/lib/libkadm5clnt.a + LIBKADM5SRV?= ${DESTDIR}/usr/lib/libkadm5srv.a + LIBKAFS?= ${DESTDIR}/usr/lib/libkafs.a + LIBKRB5?= ${DESTDIR}/usr/lib/libkrb5.a + LIBKVM?= ${DESTDIR}/usr/lib/libkvm.a + LIBL?= ${DESTDIR}/usr/lib/libl.a + LIBLBER?= ${DESTDIR}/usr/lib/liblber.a + LIBLDAP?= ${DESTDIR}/usr/lib/libldap.a + LIBLDAP_R?= ${DESTDIR}/usr/lib/libldap_r.a + LIBLUA?= ${DESTDIR}/usr/lib/liblua.a + LIBLUTOK?= ${DESTDIR}/usr/lib/liblutok.a + LIBLWRES?= ${DESTDIR}/usr/lib/liblwres.a + LIBM?= ${DESTDIR}/usr/lib/libm.a + LIBMAGIC?= ${DESTDIR}/usr/lib/libmagic.a + LIBMENU?= ${DESTDIR}/usr/lib/libmenu.a + LIBOBJC?= ${DESTDIR}/usr/lib/libobjc.a + LIBOSSAUDIO?= ${DESTDIR}/usr/lib/libossaudio.a + LIBPAM?= ${DESTDIR}/usr/lib/libpam.a + LIBPCAP?= ${DESTDIR}/usr/lib/libpcap.a + LIBPCI?= ${DESTDIR}/usr/lib/libpci.a + LIBPMC?= ${DESTDIR}/usr/lib/libpmc.a + LIBPOSIX?= ${DESTDIR}/usr/lib/libposix.a + LIBPTHREAD?= ${DESTDIR}/usr/lib/libpthread.a + LIBPTHREAD_DBG?=${DESTDIR}/usr/lib/libpthread_dbg.a + LIBPUFFS?= ${DESTDIR}/usr/lib/libpuffs.a + LIBQUOTA?= ${DESTDIR}/usr/lib/libquota.a + LIBRADIUS?= ${DESTDIR}/usr/lib/libradius.a + LIBRESOLV?= ${DESTDIR}/usr/lib/libresolv.a + LIBRMT?= ${DESTDIR}/usr/lib/librmt.a + LIBROKEN?= ${DESTDIR}/usr/lib/libroken.a + LIBRPCSVC?= ${DESTDIR}/usr/lib/librpcsvc.a + LIBRT?= ${DESTDIR}/usr/lib/librt.a + LIBRUMP?= ${DESTDIR}/usr/lib/librump.a + LIBRUMPFS_CD9660FS?=${DESTDIR}/usr/lib/librumpfs_cd9660fs.a + LIBRUMPFS_EFS?= ${DESTDIR}/usr/lib/librumpfs_efs.a + LIBRUMPFS_EXT2FS?=${DESTDIR}/usr/lib/librumpfs_ext2fs.a + LIBRUMPFS_FFS?= ${DESTDIR}/usr/lib/librumpfs_ffs.a + LIBRUMPFS_HFS?= ${DESTDIR}/usr/lib/librumpfs_hfs.a + LIBRUMPFS_LFS?= ${DESTDIR}/usr/lib/librumpfs_lfs.a + LIBRUMPFS_MSDOSFS?=${DESTDIR}/usr/lib/librumpfs_msdosfs.a + LIBRUMPFS_NFS?= ${DESTDIR}/usr/lib/librumpfs_nfs.a + LIBRUMPFS_NTFS?=${DESTDIR}/usr/lib/librumpfs_ntfs.a + LIBRUMPFS_SYSPUFFS?=${DESTDIR}/usr/lib/librumpfs_syspuffs.a + LIBRUMPFS_TMPFS?=${DESTDIR}/usr/lib/librumpfs_tmpfs.a + LIBRUMPFS_UDF?= ${DESTDIR}/usr/lib/librumpfs_udf.a + LIBRUMPFS_UFS?= ${DESTDIR}/usr/lib/librumpfs_ufs.a + LIBRUMPUSER?= ${DESTDIR}/usr/lib/librumpuser.a + LIBSASLC?= ${DESTDIR}/usr/lib/libsaslc.a + LIBSKEY?= ${DESTDIR}/usr/lib/libskey.a + LIBSL?= ${DESTDIR}/usr/lib/libsl.a + LIBSQLITE3?= ${DESTDIR}/usr/lib/libsqlite3.a + LIBSS?= ${DESTDIR}/usr/lib/libss.a + LIBSSH?= ${DESTDIR}/usr/lib/libssh.a + LIBSSL?= ${DESTDIR}/usr/lib/libssl.a + LIBSSP?= ${DESTDIR}/usr/lib/libssp.a + LIBSTDCXX?= ${DESTDIR}/usr/lib/libstdc++.a + LIBSUPCXX?= ${DESTDIR}/usr/lib/libsupc++.a + LIBTERMINFO?= ${DESTDIR}/usr/lib/libterminfo.a + LIBTRE?= ${DESTDIR}/usr/lib/libtre.a + LIBUSBHID?= ${DESTDIR}/usr/lib/libusbhid.a + LIBUTIL?= ${DESTDIR}/usr/lib/libutil.a + LIBWIND?= ${DESTDIR}/usr/lib/libwind.a + LIBWRAP?= ${DESTDIR}/usr/lib/libwrap.a + LIBY?= ${DESTDIR}/usr/lib/liby.a + LIBZ?= ${DESTDIR}/usr/lib/libz.a + + The following X-Windows libraries are predefined for DPADD: + + LIBFS?= ${DESTDIR}/usr/X11R7/lib/libFS.a + LIBGL?= ${DESTDIR}/usr/X11R7/lib/libGL.a + LIBGLU?= ${DESTDIR}/usr/X11R7/lib/libGLU.a + LIBICE?= ${DESTDIR}/usr/X11R7/lib/libICE.a + LIBSM?= ${DESTDIR}/usr/X11R7/lib/libSM.a + LIBX11?= ${DESTDIR}/usr/X11R7/lib/libX11.a + LIBX11_XCB?= ${DESTDIR}/usr/X11R7/lib/libX11-xcb.a + LIBXTRAP?= ${DESTDIR}/usr/X11R7/lib/libXTrap.a + LIBXAU?= ${DESTDIR}/usr/X11R7/lib/libXau.a + LIBXAW?= ${DESTDIR}/usr/X11R7/lib/libXaw.a + LIBXCB?= ${DESTDIR}/usr/X11R7/lib/libxcb.a + LIBXDMCP?= ${DESTDIR}/usr/X11R7/lib/libXdmcp.a + LIBXEXT?= ${DESTDIR}/usr/X11R7/lib/libXext.a + LIBXFONT?= ${DESTDIR}/usr/X11R7/lib/libXfont.a + LIBXFT?= ${DESTDIR}/usr/X11R7/lib/libXft.a + LIBXI?= ${DESTDIR}/usr/X11R7/lib/libXi.a + LIBXINERAMA?= ${DESTDIR}/usr/X11R7/lib/libXinerama.a + LIBXMU?= ${DESTDIR}/usr/X11R7/lib/libXmu.a + LIBXMUU?= ${DESTDIR}/usr/X11R7/lib/libXmuu.a + LIBXPM?= ${DESTDIR}/usr/X11R7/lib/libXpm.a + LIBXRANDR?= ${DESTDIR}/usr/X11R7/lib/libXrandr.a + LIBXRENDER?= ${DESTDIR}/usr/X11R7/lib/libXrender.a + LIBXSS?= ${DESTDIR}/usr/X11R7/lib/libXss.a + LIBXT?= ${DESTDIR}/usr/X11R7/lib/libXt.a + LIBXTST?= ${DESTDIR}/usr/X11R7/lib/libXtst.a + LIBXV?= ${DESTDIR}/usr/X11R7/lib/libXv.a + LIBXXF86DGA?= ${DESTDIR}/usr/X11R7/lib/libXxf86dga.a + LIBXXF86MISC?= ${DESTDIR}/usr/X11R7/lib/libXxf86misc.a + LIBXXF86VM?= ${DESTDIR}/usr/X11R7/lib/libXxf86vm.a + LIBDPS?= ${DESTDIR}/usr/X11R7/lib/libdps.a + LIBFNTSTUBS?= ${DESTDIR}/usr/X11R7/lib/libfntstubs.a + LIBFONTCACHE?= ${DESTDIR}/usr/X11R7/lib/libfontcache.a + LIBFONTCONFIG?= ${DESTDIR}/usr/X11R7/lib/libfontconfig.a + LIBFONTENC?= ${DESTDIR}/usr/X11R7/lib/libfontenc.a + LIBFREETYPE?= ${DESTDIR}/usr/X11R7/lib/libfreetype.a + LIBLBXUTIL?= ${DESTDIR}/usr/X11R7/lib/liblbxutil.a + LIBXKBFILE?= ${DESTDIR}/usr/X11R7/lib/libxkbfile.a + +SHAREDSTRINGS If defined, a new .c.o rule is used that results in shared + strings, using xstr(1). Note that this will not work with + parallel makes. + +STRIPFLAG The flag passed to the install program to cause the binary + to be stripped. + +SUBDIR A list of subdirectories that should be built as well. + Each of the targets will execute the same target in the + subdirectories. + +SCRIPTS A list of interpreter scripts [file.{sh,csh,pl,awk,...}]. + These are installed exactly like programs. + +SCRIPTSDIR The location to install the scripts. Each script can be + installed to a separate path by setting SCRIPTSDIR_