1# $OpenBSD: bsd.own.mk,v 1.213 2022/07/12 21:01:37 jca Exp $ 2# $NetBSD: bsd.own.mk,v 1.24 1996/04/13 02:08:09 thorpej Exp $ 3 4# Host-specific overrides 5.if defined(MAKECONF) && exists(${MAKECONF}) 6.include "${MAKECONF}" 7.elif exists(/etc/mk.conf) 8.include "/etc/mk.conf" 9.endif 10 11# Set `WARNINGS' to `yes' to add appropriate warnings to each compilation 12WARNINGS?= no 13# Set `SKEY' to `yes' to build with support for S/key authentication. 14SKEY?= yes 15# Set `YP' to `yes' to build with support for NIS/YP. 16YP?= yes 17 18CLANG_ARCH=aarch64 amd64 arm i386 mips64 mips64el powerpc powerpc64 riscv64 sparc64 19GCC4_ARCH=alpha hppa sh sparc64 20GCC3_ARCH=m88k 21LLD_ARCH=aarch64 amd64 arm i386 powerpc powerpc64 riscv64 22LLDB_ARCH=aarch64 amd64 23 24# m88k: ? 25PIE_ARCH=aarch64 alpha amd64 arm hppa i386 mips64 mips64el powerpc powerpc64 riscv64 sh sparc64 26STATICPIE_ARCH=aarch64 alpha amd64 arm hppa i386 mips64 mips64el powerpc powerpc64 riscv64 sh sparc64 27 28.for _arch in ${MACHINE_ARCH} 29.if !empty(GCC3_ARCH:M${_arch}) 30COMPILER_VERSION?=gcc3 31.elif !empty(GCC4_ARCH:M${_arch}) 32COMPILER_VERSION?=gcc4 33.elif !empty(CLANG_ARCH:M${_arch}) 34COMPILER_VERSION?=clang 35.endif 36 37.if !empty(GCC3_ARCH:M${_arch}) 38BUILD_GCC3?=yes 39.else 40BUILD_GCC3?=no 41.endif 42.if !empty(GCC4_ARCH:M${_arch}) 43BUILD_GCC4?=yes 44.else 45BUILD_GCC4?=no 46.endif 47.if !empty(CLANG_ARCH:M${_arch}) 48BUILD_CLANG?=yes 49.else 50BUILD_CLANG?=no 51.endif 52 53.if !empty(LLD_ARCH:M${_arch}) 54LINKER_VERSION?=lld 55AR_VERSION?=llvm 56.else 57LINKER_VERSION?=bfd 58AR_VERSION?=binutils 59.endif 60 61.if !empty(LLDB_ARCH:M${_arch}) 62BUILD_LLDB?=yes 63.else 64BUILD_LLDB?=no 65.endif 66 67.if !empty(STATICPIE_ARCH:M${_arch}) 68STATICPIE?=-pie 69.endif 70 71# Executables are always PIC on mips64. 72# Do not pass -fno-pie to the compiler because clang does not accept it. 73.if ${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el" 74NOPIE_FLAGS?= 75.endif 76 77.if !empty(PIE_ARCH:M${_arch}) 78NOPIE_FLAGS?=-fno-pie 79NOPIE_LDFLAGS?=-nopie 80PIE_DEFAULT?=${DEFAULT_PIE_DEF} 81.else 82NOPIE_FLAGS?= 83PIE_DEFAULT?= 84.endif 85.endfor 86 87# where the system object and source trees are kept; can be configurable 88# by the user in case they want them in ~/foosrc and ~/fooobj, for example 89BSDSRCDIR?= /usr/src 90BSDOBJDIR?= /usr/obj 91 92BINGRP?= bin 93BINOWN?= root 94BINMODE?= 555 95NONBINMODE?= 444 96DIRMODE?= 755 97 98SHAREDIR?= /usr/share 99SHAREGRP?= bin 100SHAREOWN?= root 101SHAREMODE?= ${NONBINMODE} 102 103MANDIR?= /usr/share/man/man 104MANGRP?= bin 105MANOWN?= root 106MANMODE?= ${NONBINMODE} 107 108LIBDIR?= /usr/lib 109LIBGRP?= ${BINGRP} 110LIBOWN?= ${BINOWN} 111LIBMODE?= ${NONBINMODE} 112 113DOCDIR?= /usr/share/doc 114DOCGRP?= bin 115DOCOWN?= root 116DOCMODE?= ${NONBINMODE} 117 118LOCALEDIR?= /usr/share/locale 119LOCALEGRP?= wheel 120LOCALEOWN?= root 121LOCALEMODE?= ${NONBINMODE} 122 123.if !defined(CDIAGFLAGS) 124CDIAGFLAGS= -Wall -Wpointer-arith -Wuninitialized -Wstrict-prototypes 125CDIAGFLAGS+= -Wmissing-prototypes -Wunused -Wsign-compare 126CDIAGFLAGS+= -Wshadow 127. if ${COMPILER_VERSION} == "gcc4" 128CDIAGFLAGS+= -Wdeclaration-after-statement 129. endif 130.endif 131 132# Shared files for system gnu configure, not used yet 133GNUSYSTEM_AUX_DIR?=${BSDSRCDIR}/share/gnu 134 135INSTALL_COPY?= -c 136.ifndef DEBUG 137INSTALL_STRIP?= -s 138.endif 139 140STATIC?= -static ${STATICPIE} 141 142# Define SYS_INCLUDE to indicate whether you want symbolic links to the system 143# source (``symlinks''), or a separate copy (``copies''); (latter useful 144# in environments where it's not possible to keep /sys publicly readable) 145#SYS_INCLUDE= symlinks 146 147# pic relocation flags. 148.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "powerpc" || \ 149 ${MACHINE_ARCH} == "sparc64" 150PICFLAG?=-fPIC 151.else 152PICFLAG?=-fpic 153.endif 154 155.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "powerpc" || \ 156 ${MACHINE_ARCH} == "sparc64" 157# big PIE 158DEFAULT_PIE_DEF=-DPIE_DEFAULT=2 159.else 160# small pie 161DEFAULT_PIE_DEF=-DPIE_DEFAULT=1 162.endif 163 164# don't try to generate PROFILED versions of libraries on machines 165# which don't support profiling. 166.if 0 167NOPROFILE= 168.endif 169 170BUILDUSER?= build 171WOBJGROUP?= wobj 172WOBJUMASK?= 007 173 174BSD_OWN_MK=Done 175 176.PHONY: spell clean cleandir obj manpages print all \ 177 depend beforedepend afterdepend cleandepend subdirdepend \ 178 all cleanman includes \ 179 beforeinstall realinstall maninstall afterinstall install 180