13585b293SGarrett Wollman# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 2afe61c15SRodney W. Grimes 32bdaf7e8SRuslan Ermilov.include <bsd.init.mk> 4bd871f14SWarner Losh.include <bsd.compiler.mk> 5e5c6deceSEd Maste.include <bsd.linker.mk> 6afe61c15SRodney W. Grimes 7e4195e2eSJonathan Anderson.SUFFIXES: .out .o .bc .c .cc .cpp .cxx .C .m .y .l .ll .ln .s .S .asm 8afe61c15SRodney W. Grimes 948aea4daSRuslan Ermilov# XXX The use of COPTS in modern makefiles is discouraged. 1041f89315SRuslan Ermilov.if defined(COPTS) 119b8d26fdSBryan Drewery.warning ${.CURDIR}: COPTS should be CFLAGS. 1241f89315SRuslan ErmilovCFLAGS+=${COPTS} 1341f89315SRuslan Ermilov.endif 1441f89315SRuslan Ermilov 154df1f59eSWarner Losh.if ${MK_ASSERT_DEBUG} == "no" 164df1f59eSWarner LoshCFLAGS+= -DNDEBUG 177fa2f2a6SAlex Richardson# XXX: shouldn't we ensure that !asserts marks potentially unused variables as 187fa2f2a6SAlex Richardson# __unused instead of disabling -Werror globally? 197fa2f2a6SAlex RichardsonMK_WERROR= no 204df1f59eSWarner Losh.endif 214df1f59eSWarner Losh 2241f89315SRuslan Ermilov.if defined(DEBUG_FLAGS) 2341f89315SRuslan ErmilovCFLAGS+=${DEBUG_FLAGS} 248eba8cd8SMarcel MoolenaarCXXFLAGS+=${DEBUG_FLAGS} 25770ac3b2SJohn Birrell 2683cb5baeSMax Khon.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != "" 27770ac3b2SJohn BirrellCTFFLAGS+= -g 28770ac3b2SJohn Birrell.endif 2941f89315SRuslan Ermilov.endif 3041f89315SRuslan Ermilov 3142f8c5b5SEd Maste.if defined(PROG_CXX) 3242f8c5b5SEd MastePROG= ${PROG_CXX} 3342f8c5b5SEd Maste.endif 3442f8c5b5SEd Maste 356e521732SEd Maste.if !empty(LDFLAGS:M-Wl,*--oformat,*) || !empty(LDFLAGS:M-static) 3642f8c5b5SEd MasteMK_DEBUG_FILES= no 3742f8c5b5SEd Maste.endif 3842f8c5b5SEd Maste 39bf81eb3cSEd Maste# ELF hardening knobs 40bf81eb3cSEd Maste.if ${MK_BIND_NOW} != "no" 41bf81eb3cSEd MasteLDFLAGS+= -Wl,-znow 42bf81eb3cSEd Maste.endif 434ca6ecf1SJessica Clarke.if ${LINKER_TYPE} != "mac" 442f3a9614SEd Maste.if ${MK_RELRO} == "no" 452f3a9614SEd MasteLDFLAGS+= -Wl,-znorelro 462f3a9614SEd Maste.else 472f3a9614SEd MasteLDFLAGS+= -Wl,-zrelro 482f3a9614SEd Maste.endif 497927452aSEd Maste.endif 508e1e3e1cSEd Maste.if ${MK_PIE} != "no" 518e1e3e1cSEd Maste# Static PIE is not yet supported/tested. 528e1e3e1cSEd Maste.if !defined(NO_SHARED) || ${NO_SHARED:tl} == "no" 53bcf99d2dSEd MasteCFLAGS+= -fPIE 54bcf99d2dSEd MasteCXXFLAGS+= -fPIE 55bcf99d2dSEd MasteLDFLAGS+= -pie 56bcf99d2dSEd Maste.endif 578e1e3e1cSEd Maste.endif 58fc191b11SEd Maste.if ${MK_RETPOLINE} != "no" 59e5c6deceSEd Maste.if ${COMPILER_FEATURES:Mretpoline} && ${LINKER_FEATURES:Mretpoline} 60fc191b11SEd MasteCFLAGS+= -mretpoline 61fc191b11SEd MasteCXXFLAGS+= -mretpoline 6214608708SEd Maste# retpolineplt is broken with static linking (PR 233336) 63447b492eSEd Maste.if !defined(NO_SHARED) || ${NO_SHARED:tl} == "no" 64fc191b11SEd MasteLDFLAGS+= -Wl,-zretpolineplt 65fc191b11SEd Maste.endif 66e5c6deceSEd Maste.else 67e5c6deceSEd Maste.warning Retpoline requested but not supported by compiler or linker 68e5c6deceSEd Maste.endif 6914608708SEd Maste.endif 7092053e4fSJohn Baldwin# LLD sensibly defaults to -znoexecstack, so do the same for BFD 7192053e4fSJohn BaldwinLDFLAGS.bfd+= -Wl,-znoexecstack 7282854693SAndrew Turner.if ${MK_BRANCH_PROTECTION} != "no" 7382854693SAndrew TurnerCFLAGS+= -mbranch-protection=standard 74973bbdabSJose Luis Duran.if ${LINKER_FEATURES:Mbti-report} && defined(BTI_REPORT_ERROR) 7582854693SAndrew TurnerLDFLAGS+= -Wl,-zbti-report=error 7682854693SAndrew Turner.endif 7782854693SAndrew Turner.endif 78fc191b11SEd Maste 79e268fd0aSBrooks Davis# Initialize stack variables on function entry 802befa269SBrooks Davis.if ${OPT_INIT_ALL} != "none" 81e268fd0aSBrooks Davis.if ${COMPILER_FEATURES:Minit-all} 822befa269SBrooks DavisCFLAGS+= -ftrivial-auto-var-init=${OPT_INIT_ALL} 832befa269SBrooks DavisCXXFLAGS+= -ftrivial-auto-var-init=${OPT_INIT_ALL} 842befa269SBrooks Davis.if ${OPT_INIT_ALL} == "zero" && ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 160000 853006f6dfSDimitry AndricCFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang 863006f6dfSDimitry AndricCXXFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang 873006f6dfSDimitry Andric.endif 88e268fd0aSBrooks Davis.else 892befa269SBrooks Davis.warning INIT_ALL (${OPT_INIT_ALL}) requested but not supported by compiler 90e268fd0aSBrooks Davis.endif 91e268fd0aSBrooks Davis.endif 92e268fd0aSBrooks Davis 93*2a44cccdSAlexander Leidinger# Zero used registers on return (mitigate some ROP) 94*2a44cccdSAlexander Leidinger.if ${MK_ZEROREGS} != "no" 95*2a44cccdSAlexander Leidinger.if ${COMPILER_FEATURES:Mzeroregs} 96*2a44cccdSAlexander LeidingerZEROREG_TYPE?= used 97*2a44cccdSAlexander LeidingerCFLAGS+= -fzero-call-used-regs=${ZEROREG_TYPE} 98*2a44cccdSAlexander LeidingerCXXFLAGS+= -fzero-call-used-regs=${ZEROREG_TYPE} 99*2a44cccdSAlexander Leidinger.endif 100*2a44cccdSAlexander Leidinger.endif 101*2a44cccdSAlexander Leidinger 102428a32edSAlex Richardson# bsd.sanitizer.mk is not installed, so don't require it (e.g. for ports). 103428a32edSAlex Richardson.sinclude "bsd.sanitizer.mk" 1047bc797e3SAlex Richardson 10579f59915SJohn Baldwin.if ${MACHINE_CPUARCH} == "riscv" && ${LINKER_FEATURES:Mriscv-relaxations} == "" 10679f59915SJohn BaldwinCFLAGS += -mno-relax 10779f59915SJohn Baldwin.endif 10879f59915SJohn Baldwin 10941f89315SRuslan Ermilov.if defined(CRUNCH_CFLAGS) 1103c9b8563SGordon TetlowCFLAGS+=${CRUNCH_CFLAGS} 11142f8c5b5SEd Maste.else 11242f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \ 11342f8c5b5SEd Maste empty(DEBUG_FLAGS:M-gdwarf-*) 114c910570eSEd Maste.if !${COMPILER_FEATURES:Mcompressed-debug} 115c910570eSEd MasteCFLAGS+= ${DEBUG_FILES_CFLAGS:N-gz*} 116c910570eSEd Maste.else 117de6feefdSJohn BaldwinCFLAGS+= ${DEBUG_FILES_CFLAGS} 118c910570eSEd Maste.endif 11942f8c5b5SEd MasteCTFFLAGS+= -g 12042f8c5b5SEd Maste.endif 12141f89315SRuslan Ermilov.endif 122afe61c15SRodney W. Grimes 123e82b0b99SJordan K. Hubbard.if !defined(DEBUG_FLAGS) 124afe61c15SRodney W. GrimesSTRIP?= -s 125e82b0b99SJordan K. Hubbard.endif 126afe61c15SRodney W. Grimes 127dc6d22c9SBaptiste Daroussin.if defined(NO_ROOT) 128dc6d22c9SBaptiste Daroussin.if !defined(TAGS) || ! ${TAGS:Mpackage=*} 1294c1a82ceSEmmanuel VadotTAGS+= package=${PACKAGE:Uutilities} 130dc6d22c9SBaptiste Daroussin.endif 131dc6d22c9SBaptiste DaroussinTAG_ARGS= -T ${TAGS:[*]:S/ /,/g} 132dc6d22c9SBaptiste Daroussin.endif 133dc6d22c9SBaptiste Daroussin 134a335df48SConrad Meyer.if defined(NO_SHARED) && ${NO_SHARED:tl} != "no" 1353585b293SGarrett WollmanLDFLAGS+= -static 1363585b293SGarrett Wollman.endif 137afe61c15SRodney W. Grimes 13842f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" 13942f8c5b5SEd MastePROG_FULL=${PROG}.full 14042f8c5b5SEd Maste# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory 14142f8c5b5SEd Maste.if defined(BINDIR) && (\ 14242f8c5b5SEd Maste ${BINDIR} == "/bin" ||\ 1435ea4b6d5SEd Maste ${BINDIR:C%/libexec(/.*)?%/libexec%} == "/libexec" ||\ 14442f8c5b5SEd Maste ${BINDIR} == "/sbin" ||\ 145b60371f8SEd Maste ${BINDIR:C%/usr/(bin|bsdinstall|libexec|lpr|sendmail|sm.bin|sbin|tests)(/.*)?%/usr/bin%} == "/usr/bin" ||\ 146b60371f8SEd Maste ${BINDIR} == "/usr/lib" \ 14742f8c5b5SEd Maste ) 14842f8c5b5SEd MasteDEBUGFILEDIR= ${DEBUGDIR}${BINDIR} 14942f8c5b5SEd Maste.else 15042f8c5b5SEd MasteDEBUGFILEDIR?= ${BINDIR}/.debug 151a324b0f0SBryan Drewery.endif 152a324b0f0SBryan Drewery.if !exists(${DESTDIR}${DEBUGFILEDIR}) 15342f8c5b5SEd MasteDEBUGMKDIR= 15442f8c5b5SEd Maste.endif 15542f8c5b5SEd Maste.else 15642f8c5b5SEd MastePROG_FULL= ${PROG} 15747bf8a5cSRuslan Ermilov.endif 15847bf8a5cSRuslan Ermilov 159afe61c15SRodney W. Grimes.if defined(PROG) 160a0dc5970SEd MastePROGNAME?= ${PROG} 16142f8c5b5SEd Maste 162afe61c15SRodney W. Grimes.if defined(SRCS) 163afe61c15SRodney W. Grimes 1642506d700SSimon J. GerratyOBJS+= ${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/g} 165afe61c15SRodney W. Grimes 1664f2fac37SJonathan Anderson# LLVM bitcode / textual IR representations of the program 1674f2fac37SJonathan AndersonBCOBJS+=${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.bco/g} 1684f2fac37SJonathan AndersonLLOBJS+=${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.llo/g} 1694f2fac37SJonathan Anderson 170c2c48445SRui Paulo.if target(beforelinking) 171593c0b49SMark Johnstonbeforelinking: ${OBJS} 17242f8c5b5SEd Maste${PROG_FULL}: beforelinking 173c2c48445SRui Paulo.endif 1745852ae2dSBryan Drewery${PROG_FULL}: ${OBJS} 1755d68012aSRuslan Ermilov.if defined(PROG_CXX) 1769160419cSBryan Drewery ${CXX:N${CCACHE_BIN}} ${CXXFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} \ 1779160419cSBryan Drewery ${OBJS} ${LDADD} 1785d68012aSRuslan Ermilov.else 1799160419cSBryan Drewery ${CC:N${CCACHE_BIN}} ${CFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} ${OBJS} \ 1809160419cSBryan Drewery ${LDADD} 1815d68012aSRuslan Ermilov.endif 18283cb5baeSMax Khon.if ${MK_CTF} != "no" 183cd49c2e8SMax Khon ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} 184cd49c2e8SMax Khon.endif 1855d68012aSRuslan Ermilov 18684aac273SHartmut Brandt.else # !defined(SRCS) 187afe61c15SRodney W. Grimes 1885d68012aSRuslan Ermilov.if !target(${PROG}) 18947bf8a5cSRuslan Ermilov.if defined(PROG_CXX) 19047bf8a5cSRuslan ErmilovSRCS= ${PROG}.cc 19147bf8a5cSRuslan Ermilov.else 192afe61c15SRodney W. GrimesSRCS= ${PROG}.c 19347bf8a5cSRuslan Ermilov.endif 194afe61c15SRodney W. Grimes 195a4c39c7aSBruce Evans# Always make an intermediate object file because: 196a4c39c7aSBruce Evans# - it saves time rebuilding when only the library has changed 197a4c39c7aSBruce Evans# - the name of the object gets put into the executable symbol table instead of 198a4c39c7aSBruce Evans# the name of a variable temporary object. 199a4c39c7aSBruce Evans# - it's useful to keep objects around for crunching. 2007f7fc25bSMark JohnstonOBJS+= ${PROG}.o 2014f2fac37SJonathan AndersonBCOBJS+= ${PROG}.bc 2024f2fac37SJonathan AndersonLLOBJS+= ${PROG}.ll 2034f2fac37SJonathan AndersonCLEANFILES+= ${PROG}.o ${PROG}.bc ${PROG}.ll 204f5c75051SEivind Eklund 205c2c48445SRui Paulo.if target(beforelinking) 206593c0b49SMark Johnstonbeforelinking: ${OBJS} 20742f8c5b5SEd Maste${PROG_FULL}: beforelinking 208c2c48445SRui Paulo.endif 2095852ae2dSBryan Drewery${PROG_FULL}: ${OBJS} 210f8ba1555SRuslan Ermilov.if defined(PROG_CXX) 2119160419cSBryan Drewery ${CXX:N${CCACHE_BIN}} ${CXXFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} \ 2129160419cSBryan Drewery ${OBJS} ${LDADD} 213f8ba1555SRuslan Ermilov.else 2149160419cSBryan Drewery ${CC:N${CCACHE_BIN}} ${CFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} ${OBJS} \ 2159160419cSBryan Drewery ${LDADD} 216afe61c15SRodney W. Grimes.endif 21783cb5baeSMax Khon.if ${MK_CTF} != "no" 218cd49c2e8SMax Khon ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} 219cd49c2e8SMax Khon.endif 22042f8c5b5SEd Maste.endif # !target(${PROG}) 221f5c75051SEivind Eklund 2220d947ed1SEd Maste.endif # !defined(SRCS) 223afe61c15SRodney W. Grimes 22442f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" 2255852ae2dSBryan Drewery${PROG}: ${PROG_FULL} ${PROGNAME}.debug 22642f8c5b5SEd Maste ${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROGNAME}.debug \ 22742f8c5b5SEd Maste ${PROG_FULL} ${.TARGET} 22842f8c5b5SEd Maste 2295852ae2dSBryan Drewery${PROGNAME}.debug: ${PROG_FULL} 23042f8c5b5SEd Maste ${OBJCOPY} --only-keep-debug ${PROG_FULL} ${.TARGET} 23142f8c5b5SEd Maste.endif 23242f8c5b5SEd Maste 233e4195e2eSJonathan Anderson.if defined(LLVM_LINK) 234e4195e2eSJonathan Anderson${PROG_FULL}.bc: ${BCOBJS} 235e4195e2eSJonathan Anderson ${LLVM_LINK} -o ${.TARGET} ${BCOBJS} 236e4195e2eSJonathan Anderson 237e4195e2eSJonathan Anderson${PROG_FULL}.ll: ${LLOBJS} 238e4195e2eSJonathan Anderson ${LLVM_LINK} -S -o ${.TARGET} ${LLOBJS} 239e4195e2eSJonathan Anderson 2406f6b66a8SJonathan AndersonCLEANFILES+= ${PROG_FULL}.bc ${PROG_FULL}.ll 241e4195e2eSJonathan Anderson.endif # defined(LLVM_LINK) 242e4195e2eSJonathan Anderson 243e1fe3dbaSRuslan Ermilov.if ${MK_MAN} != "no" && !defined(MAN) && \ 244862d3deaSRuslan Ermilov !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ 245afe61c15SRodney W. Grimes !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ 2468b4f1f91SBrooks Davis !defined(MAN7) && !defined(MAN8) && !defined(MAN9) 24719ea15a1SRuslan ErmilovMAN= ${PROG}.1 24819ea15a1SRuslan ErmilovMAN1= ${MAN} 249afe61c15SRodney W. Grimes.endif 2500d947ed1SEd Maste.endif # defined(PROG) 251afe61c15SRodney W. Grimes 2527750ad47SMarcel Moolenaar.if defined(_SKIP_BUILD) 2537750ad47SMarcel Moolenaarall: 2547750ad47SMarcel Moolenaar.else 2557c8d3811SMarcin Wojtas.if target(afterbuild) 2567c8d3811SMarcin Wojtas.ORDER: ${PROG} afterbuild 2577c8d3811SMarcin Wojtasall: ${PROG} ${SCRIPTS} afterbuild 2587c8d3811SMarcin Wojtas.else 2591bd4272fSBryan Dreweryall: ${PROG} ${SCRIPTS} 2607c8d3811SMarcin Wojtas.endif 261e1fe3dbaSRuslan Ermilov.if ${MK_MAN} != "no" 262f1702f87SBryan Dreweryall: all-man 263862d3deaSRuslan Ermilov.endif 2647750ad47SMarcel Moolenaar.endif 265afe61c15SRodney W. Grimes 26641f89315SRuslan Ermilov.if defined(PROG) 267e4195e2eSJonathan AndersonCLEANFILES+= ${PROG} ${PROG}.bc ${PROG}.ll 26842f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" 2696f6b66a8SJonathan AndersonCLEANFILES+= ${PROG_FULL} ${PROGNAME}.debug 27042f8c5b5SEd Maste.endif 27141f89315SRuslan Ermilov.endif 27241f89315SRuslan Ermilov 27341f89315SRuslan Ermilov.if defined(OBJS) 274e4195e2eSJonathan AndersonCLEANFILES+= ${OBJS} ${BCOBJS} ${LLOBJS} 27541f89315SRuslan Ermilov.endif 276afe61c15SRodney W. Grimes 27751fa76c4SRuslan Ermilov.include <bsd.libnames.mk> 27851fa76c4SRuslan Ermilov 279218a2cd2SBruce Evans.if defined(PROG) 280799483e4SBryan Drewery.if !defined(NO_EXTRADEPEND) 281663e9677SBruce Evans_EXTRADEPEND: 28251fa76c4SRuslan Ermilov.if defined(LDFLAGS) && !empty(LDFLAGS:M-nostdlib) 28351fa76c4SRuslan Ermilov.if defined(DPADD) && !empty(DPADD) 28437fd8bc2SJohn Baldwin echo ${PROG_FULL}: ${DPADD} >> ${DEPENDFILE} 28551fa76c4SRuslan Ermilov.endif 28651fa76c4SRuslan Ermilov.else 28737fd8bc2SJohn Baldwin echo ${PROG_FULL}: ${LIBC} ${DPADD} >> ${DEPENDFILE} 2887273339dSWarner Losh.if defined(PROG_CXX) 28937fd8bc2SJohn Baldwin echo ${PROG_FULL}: ${LIBCPLUSPLUS} >> ${DEPENDFILE} 2908c05a446SPeter Wemm.endif 29151fa76c4SRuslan Ermilov.endif 292799483e4SBryan Drewery.endif # !defined(NO_EXTRADEPEND) 293d515c63dSDimitry Andric.endif 294663e9677SBruce Evans 295afe61c15SRodney W. Grimes.if !target(install) 296afe61c15SRodney W. Grimes 297212acbefSRuslan Ermilov.if defined(PRECIOUSPROG) 29800fbd407SRuslan Ermilov.if !defined(NO_FSCHG) 299dee651ebSRuslan ErmilovINSTALLFLAGS+= -fschg 300dee651ebSRuslan Ermilov.endif 301212acbefSRuslan ErmilovINSTALLFLAGS+= -S 302212acbefSRuslan Ermilov.endif 303dee651ebSRuslan Ermilov 304e902c1bbSTim Vanderhoek_INSTALLFLAGS:= ${INSTALLFLAGS} 305e902c1bbSTim Vanderhoek.for ie in ${INSTALLFLAGS_EDIT} 306e902c1bbSTim Vanderhoek_INSTALLFLAGS:= ${_INSTALLFLAGS${ie}} 307e902c1bbSTim Vanderhoek.endfor 308e902c1bbSTim Vanderhoek 30951fa76c4SRuslan Ermilov.if !target(realinstall) && !defined(INTERNALPROG) 31087829387SRuslan Ermilovrealinstall: _proginstall 311badb7c1cSRuslan Ermilov.ORDER: beforeinstall _proginstall 31287829387SRuslan Ermilov_proginstall: 313afe61c15SRodney W. Grimes.if defined(PROG) 314dc6d22c9SBaptiste Daroussin ${INSTALL} ${TAG_ARGS} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 31595f8c826SRuslan Ermilov ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME} 31642f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" 31742f8c5b5SEd Maste.if defined(DEBUGMKDIR) 318697b271dSEd Maste ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -d ${DESTDIR}${DEBUGFILEDIR}/ 31942f8c5b5SEd Maste.endif 320697b271dSEd Maste ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -o ${BINOWN} -g ${BINGRP} -m ${DEBUGMODE} \ 32142f8c5b5SEd Maste ${PROGNAME}.debug ${DESTDIR}${DEBUGFILEDIR}/${PROGNAME}.debug 32242f8c5b5SEd Maste.endif 32395f8c826SRuslan Ermilov.endif 32484aac273SHartmut Brandt.endif # !target(realinstall) 325afe61c15SRodney W. Grimes 326f7ee8cfeSRuslan Ermilov.if defined(SCRIPTS) && !empty(SCRIPTS) 327f7ee8cfeSRuslan Ermilovrealinstall: _scriptsinstall 328badb7c1cSRuslan Ermilov.ORDER: beforeinstall _scriptsinstall 329f7ee8cfeSRuslan Ermilov 330f7ee8cfeSRuslan ErmilovSCRIPTSDIR?= ${BINDIR} 331f7ee8cfeSRuslan ErmilovSCRIPTSOWN?= ${BINOWN} 332f7ee8cfeSRuslan ErmilovSCRIPTSGRP?= ${BINGRP} 333f7ee8cfeSRuslan ErmilovSCRIPTSMODE?= ${BINMODE} 334f7ee8cfeSRuslan Ermilov 335116d4508SSimon J. GerratySTAGE_AS_SETS+= scripts 336116d4508SSimon J. Gerratystage_as.scripts: ${SCRIPTS} 337116d4508SSimon J. GerratyFLAGS.stage_as.scripts= -m ${SCRIPTSMODE} 338116d4508SSimon J. GerratySTAGE_FILES_DIR.scripts= ${STAGE_OBJTOP} 339f7ee8cfeSRuslan Ermilov.for script in ${SCRIPTS} 340f7ee8cfeSRuslan Ermilov.if defined(SCRIPTSNAME) 341f7ee8cfeSRuslan ErmilovSCRIPTSNAME_${script:T}?= ${SCRIPTSNAME} 342f7ee8cfeSRuslan Ermilov.else 343f7ee8cfeSRuslan ErmilovSCRIPTSNAME_${script:T}?= ${script:T:R} 344f7ee8cfeSRuslan Ermilov.endif 345f7ee8cfeSRuslan ErmilovSCRIPTSDIR_${script:T}?= ${SCRIPTSDIR} 346f7ee8cfeSRuslan ErmilovSCRIPTSOWN_${script:T}?= ${SCRIPTSOWN} 347f7ee8cfeSRuslan ErmilovSCRIPTSGRP_${script:T}?= ${SCRIPTSGRP} 348f7ee8cfeSRuslan ErmilovSCRIPTSMODE_${script:T}?= ${SCRIPTSMODE} 349116d4508SSimon J. GerratySTAGE_AS_${script:T}= ${SCRIPTSDIR_${script:T}}/${SCRIPTSNAME_${script:T}} 350a7aaf57eSRuslan Ermilov_scriptsinstall: _SCRIPTSINS_${script:T} 351a7aaf57eSRuslan Ermilov_SCRIPTSINS_${script:T}: ${script} 352dc6d22c9SBaptiste Daroussin ${INSTALL} ${TAG_ARGS} -o ${SCRIPTSOWN_${.ALLSRC:T}} \ 353f7ee8cfeSRuslan Ermilov -g ${SCRIPTSGRP_${.ALLSRC:T}} -m ${SCRIPTSMODE_${.ALLSRC:T}} \ 3544367bda6SRuslan Ermilov ${.ALLSRC} \ 355f7ee8cfeSRuslan Ermilov ${DESTDIR}${SCRIPTSDIR_${.ALLSRC:T}}/${SCRIPTSNAME_${.ALLSRC:T}} 356f7ee8cfeSRuslan Ermilov.endfor 357f7ee8cfeSRuslan Ermilov.endif 358f7ee8cfeSRuslan Ermilov 3598479adc1SRuslan ErmilovNLSNAME?= ${PROG} 3608479adc1SRuslan Ermilov.include <bsd.nls.mk> 3618479adc1SRuslan Ermilov 3629b4f4918SBaptiste Daroussin.include <bsd.confs.mk> 363af2dc868SRuslan Ermilov.include <bsd.files.mk> 3645d862037SRuslan Ermilov.include <bsd.incs.mk> 365fa8c921eSBrooks Davis 366fa8c921eSBrooks DavisLINKOWN?= ${BINOWN} 367fa8c921eSBrooks DavisLINKGRP?= ${BINGRP} 368fa8c921eSBrooks DavisLINKMODE?= ${BINMODE} 36984f94a79SRuslan Ermilov.include <bsd.links.mk> 370c7b111cbSRuslan Ermilov 371e1fe3dbaSRuslan Ermilov.if ${MK_MAN} != "no" 372f1702f87SBryan Dreweryrealinstall: maninstall 373f1702f87SBryan Drewery.ORDER: beforeinstall maninstall 37487829387SRuslan Ermilov.endif 37587829387SRuslan Ermilov 376abb02fa2SBryan Drewery.endif # !target(install) 377afe61c15SRodney W. Grimes 378e1fe3dbaSRuslan Ermilov.if ${MK_MAN} != "no" 379afe61c15SRodney W. Grimes.include <bsd.man.mk> 38069b87d3eSEivind Eklund.endif 38169b87d3eSEivind Eklund 38238f8fddfSEnji Cooper.if defined(HAS_TESTS) 38338f8fddfSEnji CooperMAKE+= MK_MAKE_CHECK_USE_SANDBOX=yes 38438f8fddfSEnji CooperSUBDIR_TARGETS+= check 38538f8fddfSEnji CooperTESTS_LD_LIBRARY_PATH+= ${.OBJDIR} 38638f8fddfSEnji CooperTESTS_PATH+= ${.OBJDIR} 38738f8fddfSEnji Cooper.endif 38838f8fddfSEnji Cooper 389d7beff08SBryan Drewery.if defined(PROG) 390d7beff08SBryan DreweryOBJS_DEPEND_GUESS+= ${SRCS:M*.h} 39188fe1f7aSBryan Drewery.endif 39288fe1f7aSBryan Drewery 39388fe1f7aSBryan Drewery.include <bsd.dep.mk> 394aae63957SBryan Drewery.include <bsd.clang-analyze.mk> 395cd9a2f5cSJordan K. Hubbard.include <bsd.obj.mk> 396d510ecb4SKris Kennaway.include <bsd.sys.mk> 397