1*0a6a1f1dSLionel Sambuc# $NetBSD: bsd.hostprog.mk,v 1.74 2014/12/01 01:34:30 erh Exp $ 2be9962e2SThomas Veerman# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94 3be9962e2SThomas Veerman 4be9962e2SThomas Veerman.include <bsd.init.mk> 5be9962e2SThomas Veerman.include <bsd.sys.mk> 6be9962e2SThomas Veerman 7be9962e2SThomas Veerman##### Basic targets 8be9962e2SThomas Veerman 9be9962e2SThomas Veerman##### Default values 10be9962e2SThomas VeermanLIBATF_C?= /usr/lib/libatf-c.a 11be9962e2SThomas VeermanLIBATF_CXX?= /usr/lib/libatf-c++.a 12be9962e2SThomas VeermanLIBBLUETOOTH?= /usr/lib/libbluetooth.a 13be9962e2SThomas VeermanLIBBZ2?= /usr/lib/libbz2.a 14be9962e2SThomas VeermanLIBC?= /usr/lib/libc.a 15be9962e2SThomas VeermanLIBC_PIC?= /usr/lib/libc_pic.a 16be9962e2SThomas VeermanLIBC_SO?= /usr/lib/libc.so 17be9962e2SThomas VeermanLIBCOMPAT?= /usr/lib/libcompat.a 18be9962e2SThomas VeermanLIBCRYPT?= /usr/lib/libcrypt.a 19be9962e2SThomas VeermanLIBCURSES?= /usr/lib/libcurses.a 20be9962e2SThomas VeermanLIBDBM?= /usr/lib/libdbm.a 21be9962e2SThomas VeermanLIBDES?= /usr/lib/libdes.a 22be9962e2SThomas VeermanLIBEDIT?= /usr/lib/libedit.a 23be9962e2SThomas VeermanLIBEVENT?= /usr/lib/libevent.a 2411be35a1SLionel SambucLIBEVENT_OPENSSL?= /usr/lib/libevent_openssl.a 2511be35a1SLionel SambucLIBEVENT_PTHREADS?= /usr/lib/libevent_pthreads.a 26be9962e2SThomas VeermanLIBEXPAT?= /usr/lib/libexpat.a 27be9962e2SThomas VeermanLIBFETCH?= /usr/lib/libfetch.a 28be9962e2SThomas VeermanLIBFORM?= /usr/lib/libform.a 29be9962e2SThomas VeermanLIBGCC?= /usr/lib/libgcc.a 30be9962e2SThomas VeermanLIBGNUMALLOC?= /usr/lib/libgnumalloc.a 31be9962e2SThomas VeermanLIBINTL?= /usr/lib/libintl.a 32be9962e2SThomas VeermanLIBIPSEC?= /usr/lib/libipsec.a 33be9962e2SThomas VeermanLIBKVM?= /usr/lib/libkvm.a 34be9962e2SThomas VeermanLIBL?= /usr/lib/libl.a 3511be35a1SLionel SambucLIBLUTOK?= /usr/lib/liblutok.a 36be9962e2SThomas VeermanLIBLZMA?= /usr/lib/liblzma.a 37be9962e2SThomas VeermanLIBM?= /usr/lib/libm.a 38be9962e2SThomas VeermanLIBMAGIC?= /usr/lib/libmagic.a 39be9962e2SThomas VeermanLIBMENU?= /usr/lib/libmenu.a 40be9962e2SThomas VeermanLIBMP?= /usr/lib/libmp.a 41be9962e2SThomas VeermanLIBNTP?= /usr/lib/libntp.a 42be9962e2SThomas VeermanLIBOBJC?= /usr/lib/libobjc.a 43be9962e2SThomas VeermanLIBP2K?= /usr/lib/libp2k.a 44be9962e2SThomas VeermanLIBPC?= /usr/lib/libpc.a 45be9962e2SThomas VeermanLIBPCAP?= /usr/lib/libpcap.a 46be9962e2SThomas VeermanLIBPCI?= /usr/lib/libpci.a 47be9962e2SThomas VeermanLIBPLOT?= /usr/lib/libplot.a 48be9962e2SThomas VeermanLIBPOSIX?= /usr/lib/libposix.a 49be9962e2SThomas VeermanLIBPUFFS?= /usr/lib/libpuffs.a 50be9962e2SThomas VeermanLIBQUOTA?= /usr/lib/libquota.a 51be9962e2SThomas VeermanLIBRESOLV?= /usr/lib/libresolv.a 52be9962e2SThomas VeermanLIBRPCSVC?= /usr/lib/librpcsvc.a 53be9962e2SThomas VeermanLIBRUMP?= /usr/lib/librump.a 54be9962e2SThomas VeermanLIBRUMPCLIENT?= /usr/lib/librumpclient.a 55be9962e2SThomas VeermanLIBRUMPNET?= /usr/lib/librumpnet.a 56be9962e2SThomas VeermanLIBRUMPUSER?= /usr/lib/librumpuser.a 57be9962e2SThomas VeermanLIBRUMPVFS?= /usr/lib/librumpvfs.a 58be9962e2SThomas VeermanLIBSKEY?= /usr/lib/libskey.a 59be9962e2SThomas VeermanLIBSQLITE3?= /usr/lib/libsqlite3.a 60be9962e2SThomas VeermanLIBSSP?= /usr/lib/libssp.a 61be9962e2SThomas VeermanLIBSTDCXX?= /usr/lib/libstdc++.a 62be9962e2SThomas VeermanLIBSUPCXX?= /usr/lib/libsupc++.a 63be9962e2SThomas VeermanLIBTERMINFO?= /usr/lib/libterminfo.a 64be9962e2SThomas VeermanLIBUTIL?= /usr/lib/libutil.a 65be9962e2SThomas VeermanLIBWRAP?= /usr/lib/libwrap.a 66be9962e2SThomas VeermanLIBUKFS?= /usr/lib/libukfs.a 67be9962e2SThomas VeermanLIBY?= /usr/lib/liby.a 68be9962e2SThomas VeermanLIBZ?= /usr/lib/libz.a 69be9962e2SThomas Veerman 70be9962e2SThomas Veerman##### rump file system modules 71be9962e2SThomas VeermanLIBRUMPFS_CD9660FS?= /usr/lib/librumpfs_cd9660fs.a 72be9962e2SThomas VeermanLIBRUMPFS_EFS?= /usr/lib/librumpfs_efs.a 73be9962e2SThomas VeermanLIBRUMPFS_EXT2FS?= /usr/lib/librumpfs_ext2fs.a 74be9962e2SThomas VeermanLIBRUMPFS_FFS?= /usr/lib/librumpfs_ffs.a 75be9962e2SThomas VeermanLIBRUMPFS_HFS?= /usr/lib/librumpfs_hfs.a 76be9962e2SThomas VeermanLIBRUMPFS_LFS?= /usr/lib/librumpfs_lfs.a 77be9962e2SThomas VeermanLIBRUMPFS_MSDOSFS?= /usr/lib/librumpfs_msdosfs.a 78be9962e2SThomas VeermanLIBRUMPFS_NTFS?= /usr/lib/librumpfs_ntfs.a 79be9962e2SThomas VeermanLIBRUMPFS_SYSPUFFS?= /usr/lib/librumpfs_syspuffs.a 80be9962e2SThomas VeermanLIBRUMPFS_TMPFS?= /usr/lib/librumpfs_tmpfs.a 81be9962e2SThomas VeermanLIBRUMPFS_UDF?= /usr/lib/librumpfs_udf.a 82be9962e2SThomas VeermanLIBRUMPFS_UFS?= /usr/lib/librumpfs_ufs.a 83be9962e2SThomas Veerman 84*0a6a1f1dSLionel SambucMKDEP_SUFFIXES?= .lo .ln .d 85be9962e2SThomas Veerman 86be9962e2SThomas Veerman# Override these: 87be9962e2SThomas VeermanINSTALL:= ${INSTALL:NSTRIP=*} 88be9962e2SThomas VeermanMKDEP:= ${HOST_MKDEP} 8984d9c625SLionel SambucMKDEPCXX:= ${HOST_MKDEPCXX} 90be9962e2SThomas Veerman 91be9962e2SThomas Veerman.if ${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN) 92be9962e2SThomas VeermanOBJHOSTMACHINE= # set 93be9962e2SThomas Veerman.endif 94be9962e2SThomas Veerman 95be9962e2SThomas Veerman##### Build rules 96be9962e2SThomas Veerman.if defined(HOSTPROG_CXX) 97be9962e2SThomas VeermanHOSTPROG= ${HOSTPROG_CXX} 98be9962e2SThomas Veerman.endif 99be9962e2SThomas Veerman 100be9962e2SThomas Veerman.if defined(HOSTPROG) 101be9962e2SThomas VeermanSRCS?= ${HOSTPROG}.c 102be9962e2SThomas Veerman 103be9962e2SThomas Veerman_YHPSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}} 104be9962e2SThomas VeermanDPSRCS+= ${_YHPSRCS} 105be9962e2SThomas VeermanCLEANFILES+= ${_YHPSRCS} 106be9962e2SThomas Veerman 107be9962e2SThomas Veerman.if !empty(SRCS:N*.h:N*.sh) 108be9962e2SThomas VeermanOBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.lo/g} 109be9962e2SThomas VeermanLOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} 110be9962e2SThomas Veerman.endif 111be9962e2SThomas Veerman 112be9962e2SThomas Veerman.if defined(OBJS) && !empty(OBJS) 113be9962e2SThomas Veerman.NOPATH: ${OBJS} ${HOSTPROG} ${_YHPSRCS} 114be9962e2SThomas Veerman 115be9962e2SThomas Veerman${OBJS} ${LOBJS}: ${DPSRCS} 116be9962e2SThomas Veerman${HOSTPROG}: ${OBJS} ${DPADD} 117be9962e2SThomas Veerman ${_MKTARGET_LINK} 118be9962e2SThomas Veerman ${HOST_LINK.c} ${HOST_LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD} 11911be35a1SLionel Sambuc.if !empty(.MAKE.OS:M*CYGWIN*) 12011be35a1SLionel Sambuc ${HOST_SH} ${NETBSDSRCDIR}/tools/binstall/mkmanifest ${HOSTPROG} 12111be35a1SLionel Sambuc.endif 12211be35a1SLionel Sambuc 123be9962e2SThomas Veerman 124be9962e2SThomas Veerman.endif # defined(OBJS) && !empty(OBJS) 125be9962e2SThomas Veerman 126be9962e2SThomas Veerman.if !defined(MAN) 127be9962e2SThomas VeermanMAN= ${HOSTPROG}.1 128be9962e2SThomas Veerman.endif # !defined(MAN) 129be9962e2SThomas Veerman.endif # defined(HOSTPROG) 130be9962e2SThomas Veerman 131be9962e2SThomas Veermanrealall: ${HOSTPROG} 132be9962e2SThomas Veerman 133be9962e2SThomas VeermanCLEANFILES+= a.out [Ee]rrs mklog core *.core ${HOSTPROG} ${OBJS} ${LOBJS} 134be9962e2SThomas Veerman 135be9962e2SThomas Veermanbeforedepend: 136be9962e2SThomas VeermanCFLAGS:= ${HOST_CFLAGS} 137be9962e2SThomas VeermanCPPFLAGS:= ${HOST_CPPFLAGS:N-Wp,-iremap,*} 138be9962e2SThomas Veerman 139be9962e2SThomas Veermanlint: ${LOBJS} 140be9962e2SThomas Veerman.if defined(LOBJS) && !empty(LOBJS) 141be9962e2SThomas Veerman ${LINT} ${LINTFLAGS} ${LDFLAGS:C/-L[ ]*/-L/Wg:M-L*} ${LOBJS} ${LDADD} 142be9962e2SThomas Veerman.endif 143be9962e2SThomas Veerman 144be9962e2SThomas Veerman##### Pull in related .mk logic 145be9962e2SThomas VeermanLINKSMODE?= ${BINMODE} 146be9962e2SThomas Veerman.include <bsd.man.mk> 147be9962e2SThomas Veerman.include <bsd.nls.mk> 148be9962e2SThomas Veerman.include <bsd.files.mk> 149be9962e2SThomas Veerman.include <bsd.inc.mk> 150be9962e2SThomas Veerman.include <bsd.links.mk> 151be9962e2SThomas Veerman.include <bsd.dep.mk> 152be9962e2SThomas Veerman.include <bsd.clean.mk> 153be9962e2SThomas Veerman 154be9962e2SThomas Veerman${TARGETS}: # ensure existence 155be9962e2SThomas Veerman 156be9962e2SThomas Veerman# Override YACC/LEX rules so nbtool_config.h can be forced as the 1st include 157be9962e2SThomas Veerman.l.c: 158be9962e2SThomas Veerman ${_MKTARGET_LEX} 159be9962e2SThomas Veerman ${LEX.l} -o${.TARGET} ${.IMPSRC} 160be9962e2SThomas Veerman echo '#if HAVE_NBTOOL_CONFIG_H' > ${.TARGET}.1 161be9962e2SThomas Veerman echo '#include "nbtool_config.h"' >> ${.TARGET}.1 162be9962e2SThomas Veerman echo '#endif' >> ${.TARGET}.1 163be9962e2SThomas Veerman cat ${.TARGET} >> ${.TARGET}.1 164be9962e2SThomas Veerman mv ${.TARGET}.1 ${.TARGET} 165be9962e2SThomas Veerman.y.c: 166be9962e2SThomas Veerman ${_MKTARGET_YACC} 167be9962e2SThomas Veerman ${YACC.y} -o ${.TARGET} ${.IMPSRC} 168be9962e2SThomas Veerman echo '#if HAVE_NBTOOL_CONFIG_H' > ${.TARGET}.1 169be9962e2SThomas Veerman echo '#include "nbtool_config.h"' >> ${.TARGET}.1 170be9962e2SThomas Veerman echo '#endif' >> ${.TARGET}.1 171be9962e2SThomas Veerman cat ${.TARGET} >> ${.TARGET}.1 172be9962e2SThomas Veerman mv ${.TARGET}.1 ${.TARGET} 173