13585b293SGarrett Wollman# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 27f3dea24SPeter Wemm# $FreeBSD$ 3afe61c15SRodney W. Grimes 42bdaf7e8SRuslan Ermilov.include <bsd.init.mk> 5bd871f14SWarner Losh.include <bsd.compiler.mk> 6e5c6deceSEd Maste.include <bsd.linker.mk> 7afe61c15SRodney W. Grimes 8e4195e2eSJonathan Anderson.SUFFIXES: .out .o .bc .c .cc .cpp .cxx .C .m .y .l .ll .ln .s .S .asm 9afe61c15SRodney W. Grimes 1048aea4daSRuslan Ermilov# XXX The use of COPTS in modern makefiles is discouraged. 1141f89315SRuslan Ermilov.if defined(COPTS) 129b8d26fdSBryan Drewery.warning ${.CURDIR}: COPTS should be CFLAGS. 1341f89315SRuslan ErmilovCFLAGS+=${COPTS} 1441f89315SRuslan Ermilov.endif 1541f89315SRuslan Ermilov 164df1f59eSWarner Losh.if ${MK_ASSERT_DEBUG} == "no" 174df1f59eSWarner LoshCFLAGS+= -DNDEBUG 187fa2f2a6SAlex Richardson# XXX: shouldn't we ensure that !asserts marks potentially unused variables as 197fa2f2a6SAlex Richardson# __unused instead of disabling -Werror globally? 207fa2f2a6SAlex RichardsonMK_WERROR= no 214df1f59eSWarner Losh.endif 224df1f59eSWarner Losh 2341f89315SRuslan Ermilov.if defined(DEBUG_FLAGS) 2441f89315SRuslan ErmilovCFLAGS+=${DEBUG_FLAGS} 258eba8cd8SMarcel MoolenaarCXXFLAGS+=${DEBUG_FLAGS} 26770ac3b2SJohn Birrell 2783cb5baeSMax Khon.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != "" 28770ac3b2SJohn BirrellCTFFLAGS+= -g 29770ac3b2SJohn Birrell.endif 3041f89315SRuslan Ermilov.endif 3141f89315SRuslan Ermilov 3242f8c5b5SEd Maste.if defined(PROG_CXX) 3342f8c5b5SEd MastePROG= ${PROG_CXX} 3442f8c5b5SEd Maste.endif 3542f8c5b5SEd Maste 366e521732SEd Maste.if !empty(LDFLAGS:M-Wl,*--oformat,*) || !empty(LDFLAGS:M-static) 3742f8c5b5SEd MasteMK_DEBUG_FILES= no 3842f8c5b5SEd Maste.endif 3942f8c5b5SEd Maste 40bf81eb3cSEd Maste# ELF hardening knobs 41bf81eb3cSEd Maste.if ${MK_BIND_NOW} != "no" 42bf81eb3cSEd MasteLDFLAGS+= -Wl,-znow 43bf81eb3cSEd Maste.endif 448e1e3e1cSEd Maste.if ${MK_PIE} != "no" 458e1e3e1cSEd Maste# Static PIE is not yet supported/tested. 468e1e3e1cSEd Maste.if !defined(NO_SHARED) || ${NO_SHARED:tl} == "no" 47bcf99d2dSEd MasteCFLAGS+= -fPIE 48bcf99d2dSEd MasteCXXFLAGS+= -fPIE 49bcf99d2dSEd MasteLDFLAGS+= -pie 50bcf99d2dSEd Maste.endif 518e1e3e1cSEd Maste.endif 52fc191b11SEd Maste.if ${MK_RETPOLINE} != "no" 53e5c6deceSEd Maste.if ${COMPILER_FEATURES:Mretpoline} && ${LINKER_FEATURES:Mretpoline} 54fc191b11SEd MasteCFLAGS+= -mretpoline 55fc191b11SEd MasteCXXFLAGS+= -mretpoline 5614608708SEd Maste# retpolineplt is broken with static linking (PR 233336) 57447b492eSEd Maste.if !defined(NO_SHARED) || ${NO_SHARED:tl} == "no" 58fc191b11SEd MasteLDFLAGS+= -Wl,-zretpolineplt 59fc191b11SEd Maste.endif 60e5c6deceSEd Maste.else 61e5c6deceSEd Maste.warning Retpoline requested but not supported by compiler or linker 62e5c6deceSEd Maste.endif 6314608708SEd Maste.endif 64fc191b11SEd Maste 65e268fd0aSBrooks Davis# Initialize stack variables on function entry 66e268fd0aSBrooks Davis.if ${MK_INIT_ALL_ZERO} == "yes" 67e268fd0aSBrooks Davis.if ${COMPILER_FEATURES:Minit-all} 68e268fd0aSBrooks DavisCFLAGS+= -ftrivial-auto-var-init=zero \ 69e268fd0aSBrooks Davis -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang 70e268fd0aSBrooks DavisCXXFLAGS+= -ftrivial-auto-var-init=zero \ 71e268fd0aSBrooks Davis -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang 72e268fd0aSBrooks Davis.else 73e268fd0aSBrooks Davis.warning InitAll (zeros) requested but not support by compiler 74e268fd0aSBrooks Davis.endif 75e268fd0aSBrooks Davis.elif ${MK_INIT_ALL_PATTERN} == "yes" 76e268fd0aSBrooks Davis.if ${COMPILER_FEATURES:Minit-all} 77e268fd0aSBrooks DavisCFLAGS+= -ftrivial-auto-var-init=pattern 78e268fd0aSBrooks DavisCXXFLAGS+= -ftrivial-auto-var-init=pattern 79e268fd0aSBrooks Davis.else 80e268fd0aSBrooks Davis.warning InitAll (pattern) requested but not support by compiler 81e268fd0aSBrooks Davis.endif 82e268fd0aSBrooks Davis.endif 83e268fd0aSBrooks Davis 84428a32edSAlex Richardson# bsd.sanitizer.mk is not installed, so don't require it (e.g. for ports). 85428a32edSAlex Richardson.sinclude "bsd.sanitizer.mk" 867bc797e3SAlex Richardson 8779f59915SJohn Baldwin.if ${MACHINE_CPUARCH} == "riscv" && ${LINKER_FEATURES:Mriscv-relaxations} == "" 8879f59915SJohn BaldwinCFLAGS += -mno-relax 8979f59915SJohn Baldwin.endif 9079f59915SJohn Baldwin 9141f89315SRuslan Ermilov.if defined(CRUNCH_CFLAGS) 923c9b8563SGordon TetlowCFLAGS+=${CRUNCH_CFLAGS} 9342f8c5b5SEd Maste.else 9442f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \ 9542f8c5b5SEd Maste empty(DEBUG_FLAGS:M-gdwarf-*) 96*c910570eSEd Maste.if !${COMPILER_FEATURES:Mcompressed-debug} 97*c910570eSEd MasteCFLAGS+= ${DEBUG_FILES_CFLAGS:N-gz*} 98*c910570eSEd Maste.else 99de6feefdSJohn BaldwinCFLAGS+= ${DEBUG_FILES_CFLAGS} 100*c910570eSEd Maste.endif 10142f8c5b5SEd MasteCTFFLAGS+= -g 10242f8c5b5SEd Maste.endif 10341f89315SRuslan Ermilov.endif 104afe61c15SRodney W. Grimes 105e82b0b99SJordan K. Hubbard.if !defined(DEBUG_FLAGS) 106afe61c15SRodney W. GrimesSTRIP?= -s 107e82b0b99SJordan K. Hubbard.endif 108afe61c15SRodney W. Grimes 109dc6d22c9SBaptiste Daroussin.if defined(NO_ROOT) 110dc6d22c9SBaptiste Daroussin.if !defined(TAGS) || ! ${TAGS:Mpackage=*} 1114c1a82ceSEmmanuel VadotTAGS+= package=${PACKAGE:Uutilities} 112dc6d22c9SBaptiste Daroussin.endif 113dc6d22c9SBaptiste DaroussinTAG_ARGS= -T ${TAGS:[*]:S/ /,/g} 114dc6d22c9SBaptiste Daroussin.endif 115dc6d22c9SBaptiste Daroussin 116a335df48SConrad Meyer.if defined(NO_SHARED) && ${NO_SHARED:tl} != "no" 1173585b293SGarrett WollmanLDFLAGS+= -static 1183585b293SGarrett Wollman.endif 119afe61c15SRodney W. Grimes 120982f1fc2SKyle Evans# clang currently defaults to dynamic TLS for mips64 binaries 121982f1fc2SKyle Evans.if ${MACHINE_ARCH:Mmips64*} && ${COMPILER_TYPE} == "clang" 122982f1fc2SKyle EvansCFLAGS+= -ftls-model=initial-exec 123982f1fc2SKyle Evans.endif 124982f1fc2SKyle Evans 12542f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" 12642f8c5b5SEd MastePROG_FULL=${PROG}.full 12742f8c5b5SEd Maste# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory 12842f8c5b5SEd Maste.if defined(BINDIR) && (\ 12942f8c5b5SEd Maste ${BINDIR} == "/bin" ||\ 1305ea4b6d5SEd Maste ${BINDIR:C%/libexec(/.*)?%/libexec%} == "/libexec" ||\ 13142f8c5b5SEd Maste ${BINDIR} == "/sbin" ||\ 132b60371f8SEd Maste ${BINDIR:C%/usr/(bin|bsdinstall|libexec|lpr|sendmail|sm.bin|sbin|tests)(/.*)?%/usr/bin%} == "/usr/bin" ||\ 133b60371f8SEd Maste ${BINDIR} == "/usr/lib" \ 13442f8c5b5SEd Maste ) 13542f8c5b5SEd MasteDEBUGFILEDIR= ${DEBUGDIR}${BINDIR} 13642f8c5b5SEd Maste.else 13742f8c5b5SEd MasteDEBUGFILEDIR?= ${BINDIR}/.debug 138a324b0f0SBryan Drewery.endif 139a324b0f0SBryan Drewery.if !exists(${DESTDIR}${DEBUGFILEDIR}) 14042f8c5b5SEd MasteDEBUGMKDIR= 14142f8c5b5SEd Maste.endif 14242f8c5b5SEd Maste.else 14342f8c5b5SEd MastePROG_FULL= ${PROG} 14447bf8a5cSRuslan Ermilov.endif 14547bf8a5cSRuslan Ermilov 146afe61c15SRodney W. Grimes.if defined(PROG) 147a0dc5970SEd MastePROGNAME?= ${PROG} 14842f8c5b5SEd Maste 149afe61c15SRodney W. Grimes.if defined(SRCS) 150afe61c15SRodney W. Grimes 1512506d700SSimon J. GerratyOBJS+= ${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/g} 152afe61c15SRodney W. Grimes 1534f2fac37SJonathan Anderson# LLVM bitcode / textual IR representations of the program 1544f2fac37SJonathan AndersonBCOBJS+=${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.bco/g} 1554f2fac37SJonathan AndersonLLOBJS+=${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.llo/g} 1564f2fac37SJonathan Anderson 157c2c48445SRui Paulo.if target(beforelinking) 158593c0b49SMark Johnstonbeforelinking: ${OBJS} 15942f8c5b5SEd Maste${PROG_FULL}: beforelinking 160c2c48445SRui Paulo.endif 1615852ae2dSBryan Drewery${PROG_FULL}: ${OBJS} 1625d68012aSRuslan Ermilov.if defined(PROG_CXX) 1639160419cSBryan Drewery ${CXX:N${CCACHE_BIN}} ${CXXFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} \ 1649160419cSBryan Drewery ${OBJS} ${LDADD} 1655d68012aSRuslan Ermilov.else 1669160419cSBryan Drewery ${CC:N${CCACHE_BIN}} ${CFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} ${OBJS} \ 1679160419cSBryan Drewery ${LDADD} 1685d68012aSRuslan Ermilov.endif 16983cb5baeSMax Khon.if ${MK_CTF} != "no" 170cd49c2e8SMax Khon ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} 171cd49c2e8SMax Khon.endif 1725d68012aSRuslan Ermilov 17384aac273SHartmut Brandt.else # !defined(SRCS) 174afe61c15SRodney W. Grimes 1755d68012aSRuslan Ermilov.if !target(${PROG}) 17647bf8a5cSRuslan Ermilov.if defined(PROG_CXX) 17747bf8a5cSRuslan ErmilovSRCS= ${PROG}.cc 17847bf8a5cSRuslan Ermilov.else 179afe61c15SRodney W. GrimesSRCS= ${PROG}.c 18047bf8a5cSRuslan Ermilov.endif 181afe61c15SRodney W. Grimes 182a4c39c7aSBruce Evans# Always make an intermediate object file because: 183a4c39c7aSBruce Evans# - it saves time rebuilding when only the library has changed 184a4c39c7aSBruce Evans# - the name of the object gets put into the executable symbol table instead of 185a4c39c7aSBruce Evans# the name of a variable temporary object. 186a4c39c7aSBruce Evans# - it's useful to keep objects around for crunching. 1877f7fc25bSMark JohnstonOBJS+= ${PROG}.o 1884f2fac37SJonathan AndersonBCOBJS+= ${PROG}.bc 1894f2fac37SJonathan AndersonLLOBJS+= ${PROG}.ll 1904f2fac37SJonathan AndersonCLEANFILES+= ${PROG}.o ${PROG}.bc ${PROG}.ll 191f5c75051SEivind Eklund 192c2c48445SRui Paulo.if target(beforelinking) 193593c0b49SMark Johnstonbeforelinking: ${OBJS} 19442f8c5b5SEd Maste${PROG_FULL}: beforelinking 195c2c48445SRui Paulo.endif 1965852ae2dSBryan Drewery${PROG_FULL}: ${OBJS} 197f8ba1555SRuslan Ermilov.if defined(PROG_CXX) 1989160419cSBryan Drewery ${CXX:N${CCACHE_BIN}} ${CXXFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} \ 1999160419cSBryan Drewery ${OBJS} ${LDADD} 200f8ba1555SRuslan Ermilov.else 2019160419cSBryan Drewery ${CC:N${CCACHE_BIN}} ${CFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} ${OBJS} \ 2029160419cSBryan Drewery ${LDADD} 203afe61c15SRodney W. Grimes.endif 20483cb5baeSMax Khon.if ${MK_CTF} != "no" 205cd49c2e8SMax Khon ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} 206cd49c2e8SMax Khon.endif 20742f8c5b5SEd Maste.endif # !target(${PROG}) 208f5c75051SEivind Eklund 2090d947ed1SEd Maste.endif # !defined(SRCS) 210afe61c15SRodney W. Grimes 21142f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" 2125852ae2dSBryan Drewery${PROG}: ${PROG_FULL} ${PROGNAME}.debug 21342f8c5b5SEd Maste ${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROGNAME}.debug \ 21442f8c5b5SEd Maste ${PROG_FULL} ${.TARGET} 21542f8c5b5SEd Maste 2165852ae2dSBryan Drewery${PROGNAME}.debug: ${PROG_FULL} 21742f8c5b5SEd Maste ${OBJCOPY} --only-keep-debug ${PROG_FULL} ${.TARGET} 21842f8c5b5SEd Maste.endif 21942f8c5b5SEd Maste 220e4195e2eSJonathan Anderson.if defined(LLVM_LINK) 221e4195e2eSJonathan Anderson${PROG_FULL}.bc: ${BCOBJS} 222e4195e2eSJonathan Anderson ${LLVM_LINK} -o ${.TARGET} ${BCOBJS} 223e4195e2eSJonathan Anderson 224e4195e2eSJonathan Anderson${PROG_FULL}.ll: ${LLOBJS} 225e4195e2eSJonathan Anderson ${LLVM_LINK} -S -o ${.TARGET} ${LLOBJS} 226e4195e2eSJonathan Anderson 2276f6b66a8SJonathan AndersonCLEANFILES+= ${PROG_FULL}.bc ${PROG_FULL}.ll 228e4195e2eSJonathan Anderson.endif # defined(LLVM_LINK) 229e4195e2eSJonathan Anderson 230e1fe3dbaSRuslan Ermilov.if ${MK_MAN} != "no" && !defined(MAN) && \ 231862d3deaSRuslan Ermilov !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ 232afe61c15SRodney W. Grimes !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ 2338b4f1f91SBrooks Davis !defined(MAN7) && !defined(MAN8) && !defined(MAN9) 23419ea15a1SRuslan ErmilovMAN= ${PROG}.1 23519ea15a1SRuslan ErmilovMAN1= ${MAN} 236afe61c15SRodney W. Grimes.endif 2370d947ed1SEd Maste.endif # defined(PROG) 238afe61c15SRodney W. Grimes 2397750ad47SMarcel Moolenaar.if defined(_SKIP_BUILD) 2407750ad47SMarcel Moolenaarall: 2417750ad47SMarcel Moolenaar.else 2427c8d3811SMarcin Wojtas.if target(afterbuild) 2437c8d3811SMarcin Wojtas.ORDER: ${PROG} afterbuild 2447c8d3811SMarcin Wojtasall: ${PROG} ${SCRIPTS} afterbuild 2457c8d3811SMarcin Wojtas.else 2461bd4272fSBryan Dreweryall: ${PROG} ${SCRIPTS} 2477c8d3811SMarcin Wojtas.endif 248e1fe3dbaSRuslan Ermilov.if ${MK_MAN} != "no" 249f1702f87SBryan Dreweryall: all-man 250862d3deaSRuslan Ermilov.endif 2517750ad47SMarcel Moolenaar.endif 252afe61c15SRodney W. Grimes 25341f89315SRuslan Ermilov.if defined(PROG) 254e4195e2eSJonathan AndersonCLEANFILES+= ${PROG} ${PROG}.bc ${PROG}.ll 25542f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" 2566f6b66a8SJonathan AndersonCLEANFILES+= ${PROG_FULL} ${PROGNAME}.debug 25742f8c5b5SEd Maste.endif 25841f89315SRuslan Ermilov.endif 25941f89315SRuslan Ermilov 26041f89315SRuslan Ermilov.if defined(OBJS) 261e4195e2eSJonathan AndersonCLEANFILES+= ${OBJS} ${BCOBJS} ${LLOBJS} 26241f89315SRuslan Ermilov.endif 263afe61c15SRodney W. Grimes 26451fa76c4SRuslan Ermilov.include <bsd.libnames.mk> 26551fa76c4SRuslan Ermilov 266218a2cd2SBruce Evans.if defined(PROG) 267799483e4SBryan Drewery.if !defined(NO_EXTRADEPEND) 268663e9677SBruce Evans_EXTRADEPEND: 26951fa76c4SRuslan Ermilov.if defined(LDFLAGS) && !empty(LDFLAGS:M-nostdlib) 27051fa76c4SRuslan Ermilov.if defined(DPADD) && !empty(DPADD) 27137fd8bc2SJohn Baldwin echo ${PROG_FULL}: ${DPADD} >> ${DEPENDFILE} 27251fa76c4SRuslan Ermilov.endif 27351fa76c4SRuslan Ermilov.else 27437fd8bc2SJohn Baldwin echo ${PROG_FULL}: ${LIBC} ${DPADD} >> ${DEPENDFILE} 2757273339dSWarner Losh.if defined(PROG_CXX) 27637fd8bc2SJohn Baldwin echo ${PROG_FULL}: ${LIBCPLUSPLUS} >> ${DEPENDFILE} 2778c05a446SPeter Wemm.endif 27851fa76c4SRuslan Ermilov.endif 279799483e4SBryan Drewery.endif # !defined(NO_EXTRADEPEND) 280d515c63dSDimitry Andric.endif 281663e9677SBruce Evans 282afe61c15SRodney W. Grimes.if !target(install) 283afe61c15SRodney W. Grimes 284212acbefSRuslan Ermilov.if defined(PRECIOUSPROG) 28500fbd407SRuslan Ermilov.if !defined(NO_FSCHG) 286dee651ebSRuslan ErmilovINSTALLFLAGS+= -fschg 287dee651ebSRuslan Ermilov.endif 288212acbefSRuslan ErmilovINSTALLFLAGS+= -S 289212acbefSRuslan Ermilov.endif 290dee651ebSRuslan Ermilov 291e902c1bbSTim Vanderhoek_INSTALLFLAGS:= ${INSTALLFLAGS} 292e902c1bbSTim Vanderhoek.for ie in ${INSTALLFLAGS_EDIT} 293e902c1bbSTim Vanderhoek_INSTALLFLAGS:= ${_INSTALLFLAGS${ie}} 294e902c1bbSTim Vanderhoek.endfor 295e902c1bbSTim Vanderhoek 29651fa76c4SRuslan Ermilov.if !target(realinstall) && !defined(INTERNALPROG) 29787829387SRuslan Ermilovrealinstall: _proginstall 298badb7c1cSRuslan Ermilov.ORDER: beforeinstall _proginstall 29987829387SRuslan Ermilov_proginstall: 300afe61c15SRodney W. Grimes.if defined(PROG) 301dc6d22c9SBaptiste Daroussin ${INSTALL} ${TAG_ARGS} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 30295f8c826SRuslan Ermilov ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME} 30342f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" 30442f8c5b5SEd Maste.if defined(DEBUGMKDIR) 305697b271dSEd Maste ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -d ${DESTDIR}${DEBUGFILEDIR}/ 30642f8c5b5SEd Maste.endif 307697b271dSEd Maste ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -o ${BINOWN} -g ${BINGRP} -m ${DEBUGMODE} \ 30842f8c5b5SEd Maste ${PROGNAME}.debug ${DESTDIR}${DEBUGFILEDIR}/${PROGNAME}.debug 30942f8c5b5SEd Maste.endif 31095f8c826SRuslan Ermilov.endif 31184aac273SHartmut Brandt.endif # !target(realinstall) 312afe61c15SRodney W. Grimes 313f7ee8cfeSRuslan Ermilov.if defined(SCRIPTS) && !empty(SCRIPTS) 314f7ee8cfeSRuslan Ermilovrealinstall: _scriptsinstall 315badb7c1cSRuslan Ermilov.ORDER: beforeinstall _scriptsinstall 316f7ee8cfeSRuslan Ermilov 317f7ee8cfeSRuslan ErmilovSCRIPTSDIR?= ${BINDIR} 318f7ee8cfeSRuslan ErmilovSCRIPTSOWN?= ${BINOWN} 319f7ee8cfeSRuslan ErmilovSCRIPTSGRP?= ${BINGRP} 320f7ee8cfeSRuslan ErmilovSCRIPTSMODE?= ${BINMODE} 321f7ee8cfeSRuslan Ermilov 322116d4508SSimon J. GerratySTAGE_AS_SETS+= scripts 323116d4508SSimon J. Gerratystage_as.scripts: ${SCRIPTS} 324116d4508SSimon J. GerratyFLAGS.stage_as.scripts= -m ${SCRIPTSMODE} 325116d4508SSimon J. GerratySTAGE_FILES_DIR.scripts= ${STAGE_OBJTOP} 326f7ee8cfeSRuslan Ermilov.for script in ${SCRIPTS} 327f7ee8cfeSRuslan Ermilov.if defined(SCRIPTSNAME) 328f7ee8cfeSRuslan ErmilovSCRIPTSNAME_${script:T}?= ${SCRIPTSNAME} 329f7ee8cfeSRuslan Ermilov.else 330f7ee8cfeSRuslan ErmilovSCRIPTSNAME_${script:T}?= ${script:T:R} 331f7ee8cfeSRuslan Ermilov.endif 332f7ee8cfeSRuslan ErmilovSCRIPTSDIR_${script:T}?= ${SCRIPTSDIR} 333f7ee8cfeSRuslan ErmilovSCRIPTSOWN_${script:T}?= ${SCRIPTSOWN} 334f7ee8cfeSRuslan ErmilovSCRIPTSGRP_${script:T}?= ${SCRIPTSGRP} 335f7ee8cfeSRuslan ErmilovSCRIPTSMODE_${script:T}?= ${SCRIPTSMODE} 336116d4508SSimon J. GerratySTAGE_AS_${script:T}= ${SCRIPTSDIR_${script:T}}/${SCRIPTSNAME_${script:T}} 337a7aaf57eSRuslan Ermilov_scriptsinstall: _SCRIPTSINS_${script:T} 338a7aaf57eSRuslan Ermilov_SCRIPTSINS_${script:T}: ${script} 339dc6d22c9SBaptiste Daroussin ${INSTALL} ${TAG_ARGS} -o ${SCRIPTSOWN_${.ALLSRC:T}} \ 340f7ee8cfeSRuslan Ermilov -g ${SCRIPTSGRP_${.ALLSRC:T}} -m ${SCRIPTSMODE_${.ALLSRC:T}} \ 3414367bda6SRuslan Ermilov ${.ALLSRC} \ 342f7ee8cfeSRuslan Ermilov ${DESTDIR}${SCRIPTSDIR_${.ALLSRC:T}}/${SCRIPTSNAME_${.ALLSRC:T}} 343f7ee8cfeSRuslan Ermilov.endfor 344f7ee8cfeSRuslan Ermilov.endif 345f7ee8cfeSRuslan Ermilov 3468479adc1SRuslan ErmilovNLSNAME?= ${PROG} 3478479adc1SRuslan Ermilov.include <bsd.nls.mk> 3488479adc1SRuslan Ermilov 3499b4f4918SBaptiste Daroussin.include <bsd.confs.mk> 350af2dc868SRuslan Ermilov.include <bsd.files.mk> 3515d862037SRuslan Ermilov.include <bsd.incs.mk> 352fa8c921eSBrooks Davis 353fa8c921eSBrooks DavisLINKOWN?= ${BINOWN} 354fa8c921eSBrooks DavisLINKGRP?= ${BINGRP} 355fa8c921eSBrooks DavisLINKMODE?= ${BINMODE} 35684f94a79SRuslan Ermilov.include <bsd.links.mk> 357c7b111cbSRuslan Ermilov 358e1fe3dbaSRuslan Ermilov.if ${MK_MAN} != "no" 359f1702f87SBryan Dreweryrealinstall: maninstall 360f1702f87SBryan Drewery.ORDER: beforeinstall maninstall 36187829387SRuslan Ermilov.endif 36287829387SRuslan Ermilov 363abb02fa2SBryan Drewery.endif # !target(install) 364afe61c15SRodney W. Grimes 365e1fe3dbaSRuslan Ermilov.if ${MK_MAN} != "no" 366afe61c15SRodney W. Grimes.include <bsd.man.mk> 36769b87d3eSEivind Eklund.endif 36869b87d3eSEivind Eklund 36938f8fddfSEnji Cooper.if defined(HAS_TESTS) 37038f8fddfSEnji CooperMAKE+= MK_MAKE_CHECK_USE_SANDBOX=yes 37138f8fddfSEnji CooperSUBDIR_TARGETS+= check 37238f8fddfSEnji CooperTESTS_LD_LIBRARY_PATH+= ${.OBJDIR} 37338f8fddfSEnji CooperTESTS_PATH+= ${.OBJDIR} 37438f8fddfSEnji Cooper.endif 37538f8fddfSEnji Cooper 376d7beff08SBryan Drewery.if defined(PROG) 377d7beff08SBryan DreweryOBJS_DEPEND_GUESS+= ${SRCS:M*.h} 37888fe1f7aSBryan Drewery.endif 37988fe1f7aSBryan Drewery 38088fe1f7aSBryan Drewery.include <bsd.dep.mk> 381aae63957SBryan Drewery.include <bsd.clang-analyze.mk> 382cd9a2f5cSJordan K. Hubbard.include <bsd.obj.mk> 383d510ecb4SKris Kennaway.include <bsd.sys.mk> 384