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 72fc191b11SEd Maste 73e268fd0aSBrooks Davis# Initialize stack variables on function entry 74*2befa269SBrooks Davis.if ${OPT_INIT_ALL} != "none" 75e268fd0aSBrooks Davis.if ${COMPILER_FEATURES:Minit-all} 76*2befa269SBrooks DavisCFLAGS+= -ftrivial-auto-var-init=${OPT_INIT_ALL} 77*2befa269SBrooks DavisCXXFLAGS+= -ftrivial-auto-var-init=${OPT_INIT_ALL} 78*2befa269SBrooks Davis.if ${OPT_INIT_ALL} == "zero" && ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 160000 793006f6dfSDimitry AndricCFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang 803006f6dfSDimitry AndricCXXFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang 813006f6dfSDimitry Andric.endif 82e268fd0aSBrooks Davis.else 83*2befa269SBrooks Davis.warning INIT_ALL (${OPT_INIT_ALL}) requested but not supported by compiler 84e268fd0aSBrooks Davis.endif 85e268fd0aSBrooks Davis.endif 86e268fd0aSBrooks Davis 87428a32edSAlex Richardson# bsd.sanitizer.mk is not installed, so don't require it (e.g. for ports). 88428a32edSAlex Richardson.sinclude "bsd.sanitizer.mk" 897bc797e3SAlex Richardson 9079f59915SJohn Baldwin.if ${MACHINE_CPUARCH} == "riscv" && ${LINKER_FEATURES:Mriscv-relaxations} == "" 9179f59915SJohn BaldwinCFLAGS += -mno-relax 9279f59915SJohn Baldwin.endif 9379f59915SJohn Baldwin 9441f89315SRuslan Ermilov.if defined(CRUNCH_CFLAGS) 953c9b8563SGordon TetlowCFLAGS+=${CRUNCH_CFLAGS} 9642f8c5b5SEd Maste.else 9742f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \ 9842f8c5b5SEd Maste empty(DEBUG_FLAGS:M-gdwarf-*) 99c910570eSEd Maste.if !${COMPILER_FEATURES:Mcompressed-debug} 100c910570eSEd MasteCFLAGS+= ${DEBUG_FILES_CFLAGS:N-gz*} 101c910570eSEd Maste.else 102de6feefdSJohn BaldwinCFLAGS+= ${DEBUG_FILES_CFLAGS} 103c910570eSEd Maste.endif 10442f8c5b5SEd MasteCTFFLAGS+= -g 10542f8c5b5SEd Maste.endif 10641f89315SRuslan Ermilov.endif 107afe61c15SRodney W. Grimes 108e82b0b99SJordan K. Hubbard.if !defined(DEBUG_FLAGS) 109afe61c15SRodney W. GrimesSTRIP?= -s 110e82b0b99SJordan K. Hubbard.endif 111afe61c15SRodney W. Grimes 112dc6d22c9SBaptiste Daroussin.if defined(NO_ROOT) 113dc6d22c9SBaptiste Daroussin.if !defined(TAGS) || ! ${TAGS:Mpackage=*} 1144c1a82ceSEmmanuel VadotTAGS+= package=${PACKAGE:Uutilities} 115dc6d22c9SBaptiste Daroussin.endif 116dc6d22c9SBaptiste DaroussinTAG_ARGS= -T ${TAGS:[*]:S/ /,/g} 117dc6d22c9SBaptiste Daroussin.endif 118dc6d22c9SBaptiste Daroussin 119a335df48SConrad Meyer.if defined(NO_SHARED) && ${NO_SHARED:tl} != "no" 1203585b293SGarrett WollmanLDFLAGS+= -static 1213585b293SGarrett Wollman.endif 122afe61c15SRodney W. Grimes 12342f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" 12442f8c5b5SEd MastePROG_FULL=${PROG}.full 12542f8c5b5SEd Maste# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory 12642f8c5b5SEd Maste.if defined(BINDIR) && (\ 12742f8c5b5SEd Maste ${BINDIR} == "/bin" ||\ 1285ea4b6d5SEd Maste ${BINDIR:C%/libexec(/.*)?%/libexec%} == "/libexec" ||\ 12942f8c5b5SEd Maste ${BINDIR} == "/sbin" ||\ 130b60371f8SEd Maste ${BINDIR:C%/usr/(bin|bsdinstall|libexec|lpr|sendmail|sm.bin|sbin|tests)(/.*)?%/usr/bin%} == "/usr/bin" ||\ 131b60371f8SEd Maste ${BINDIR} == "/usr/lib" \ 13242f8c5b5SEd Maste ) 13342f8c5b5SEd MasteDEBUGFILEDIR= ${DEBUGDIR}${BINDIR} 13442f8c5b5SEd Maste.else 13542f8c5b5SEd MasteDEBUGFILEDIR?= ${BINDIR}/.debug 136a324b0f0SBryan Drewery.endif 137a324b0f0SBryan Drewery.if !exists(${DESTDIR}${DEBUGFILEDIR}) 13842f8c5b5SEd MasteDEBUGMKDIR= 13942f8c5b5SEd Maste.endif 14042f8c5b5SEd Maste.else 14142f8c5b5SEd MastePROG_FULL= ${PROG} 14247bf8a5cSRuslan Ermilov.endif 14347bf8a5cSRuslan Ermilov 144afe61c15SRodney W. Grimes.if defined(PROG) 145a0dc5970SEd MastePROGNAME?= ${PROG} 14642f8c5b5SEd Maste 147afe61c15SRodney W. Grimes.if defined(SRCS) 148afe61c15SRodney W. Grimes 1492506d700SSimon J. GerratyOBJS+= ${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/g} 150afe61c15SRodney W. Grimes 1514f2fac37SJonathan Anderson# LLVM bitcode / textual IR representations of the program 1524f2fac37SJonathan AndersonBCOBJS+=${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.bco/g} 1534f2fac37SJonathan AndersonLLOBJS+=${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.llo/g} 1544f2fac37SJonathan Anderson 155c2c48445SRui Paulo.if target(beforelinking) 156593c0b49SMark Johnstonbeforelinking: ${OBJS} 15742f8c5b5SEd Maste${PROG_FULL}: beforelinking 158c2c48445SRui Paulo.endif 1595852ae2dSBryan Drewery${PROG_FULL}: ${OBJS} 1605d68012aSRuslan Ermilov.if defined(PROG_CXX) 1619160419cSBryan Drewery ${CXX:N${CCACHE_BIN}} ${CXXFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} \ 1629160419cSBryan Drewery ${OBJS} ${LDADD} 1635d68012aSRuslan Ermilov.else 1649160419cSBryan Drewery ${CC:N${CCACHE_BIN}} ${CFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} ${OBJS} \ 1659160419cSBryan Drewery ${LDADD} 1665d68012aSRuslan Ermilov.endif 16783cb5baeSMax Khon.if ${MK_CTF} != "no" 168cd49c2e8SMax Khon ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} 169cd49c2e8SMax Khon.endif 1705d68012aSRuslan Ermilov 17184aac273SHartmut Brandt.else # !defined(SRCS) 172afe61c15SRodney W. Grimes 1735d68012aSRuslan Ermilov.if !target(${PROG}) 17447bf8a5cSRuslan Ermilov.if defined(PROG_CXX) 17547bf8a5cSRuslan ErmilovSRCS= ${PROG}.cc 17647bf8a5cSRuslan Ermilov.else 177afe61c15SRodney W. GrimesSRCS= ${PROG}.c 17847bf8a5cSRuslan Ermilov.endif 179afe61c15SRodney W. Grimes 180a4c39c7aSBruce Evans# Always make an intermediate object file because: 181a4c39c7aSBruce Evans# - it saves time rebuilding when only the library has changed 182a4c39c7aSBruce Evans# - the name of the object gets put into the executable symbol table instead of 183a4c39c7aSBruce Evans# the name of a variable temporary object. 184a4c39c7aSBruce Evans# - it's useful to keep objects around for crunching. 1857f7fc25bSMark JohnstonOBJS+= ${PROG}.o 1864f2fac37SJonathan AndersonBCOBJS+= ${PROG}.bc 1874f2fac37SJonathan AndersonLLOBJS+= ${PROG}.ll 1884f2fac37SJonathan AndersonCLEANFILES+= ${PROG}.o ${PROG}.bc ${PROG}.ll 189f5c75051SEivind Eklund 190c2c48445SRui Paulo.if target(beforelinking) 191593c0b49SMark Johnstonbeforelinking: ${OBJS} 19242f8c5b5SEd Maste${PROG_FULL}: beforelinking 193c2c48445SRui Paulo.endif 1945852ae2dSBryan Drewery${PROG_FULL}: ${OBJS} 195f8ba1555SRuslan Ermilov.if defined(PROG_CXX) 1969160419cSBryan Drewery ${CXX:N${CCACHE_BIN}} ${CXXFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} \ 1979160419cSBryan Drewery ${OBJS} ${LDADD} 198f8ba1555SRuslan Ermilov.else 1999160419cSBryan Drewery ${CC:N${CCACHE_BIN}} ${CFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} ${OBJS} \ 2009160419cSBryan Drewery ${LDADD} 201afe61c15SRodney W. Grimes.endif 20283cb5baeSMax Khon.if ${MK_CTF} != "no" 203cd49c2e8SMax Khon ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} 204cd49c2e8SMax Khon.endif 20542f8c5b5SEd Maste.endif # !target(${PROG}) 206f5c75051SEivind Eklund 2070d947ed1SEd Maste.endif # !defined(SRCS) 208afe61c15SRodney W. Grimes 20942f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" 2105852ae2dSBryan Drewery${PROG}: ${PROG_FULL} ${PROGNAME}.debug 21142f8c5b5SEd Maste ${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROGNAME}.debug \ 21242f8c5b5SEd Maste ${PROG_FULL} ${.TARGET} 21342f8c5b5SEd Maste 2145852ae2dSBryan Drewery${PROGNAME}.debug: ${PROG_FULL} 21542f8c5b5SEd Maste ${OBJCOPY} --only-keep-debug ${PROG_FULL} ${.TARGET} 21642f8c5b5SEd Maste.endif 21742f8c5b5SEd Maste 218e4195e2eSJonathan Anderson.if defined(LLVM_LINK) 219e4195e2eSJonathan Anderson${PROG_FULL}.bc: ${BCOBJS} 220e4195e2eSJonathan Anderson ${LLVM_LINK} -o ${.TARGET} ${BCOBJS} 221e4195e2eSJonathan Anderson 222e4195e2eSJonathan Anderson${PROG_FULL}.ll: ${LLOBJS} 223e4195e2eSJonathan Anderson ${LLVM_LINK} -S -o ${.TARGET} ${LLOBJS} 224e4195e2eSJonathan Anderson 2256f6b66a8SJonathan AndersonCLEANFILES+= ${PROG_FULL}.bc ${PROG_FULL}.ll 226e4195e2eSJonathan Anderson.endif # defined(LLVM_LINK) 227e4195e2eSJonathan Anderson 228e1fe3dbaSRuslan Ermilov.if ${MK_MAN} != "no" && !defined(MAN) && \ 229862d3deaSRuslan Ermilov !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ 230afe61c15SRodney W. Grimes !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ 2318b4f1f91SBrooks Davis !defined(MAN7) && !defined(MAN8) && !defined(MAN9) 23219ea15a1SRuslan ErmilovMAN= ${PROG}.1 23319ea15a1SRuslan ErmilovMAN1= ${MAN} 234afe61c15SRodney W. Grimes.endif 2350d947ed1SEd Maste.endif # defined(PROG) 236afe61c15SRodney W. Grimes 2377750ad47SMarcel Moolenaar.if defined(_SKIP_BUILD) 2387750ad47SMarcel Moolenaarall: 2397750ad47SMarcel Moolenaar.else 2407c8d3811SMarcin Wojtas.if target(afterbuild) 2417c8d3811SMarcin Wojtas.ORDER: ${PROG} afterbuild 2427c8d3811SMarcin Wojtasall: ${PROG} ${SCRIPTS} afterbuild 2437c8d3811SMarcin Wojtas.else 2441bd4272fSBryan Dreweryall: ${PROG} ${SCRIPTS} 2457c8d3811SMarcin Wojtas.endif 246e1fe3dbaSRuslan Ermilov.if ${MK_MAN} != "no" 247f1702f87SBryan Dreweryall: all-man 248862d3deaSRuslan Ermilov.endif 2497750ad47SMarcel Moolenaar.endif 250afe61c15SRodney W. Grimes 25141f89315SRuslan Ermilov.if defined(PROG) 252e4195e2eSJonathan AndersonCLEANFILES+= ${PROG} ${PROG}.bc ${PROG}.ll 25342f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" 2546f6b66a8SJonathan AndersonCLEANFILES+= ${PROG_FULL} ${PROGNAME}.debug 25542f8c5b5SEd Maste.endif 25641f89315SRuslan Ermilov.endif 25741f89315SRuslan Ermilov 25841f89315SRuslan Ermilov.if defined(OBJS) 259e4195e2eSJonathan AndersonCLEANFILES+= ${OBJS} ${BCOBJS} ${LLOBJS} 26041f89315SRuslan Ermilov.endif 261afe61c15SRodney W. Grimes 26251fa76c4SRuslan Ermilov.include <bsd.libnames.mk> 26351fa76c4SRuslan Ermilov 264218a2cd2SBruce Evans.if defined(PROG) 265799483e4SBryan Drewery.if !defined(NO_EXTRADEPEND) 266663e9677SBruce Evans_EXTRADEPEND: 26751fa76c4SRuslan Ermilov.if defined(LDFLAGS) && !empty(LDFLAGS:M-nostdlib) 26851fa76c4SRuslan Ermilov.if defined(DPADD) && !empty(DPADD) 26937fd8bc2SJohn Baldwin echo ${PROG_FULL}: ${DPADD} >> ${DEPENDFILE} 27051fa76c4SRuslan Ermilov.endif 27151fa76c4SRuslan Ermilov.else 27237fd8bc2SJohn Baldwin echo ${PROG_FULL}: ${LIBC} ${DPADD} >> ${DEPENDFILE} 2737273339dSWarner Losh.if defined(PROG_CXX) 27437fd8bc2SJohn Baldwin echo ${PROG_FULL}: ${LIBCPLUSPLUS} >> ${DEPENDFILE} 2758c05a446SPeter Wemm.endif 27651fa76c4SRuslan Ermilov.endif 277799483e4SBryan Drewery.endif # !defined(NO_EXTRADEPEND) 278d515c63dSDimitry Andric.endif 279663e9677SBruce Evans 280afe61c15SRodney W. Grimes.if !target(install) 281afe61c15SRodney W. Grimes 282212acbefSRuslan Ermilov.if defined(PRECIOUSPROG) 28300fbd407SRuslan Ermilov.if !defined(NO_FSCHG) 284dee651ebSRuslan ErmilovINSTALLFLAGS+= -fschg 285dee651ebSRuslan Ermilov.endif 286212acbefSRuslan ErmilovINSTALLFLAGS+= -S 287212acbefSRuslan Ermilov.endif 288dee651ebSRuslan Ermilov 289e902c1bbSTim Vanderhoek_INSTALLFLAGS:= ${INSTALLFLAGS} 290e902c1bbSTim Vanderhoek.for ie in ${INSTALLFLAGS_EDIT} 291e902c1bbSTim Vanderhoek_INSTALLFLAGS:= ${_INSTALLFLAGS${ie}} 292e902c1bbSTim Vanderhoek.endfor 293e902c1bbSTim Vanderhoek 29451fa76c4SRuslan Ermilov.if !target(realinstall) && !defined(INTERNALPROG) 29587829387SRuslan Ermilovrealinstall: _proginstall 296badb7c1cSRuslan Ermilov.ORDER: beforeinstall _proginstall 29787829387SRuslan Ermilov_proginstall: 298afe61c15SRodney W. Grimes.if defined(PROG) 299dc6d22c9SBaptiste Daroussin ${INSTALL} ${TAG_ARGS} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 30095f8c826SRuslan Ermilov ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME} 30142f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" 30242f8c5b5SEd Maste.if defined(DEBUGMKDIR) 303697b271dSEd Maste ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -d ${DESTDIR}${DEBUGFILEDIR}/ 30442f8c5b5SEd Maste.endif 305697b271dSEd Maste ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -o ${BINOWN} -g ${BINGRP} -m ${DEBUGMODE} \ 30642f8c5b5SEd Maste ${PROGNAME}.debug ${DESTDIR}${DEBUGFILEDIR}/${PROGNAME}.debug 30742f8c5b5SEd Maste.endif 30895f8c826SRuslan Ermilov.endif 30984aac273SHartmut Brandt.endif # !target(realinstall) 310afe61c15SRodney W. Grimes 311f7ee8cfeSRuslan Ermilov.if defined(SCRIPTS) && !empty(SCRIPTS) 312f7ee8cfeSRuslan Ermilovrealinstall: _scriptsinstall 313badb7c1cSRuslan Ermilov.ORDER: beforeinstall _scriptsinstall 314f7ee8cfeSRuslan Ermilov 315f7ee8cfeSRuslan ErmilovSCRIPTSDIR?= ${BINDIR} 316f7ee8cfeSRuslan ErmilovSCRIPTSOWN?= ${BINOWN} 317f7ee8cfeSRuslan ErmilovSCRIPTSGRP?= ${BINGRP} 318f7ee8cfeSRuslan ErmilovSCRIPTSMODE?= ${BINMODE} 319f7ee8cfeSRuslan Ermilov 320116d4508SSimon J. GerratySTAGE_AS_SETS+= scripts 321116d4508SSimon J. Gerratystage_as.scripts: ${SCRIPTS} 322116d4508SSimon J. GerratyFLAGS.stage_as.scripts= -m ${SCRIPTSMODE} 323116d4508SSimon J. GerratySTAGE_FILES_DIR.scripts= ${STAGE_OBJTOP} 324f7ee8cfeSRuslan Ermilov.for script in ${SCRIPTS} 325f7ee8cfeSRuslan Ermilov.if defined(SCRIPTSNAME) 326f7ee8cfeSRuslan ErmilovSCRIPTSNAME_${script:T}?= ${SCRIPTSNAME} 327f7ee8cfeSRuslan Ermilov.else 328f7ee8cfeSRuslan ErmilovSCRIPTSNAME_${script:T}?= ${script:T:R} 329f7ee8cfeSRuslan Ermilov.endif 330f7ee8cfeSRuslan ErmilovSCRIPTSDIR_${script:T}?= ${SCRIPTSDIR} 331f7ee8cfeSRuslan ErmilovSCRIPTSOWN_${script:T}?= ${SCRIPTSOWN} 332f7ee8cfeSRuslan ErmilovSCRIPTSGRP_${script:T}?= ${SCRIPTSGRP} 333f7ee8cfeSRuslan ErmilovSCRIPTSMODE_${script:T}?= ${SCRIPTSMODE} 334116d4508SSimon J. GerratySTAGE_AS_${script:T}= ${SCRIPTSDIR_${script:T}}/${SCRIPTSNAME_${script:T}} 335a7aaf57eSRuslan Ermilov_scriptsinstall: _SCRIPTSINS_${script:T} 336a7aaf57eSRuslan Ermilov_SCRIPTSINS_${script:T}: ${script} 337dc6d22c9SBaptiste Daroussin ${INSTALL} ${TAG_ARGS} -o ${SCRIPTSOWN_${.ALLSRC:T}} \ 338f7ee8cfeSRuslan Ermilov -g ${SCRIPTSGRP_${.ALLSRC:T}} -m ${SCRIPTSMODE_${.ALLSRC:T}} \ 3394367bda6SRuslan Ermilov ${.ALLSRC} \ 340f7ee8cfeSRuslan Ermilov ${DESTDIR}${SCRIPTSDIR_${.ALLSRC:T}}/${SCRIPTSNAME_${.ALLSRC:T}} 341f7ee8cfeSRuslan Ermilov.endfor 342f7ee8cfeSRuslan Ermilov.endif 343f7ee8cfeSRuslan Ermilov 3448479adc1SRuslan ErmilovNLSNAME?= ${PROG} 3458479adc1SRuslan Ermilov.include <bsd.nls.mk> 3468479adc1SRuslan Ermilov 3479b4f4918SBaptiste Daroussin.include <bsd.confs.mk> 348af2dc868SRuslan Ermilov.include <bsd.files.mk> 3495d862037SRuslan Ermilov.include <bsd.incs.mk> 350fa8c921eSBrooks Davis 351fa8c921eSBrooks DavisLINKOWN?= ${BINOWN} 352fa8c921eSBrooks DavisLINKGRP?= ${BINGRP} 353fa8c921eSBrooks DavisLINKMODE?= ${BINMODE} 35484f94a79SRuslan Ermilov.include <bsd.links.mk> 355c7b111cbSRuslan Ermilov 356e1fe3dbaSRuslan Ermilov.if ${MK_MAN} != "no" 357f1702f87SBryan Dreweryrealinstall: maninstall 358f1702f87SBryan Drewery.ORDER: beforeinstall maninstall 35987829387SRuslan Ermilov.endif 36087829387SRuslan Ermilov 361abb02fa2SBryan Drewery.endif # !target(install) 362afe61c15SRodney W. Grimes 363e1fe3dbaSRuslan Ermilov.if ${MK_MAN} != "no" 364afe61c15SRodney W. Grimes.include <bsd.man.mk> 36569b87d3eSEivind Eklund.endif 36669b87d3eSEivind Eklund 36738f8fddfSEnji Cooper.if defined(HAS_TESTS) 36838f8fddfSEnji CooperMAKE+= MK_MAKE_CHECK_USE_SANDBOX=yes 36938f8fddfSEnji CooperSUBDIR_TARGETS+= check 37038f8fddfSEnji CooperTESTS_LD_LIBRARY_PATH+= ${.OBJDIR} 37138f8fddfSEnji CooperTESTS_PATH+= ${.OBJDIR} 37238f8fddfSEnji Cooper.endif 37338f8fddfSEnji Cooper 374d7beff08SBryan Drewery.if defined(PROG) 375d7beff08SBryan DreweryOBJS_DEPEND_GUESS+= ${SRCS:M*.h} 37688fe1f7aSBryan Drewery.endif 37788fe1f7aSBryan Drewery 37888fe1f7aSBryan Drewery.include <bsd.dep.mk> 379aae63957SBryan Drewery.include <bsd.clang-analyze.mk> 380cd9a2f5cSJordan K. Hubbard.include <bsd.obj.mk> 381d510ecb4SKris Kennaway.include <bsd.sys.mk> 382