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 444ca6ecf1SJessica Clarke.if ${LINKER_TYPE} != "mac" 452f3a9614SEd Maste.if ${MK_RELRO} == "no" 462f3a9614SEd MasteLDFLAGS+= -Wl,-znorelro 472f3a9614SEd Maste.else 482f3a9614SEd MasteLDFLAGS+= -Wl,-zrelro 492f3a9614SEd Maste.endif 507927452aSEd Maste.endif 518e1e3e1cSEd Maste.if ${MK_PIE} != "no" 528e1e3e1cSEd Maste# Static PIE is not yet supported/tested. 538e1e3e1cSEd Maste.if !defined(NO_SHARED) || ${NO_SHARED:tl} == "no" 54bcf99d2dSEd MasteCFLAGS+= -fPIE 55bcf99d2dSEd MasteCXXFLAGS+= -fPIE 56bcf99d2dSEd MasteLDFLAGS+= -pie 57bcf99d2dSEd Maste.endif 588e1e3e1cSEd Maste.endif 59fc191b11SEd Maste.if ${MK_RETPOLINE} != "no" 60e5c6deceSEd Maste.if ${COMPILER_FEATURES:Mretpoline} && ${LINKER_FEATURES:Mretpoline} 61fc191b11SEd MasteCFLAGS+= -mretpoline 62fc191b11SEd MasteCXXFLAGS+= -mretpoline 6314608708SEd Maste# retpolineplt is broken with static linking (PR 233336) 64447b492eSEd Maste.if !defined(NO_SHARED) || ${NO_SHARED:tl} == "no" 65fc191b11SEd MasteLDFLAGS+= -Wl,-zretpolineplt 66fc191b11SEd Maste.endif 67e5c6deceSEd Maste.else 68e5c6deceSEd Maste.warning Retpoline requested but not supported by compiler or linker 69e5c6deceSEd Maste.endif 7014608708SEd Maste.endif 71fc191b11SEd Maste 72e268fd0aSBrooks Davis# Initialize stack variables on function entry 73e268fd0aSBrooks Davis.if ${MK_INIT_ALL_ZERO} == "yes" 74e268fd0aSBrooks Davis.if ${COMPILER_FEATURES:Minit-all} 75*3006f6dfSDimitry AndricCFLAGS+= -ftrivial-auto-var-init=zero 76*3006f6dfSDimitry AndricCXXFLAGS+= -ftrivial-auto-var-init=zero 77*3006f6dfSDimitry Andric.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 160000 78*3006f6dfSDimitry AndricCFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang 79*3006f6dfSDimitry AndricCXXFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang 80*3006f6dfSDimitry Andric.endif 81e268fd0aSBrooks Davis.else 82*3006f6dfSDimitry Andric.warning InitAll (zeros) requested but not supported by compiler 83e268fd0aSBrooks Davis.endif 84e268fd0aSBrooks Davis.elif ${MK_INIT_ALL_PATTERN} == "yes" 85e268fd0aSBrooks Davis.if ${COMPILER_FEATURES:Minit-all} 86e268fd0aSBrooks DavisCFLAGS+= -ftrivial-auto-var-init=pattern 87e268fd0aSBrooks DavisCXXFLAGS+= -ftrivial-auto-var-init=pattern 88e268fd0aSBrooks Davis.else 89*3006f6dfSDimitry Andric.warning InitAll (pattern) requested but not supported by compiler 90e268fd0aSBrooks Davis.endif 91e268fd0aSBrooks Davis.endif 92e268fd0aSBrooks Davis 93428a32edSAlex Richardson# bsd.sanitizer.mk is not installed, so don't require it (e.g. for ports). 94428a32edSAlex Richardson.sinclude "bsd.sanitizer.mk" 957bc797e3SAlex Richardson 9679f59915SJohn Baldwin.if ${MACHINE_CPUARCH} == "riscv" && ${LINKER_FEATURES:Mriscv-relaxations} == "" 9779f59915SJohn BaldwinCFLAGS += -mno-relax 9879f59915SJohn Baldwin.endif 9979f59915SJohn Baldwin 10041f89315SRuslan Ermilov.if defined(CRUNCH_CFLAGS) 1013c9b8563SGordon TetlowCFLAGS+=${CRUNCH_CFLAGS} 10242f8c5b5SEd Maste.else 10342f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \ 10442f8c5b5SEd Maste empty(DEBUG_FLAGS:M-gdwarf-*) 105c910570eSEd Maste.if !${COMPILER_FEATURES:Mcompressed-debug} 106c910570eSEd MasteCFLAGS+= ${DEBUG_FILES_CFLAGS:N-gz*} 107c910570eSEd Maste.else 108de6feefdSJohn BaldwinCFLAGS+= ${DEBUG_FILES_CFLAGS} 109c910570eSEd Maste.endif 11042f8c5b5SEd MasteCTFFLAGS+= -g 11142f8c5b5SEd Maste.endif 11241f89315SRuslan Ermilov.endif 113afe61c15SRodney W. Grimes 114e82b0b99SJordan K. Hubbard.if !defined(DEBUG_FLAGS) 115afe61c15SRodney W. GrimesSTRIP?= -s 116e82b0b99SJordan K. Hubbard.endif 117afe61c15SRodney W. Grimes 118dc6d22c9SBaptiste Daroussin.if defined(NO_ROOT) 119dc6d22c9SBaptiste Daroussin.if !defined(TAGS) || ! ${TAGS:Mpackage=*} 1204c1a82ceSEmmanuel VadotTAGS+= package=${PACKAGE:Uutilities} 121dc6d22c9SBaptiste Daroussin.endif 122dc6d22c9SBaptiste DaroussinTAG_ARGS= -T ${TAGS:[*]:S/ /,/g} 123dc6d22c9SBaptiste Daroussin.endif 124dc6d22c9SBaptiste Daroussin 125a335df48SConrad Meyer.if defined(NO_SHARED) && ${NO_SHARED:tl} != "no" 1263585b293SGarrett WollmanLDFLAGS+= -static 1273585b293SGarrett Wollman.endif 128afe61c15SRodney W. Grimes 12942f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" 13042f8c5b5SEd MastePROG_FULL=${PROG}.full 13142f8c5b5SEd Maste# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory 13242f8c5b5SEd Maste.if defined(BINDIR) && (\ 13342f8c5b5SEd Maste ${BINDIR} == "/bin" ||\ 1345ea4b6d5SEd Maste ${BINDIR:C%/libexec(/.*)?%/libexec%} == "/libexec" ||\ 13542f8c5b5SEd Maste ${BINDIR} == "/sbin" ||\ 136b60371f8SEd Maste ${BINDIR:C%/usr/(bin|bsdinstall|libexec|lpr|sendmail|sm.bin|sbin|tests)(/.*)?%/usr/bin%} == "/usr/bin" ||\ 137b60371f8SEd Maste ${BINDIR} == "/usr/lib" \ 13842f8c5b5SEd Maste ) 13942f8c5b5SEd MasteDEBUGFILEDIR= ${DEBUGDIR}${BINDIR} 14042f8c5b5SEd Maste.else 14142f8c5b5SEd MasteDEBUGFILEDIR?= ${BINDIR}/.debug 142a324b0f0SBryan Drewery.endif 143a324b0f0SBryan Drewery.if !exists(${DESTDIR}${DEBUGFILEDIR}) 14442f8c5b5SEd MasteDEBUGMKDIR= 14542f8c5b5SEd Maste.endif 14642f8c5b5SEd Maste.else 14742f8c5b5SEd MastePROG_FULL= ${PROG} 14847bf8a5cSRuslan Ermilov.endif 14947bf8a5cSRuslan Ermilov 150afe61c15SRodney W. Grimes.if defined(PROG) 151a0dc5970SEd MastePROGNAME?= ${PROG} 15242f8c5b5SEd Maste 153afe61c15SRodney W. Grimes.if defined(SRCS) 154afe61c15SRodney W. Grimes 1552506d700SSimon J. GerratyOBJS+= ${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/g} 156afe61c15SRodney W. Grimes 1574f2fac37SJonathan Anderson# LLVM bitcode / textual IR representations of the program 1584f2fac37SJonathan AndersonBCOBJS+=${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.bco/g} 1594f2fac37SJonathan AndersonLLOBJS+=${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.llo/g} 1604f2fac37SJonathan Anderson 161c2c48445SRui Paulo.if target(beforelinking) 162593c0b49SMark Johnstonbeforelinking: ${OBJS} 16342f8c5b5SEd Maste${PROG_FULL}: beforelinking 164c2c48445SRui Paulo.endif 1655852ae2dSBryan Drewery${PROG_FULL}: ${OBJS} 1665d68012aSRuslan Ermilov.if defined(PROG_CXX) 1679160419cSBryan Drewery ${CXX:N${CCACHE_BIN}} ${CXXFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} \ 1689160419cSBryan Drewery ${OBJS} ${LDADD} 1695d68012aSRuslan Ermilov.else 1709160419cSBryan Drewery ${CC:N${CCACHE_BIN}} ${CFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} ${OBJS} \ 1719160419cSBryan Drewery ${LDADD} 1725d68012aSRuslan Ermilov.endif 17383cb5baeSMax Khon.if ${MK_CTF} != "no" 174cd49c2e8SMax Khon ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} 175cd49c2e8SMax Khon.endif 1765d68012aSRuslan Ermilov 17784aac273SHartmut Brandt.else # !defined(SRCS) 178afe61c15SRodney W. Grimes 1795d68012aSRuslan Ermilov.if !target(${PROG}) 18047bf8a5cSRuslan Ermilov.if defined(PROG_CXX) 18147bf8a5cSRuslan ErmilovSRCS= ${PROG}.cc 18247bf8a5cSRuslan Ermilov.else 183afe61c15SRodney W. GrimesSRCS= ${PROG}.c 18447bf8a5cSRuslan Ermilov.endif 185afe61c15SRodney W. Grimes 186a4c39c7aSBruce Evans# Always make an intermediate object file because: 187a4c39c7aSBruce Evans# - it saves time rebuilding when only the library has changed 188a4c39c7aSBruce Evans# - the name of the object gets put into the executable symbol table instead of 189a4c39c7aSBruce Evans# the name of a variable temporary object. 190a4c39c7aSBruce Evans# - it's useful to keep objects around for crunching. 1917f7fc25bSMark JohnstonOBJS+= ${PROG}.o 1924f2fac37SJonathan AndersonBCOBJS+= ${PROG}.bc 1934f2fac37SJonathan AndersonLLOBJS+= ${PROG}.ll 1944f2fac37SJonathan AndersonCLEANFILES+= ${PROG}.o ${PROG}.bc ${PROG}.ll 195f5c75051SEivind Eklund 196c2c48445SRui Paulo.if target(beforelinking) 197593c0b49SMark Johnstonbeforelinking: ${OBJS} 19842f8c5b5SEd Maste${PROG_FULL}: beforelinking 199c2c48445SRui Paulo.endif 2005852ae2dSBryan Drewery${PROG_FULL}: ${OBJS} 201f8ba1555SRuslan Ermilov.if defined(PROG_CXX) 2029160419cSBryan Drewery ${CXX:N${CCACHE_BIN}} ${CXXFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} \ 2039160419cSBryan Drewery ${OBJS} ${LDADD} 204f8ba1555SRuslan Ermilov.else 2059160419cSBryan Drewery ${CC:N${CCACHE_BIN}} ${CFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} ${OBJS} \ 2069160419cSBryan Drewery ${LDADD} 207afe61c15SRodney W. Grimes.endif 20883cb5baeSMax Khon.if ${MK_CTF} != "no" 209cd49c2e8SMax Khon ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} 210cd49c2e8SMax Khon.endif 21142f8c5b5SEd Maste.endif # !target(${PROG}) 212f5c75051SEivind Eklund 2130d947ed1SEd Maste.endif # !defined(SRCS) 214afe61c15SRodney W. Grimes 21542f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" 2165852ae2dSBryan Drewery${PROG}: ${PROG_FULL} ${PROGNAME}.debug 21742f8c5b5SEd Maste ${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROGNAME}.debug \ 21842f8c5b5SEd Maste ${PROG_FULL} ${.TARGET} 21942f8c5b5SEd Maste 2205852ae2dSBryan Drewery${PROGNAME}.debug: ${PROG_FULL} 22142f8c5b5SEd Maste ${OBJCOPY} --only-keep-debug ${PROG_FULL} ${.TARGET} 22242f8c5b5SEd Maste.endif 22342f8c5b5SEd Maste 224e4195e2eSJonathan Anderson.if defined(LLVM_LINK) 225e4195e2eSJonathan Anderson${PROG_FULL}.bc: ${BCOBJS} 226e4195e2eSJonathan Anderson ${LLVM_LINK} -o ${.TARGET} ${BCOBJS} 227e4195e2eSJonathan Anderson 228e4195e2eSJonathan Anderson${PROG_FULL}.ll: ${LLOBJS} 229e4195e2eSJonathan Anderson ${LLVM_LINK} -S -o ${.TARGET} ${LLOBJS} 230e4195e2eSJonathan Anderson 2316f6b66a8SJonathan AndersonCLEANFILES+= ${PROG_FULL}.bc ${PROG_FULL}.ll 232e4195e2eSJonathan Anderson.endif # defined(LLVM_LINK) 233e4195e2eSJonathan Anderson 234e1fe3dbaSRuslan Ermilov.if ${MK_MAN} != "no" && !defined(MAN) && \ 235862d3deaSRuslan Ermilov !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ 236afe61c15SRodney W. Grimes !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ 2378b4f1f91SBrooks Davis !defined(MAN7) && !defined(MAN8) && !defined(MAN9) 23819ea15a1SRuslan ErmilovMAN= ${PROG}.1 23919ea15a1SRuslan ErmilovMAN1= ${MAN} 240afe61c15SRodney W. Grimes.endif 2410d947ed1SEd Maste.endif # defined(PROG) 242afe61c15SRodney W. Grimes 2437750ad47SMarcel Moolenaar.if defined(_SKIP_BUILD) 2447750ad47SMarcel Moolenaarall: 2457750ad47SMarcel Moolenaar.else 2467c8d3811SMarcin Wojtas.if target(afterbuild) 2477c8d3811SMarcin Wojtas.ORDER: ${PROG} afterbuild 2487c8d3811SMarcin Wojtasall: ${PROG} ${SCRIPTS} afterbuild 2497c8d3811SMarcin Wojtas.else 2501bd4272fSBryan Dreweryall: ${PROG} ${SCRIPTS} 2517c8d3811SMarcin Wojtas.endif 252e1fe3dbaSRuslan Ermilov.if ${MK_MAN} != "no" 253f1702f87SBryan Dreweryall: all-man 254862d3deaSRuslan Ermilov.endif 2557750ad47SMarcel Moolenaar.endif 256afe61c15SRodney W. Grimes 25741f89315SRuslan Ermilov.if defined(PROG) 258e4195e2eSJonathan AndersonCLEANFILES+= ${PROG} ${PROG}.bc ${PROG}.ll 25942f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" 2606f6b66a8SJonathan AndersonCLEANFILES+= ${PROG_FULL} ${PROGNAME}.debug 26142f8c5b5SEd Maste.endif 26241f89315SRuslan Ermilov.endif 26341f89315SRuslan Ermilov 26441f89315SRuslan Ermilov.if defined(OBJS) 265e4195e2eSJonathan AndersonCLEANFILES+= ${OBJS} ${BCOBJS} ${LLOBJS} 26641f89315SRuslan Ermilov.endif 267afe61c15SRodney W. Grimes 26851fa76c4SRuslan Ermilov.include <bsd.libnames.mk> 26951fa76c4SRuslan Ermilov 270218a2cd2SBruce Evans.if defined(PROG) 271799483e4SBryan Drewery.if !defined(NO_EXTRADEPEND) 272663e9677SBruce Evans_EXTRADEPEND: 27351fa76c4SRuslan Ermilov.if defined(LDFLAGS) && !empty(LDFLAGS:M-nostdlib) 27451fa76c4SRuslan Ermilov.if defined(DPADD) && !empty(DPADD) 27537fd8bc2SJohn Baldwin echo ${PROG_FULL}: ${DPADD} >> ${DEPENDFILE} 27651fa76c4SRuslan Ermilov.endif 27751fa76c4SRuslan Ermilov.else 27837fd8bc2SJohn Baldwin echo ${PROG_FULL}: ${LIBC} ${DPADD} >> ${DEPENDFILE} 2797273339dSWarner Losh.if defined(PROG_CXX) 28037fd8bc2SJohn Baldwin echo ${PROG_FULL}: ${LIBCPLUSPLUS} >> ${DEPENDFILE} 2818c05a446SPeter Wemm.endif 28251fa76c4SRuslan Ermilov.endif 283799483e4SBryan Drewery.endif # !defined(NO_EXTRADEPEND) 284d515c63dSDimitry Andric.endif 285663e9677SBruce Evans 286afe61c15SRodney W. Grimes.if !target(install) 287afe61c15SRodney W. Grimes 288212acbefSRuslan Ermilov.if defined(PRECIOUSPROG) 28900fbd407SRuslan Ermilov.if !defined(NO_FSCHG) 290dee651ebSRuslan ErmilovINSTALLFLAGS+= -fschg 291dee651ebSRuslan Ermilov.endif 292212acbefSRuslan ErmilovINSTALLFLAGS+= -S 293212acbefSRuslan Ermilov.endif 294dee651ebSRuslan Ermilov 295e902c1bbSTim Vanderhoek_INSTALLFLAGS:= ${INSTALLFLAGS} 296e902c1bbSTim Vanderhoek.for ie in ${INSTALLFLAGS_EDIT} 297e902c1bbSTim Vanderhoek_INSTALLFLAGS:= ${_INSTALLFLAGS${ie}} 298e902c1bbSTim Vanderhoek.endfor 299e902c1bbSTim Vanderhoek 30051fa76c4SRuslan Ermilov.if !target(realinstall) && !defined(INTERNALPROG) 30187829387SRuslan Ermilovrealinstall: _proginstall 302badb7c1cSRuslan Ermilov.ORDER: beforeinstall _proginstall 30387829387SRuslan Ermilov_proginstall: 304afe61c15SRodney W. Grimes.if defined(PROG) 305dc6d22c9SBaptiste Daroussin ${INSTALL} ${TAG_ARGS} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 30695f8c826SRuslan Ermilov ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME} 30742f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" 30842f8c5b5SEd Maste.if defined(DEBUGMKDIR) 309697b271dSEd Maste ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -d ${DESTDIR}${DEBUGFILEDIR}/ 31042f8c5b5SEd Maste.endif 311697b271dSEd Maste ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -o ${BINOWN} -g ${BINGRP} -m ${DEBUGMODE} \ 31242f8c5b5SEd Maste ${PROGNAME}.debug ${DESTDIR}${DEBUGFILEDIR}/${PROGNAME}.debug 31342f8c5b5SEd Maste.endif 31495f8c826SRuslan Ermilov.endif 31584aac273SHartmut Brandt.endif # !target(realinstall) 316afe61c15SRodney W. Grimes 317f7ee8cfeSRuslan Ermilov.if defined(SCRIPTS) && !empty(SCRIPTS) 318f7ee8cfeSRuslan Ermilovrealinstall: _scriptsinstall 319badb7c1cSRuslan Ermilov.ORDER: beforeinstall _scriptsinstall 320f7ee8cfeSRuslan Ermilov 321f7ee8cfeSRuslan ErmilovSCRIPTSDIR?= ${BINDIR} 322f7ee8cfeSRuslan ErmilovSCRIPTSOWN?= ${BINOWN} 323f7ee8cfeSRuslan ErmilovSCRIPTSGRP?= ${BINGRP} 324f7ee8cfeSRuslan ErmilovSCRIPTSMODE?= ${BINMODE} 325f7ee8cfeSRuslan Ermilov 326116d4508SSimon J. GerratySTAGE_AS_SETS+= scripts 327116d4508SSimon J. Gerratystage_as.scripts: ${SCRIPTS} 328116d4508SSimon J. GerratyFLAGS.stage_as.scripts= -m ${SCRIPTSMODE} 329116d4508SSimon J. GerratySTAGE_FILES_DIR.scripts= ${STAGE_OBJTOP} 330f7ee8cfeSRuslan Ermilov.for script in ${SCRIPTS} 331f7ee8cfeSRuslan Ermilov.if defined(SCRIPTSNAME) 332f7ee8cfeSRuslan ErmilovSCRIPTSNAME_${script:T}?= ${SCRIPTSNAME} 333f7ee8cfeSRuslan Ermilov.else 334f7ee8cfeSRuslan ErmilovSCRIPTSNAME_${script:T}?= ${script:T:R} 335f7ee8cfeSRuslan Ermilov.endif 336f7ee8cfeSRuslan ErmilovSCRIPTSDIR_${script:T}?= ${SCRIPTSDIR} 337f7ee8cfeSRuslan ErmilovSCRIPTSOWN_${script:T}?= ${SCRIPTSOWN} 338f7ee8cfeSRuslan ErmilovSCRIPTSGRP_${script:T}?= ${SCRIPTSGRP} 339f7ee8cfeSRuslan ErmilovSCRIPTSMODE_${script:T}?= ${SCRIPTSMODE} 340116d4508SSimon J. GerratySTAGE_AS_${script:T}= ${SCRIPTSDIR_${script:T}}/${SCRIPTSNAME_${script:T}} 341a7aaf57eSRuslan Ermilov_scriptsinstall: _SCRIPTSINS_${script:T} 342a7aaf57eSRuslan Ermilov_SCRIPTSINS_${script:T}: ${script} 343dc6d22c9SBaptiste Daroussin ${INSTALL} ${TAG_ARGS} -o ${SCRIPTSOWN_${.ALLSRC:T}} \ 344f7ee8cfeSRuslan Ermilov -g ${SCRIPTSGRP_${.ALLSRC:T}} -m ${SCRIPTSMODE_${.ALLSRC:T}} \ 3454367bda6SRuslan Ermilov ${.ALLSRC} \ 346f7ee8cfeSRuslan Ermilov ${DESTDIR}${SCRIPTSDIR_${.ALLSRC:T}}/${SCRIPTSNAME_${.ALLSRC:T}} 347f7ee8cfeSRuslan Ermilov.endfor 348f7ee8cfeSRuslan Ermilov.endif 349f7ee8cfeSRuslan Ermilov 3508479adc1SRuslan ErmilovNLSNAME?= ${PROG} 3518479adc1SRuslan Ermilov.include <bsd.nls.mk> 3528479adc1SRuslan Ermilov 3539b4f4918SBaptiste Daroussin.include <bsd.confs.mk> 354af2dc868SRuslan Ermilov.include <bsd.files.mk> 3555d862037SRuslan Ermilov.include <bsd.incs.mk> 356fa8c921eSBrooks Davis 357fa8c921eSBrooks DavisLINKOWN?= ${BINOWN} 358fa8c921eSBrooks DavisLINKGRP?= ${BINGRP} 359fa8c921eSBrooks DavisLINKMODE?= ${BINMODE} 36084f94a79SRuslan Ermilov.include <bsd.links.mk> 361c7b111cbSRuslan Ermilov 362e1fe3dbaSRuslan Ermilov.if ${MK_MAN} != "no" 363f1702f87SBryan Dreweryrealinstall: maninstall 364f1702f87SBryan Drewery.ORDER: beforeinstall maninstall 36587829387SRuslan Ermilov.endif 36687829387SRuslan Ermilov 367abb02fa2SBryan Drewery.endif # !target(install) 368afe61c15SRodney W. Grimes 369e1fe3dbaSRuslan Ermilov.if ${MK_MAN} != "no" 370afe61c15SRodney W. Grimes.include <bsd.man.mk> 37169b87d3eSEivind Eklund.endif 37269b87d3eSEivind Eklund 37338f8fddfSEnji Cooper.if defined(HAS_TESTS) 37438f8fddfSEnji CooperMAKE+= MK_MAKE_CHECK_USE_SANDBOX=yes 37538f8fddfSEnji CooperSUBDIR_TARGETS+= check 37638f8fddfSEnji CooperTESTS_LD_LIBRARY_PATH+= ${.OBJDIR} 37738f8fddfSEnji CooperTESTS_PATH+= ${.OBJDIR} 37838f8fddfSEnji Cooper.endif 37938f8fddfSEnji Cooper 380d7beff08SBryan Drewery.if defined(PROG) 381d7beff08SBryan DreweryOBJS_DEPEND_GUESS+= ${SRCS:M*.h} 38288fe1f7aSBryan Drewery.endif 38388fe1f7aSBryan Drewery 38488fe1f7aSBryan Drewery.include <bsd.dep.mk> 385aae63957SBryan Drewery.include <bsd.clang-analyze.mk> 386cd9a2f5cSJordan K. Hubbard.include <bsd.obj.mk> 387d510ecb4SKris Kennaway.include <bsd.sys.mk> 388