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