Makefile revision 1.123
11.123Schristos#	$NetBSD: Makefile,v 1.123 2005/09/13 01:44:08 christos Exp $
21.36Scgd#	@(#)Makefile	8.2 (Berkeley) 2/3/94
31.1Scgd#
41.1Scgd# All library objects contain sccsid strings by default; they may be
51.1Scgd# excluded as a space-saving measure.  To produce a library that does
61.1Scgd# not contain these strings, delete -DLIBC_SCCS and -DSYSLIBC_SCCS
71.71Slukem# from CPPFLAGS below.  To remove these strings from just the system call
81.71Slukem# stubs, remove just -DSYSLIBC_SCCS from CPPFLAGS.
91.28Sjtc#
101.28Sjtc# The NLS (message catalog) functions are always in libc.  To choose that
111.28Sjtc# strerror(), perror(), strsignal(), psignal(), etc. actually call the NLS
121.71Slukem# functions, put -DNLS on the CPPFLAGS line below.
131.4Sderaadt#
141.6Sderaadt# The YP functions are always in libc. To choose that getpwent() and friends
151.71Slukem# actually call the YP functions, put -DYP on the CPPFLAGS line below.
161.79Slukem#
171.79Slukem# The Hesiod functions are always in libc. To choose that getpwent() and friends
181.79Slukem# actually call the Hesiod functions, put -DHESIOD on the CPPFLAGS line below.
191.4Sderaadt
201.107SlukemUSE_SHLIBDIR=	yes
211.107Slukem
221.104Sthorpej.include <bsd.own.mk>
231.104Sthorpej
241.82StvLIB=		c
251.104SthorpejCPPFLAGS+=	-D_LIBC -DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT
261.117SchristosCPPFLAGS+=	-I${.CURDIR}/include -I${.CURDIR}
271.104Sthorpej
281.104Sthorpej.if (${USE_HESIOD} != "no")
291.104SthorpejCPPFLAGS+=	-DHESIOD
301.104Sthorpej.endif
311.104Sthorpej
321.113Smatt.if (${USE_INET6} != "no")
331.87SitojunCPPFLAGS+=	-DINET6
341.113Smatt.endif
351.120Slukem
361.104SthorpejCPPFLAGS+=	-DNLS
371.100Slukem
381.104Sthorpej.if (${USE_YP} != "no")
391.104SthorpejCPPFLAGS+=	-DYP
401.104Sthorpej.endif
411.98Schristos
421.98Schristos.if ${MACHINE_ARCH} == "i386"
431.98Schristos# Set lint to exit on warnings
441.98SchristosLINTFLAGS+=	-w
451.98Schristos.endif
461.98Schristos# ignore 'empty translation unit' warnings.
471.98SchristosLINTFLAGS+=	-X 272
481.82Stv
491.95Sitojun.if exists(${.CURDIR}/arch/${MACHINE_ARCH})
501.95SitojunARCHSUBDIR=	${MACHINE_ARCH}
511.95Sitojun.elif exists(${.CURDIR}/arch/${MACHINE_CPU}) 
521.95SitojunARCHSUBDIR=	${MACHINE_CPU}
531.95Sitojun.else
541.95Sitojun.BEGIN:
551.95Sitojun	@echo no ARCHSUBDIR for ${MACHINE_ARCH} nor ${MACHINE_CPU}
561.95Sitojun	@false
571.95Sitojun.endif
581.95Sitojun
591.83SdrochnerARCHDIR=	${.CURDIR}/arch/${ARCHSUBDIR}
601.116SlukemAFLAGS+=	-I${ARCHDIR}
611.27Smycroft.if defined(DESTDIR)
621.116SlukemAFLAGS+=	-nostdinc -idirafter ${DESTDIR}/usr/include
631.27Smycroft.endif
641.102SthorpejCLEANFILES+=	tags
651.51Scgd
661.73Smikel# Don't try to lint the C library against itself when creating llib-lc.ln
671.51ScgdLLIBS=
681.89Sfvdl
691.89SfvdlINCSDIR=	/usr/include
701.9Sderaadt
711.82Stv.if exists (${ARCHDIR}/Makefile.inc)
721.82Stv.PATH:	${ARCHDIR}
731.82Stv.include "${ARCHDIR}/Makefile.inc"
741.9Sderaadt.endif
751.114Smatt.if exists (${ARCHDIR}/genassym.cf)
761.114SmattDPSRCS+=	assym.h
771.114SmattCLEANFILES+=	assym.h assym.h.tmp
781.114Smatt
791.122Sthorpejassym.h: ${ARCHDIR}/genassym.cf
801.114Smatt	${_MKTARGET_CREATE}
811.122Sthorpej	${TOOL_GENASSYM} -- ${CC} ${CFLAGS} \
821.121Smatt		${CPPFLAGS} ${CPPFLAGS.assym.h} ${PROF} \
831.114Smatt		< ${ARCHDIR}/genassym.cf > assym.h.tmp && \
841.114Smatt	mv -f assym.h.tmp assym.h
851.114Smatt.endif
861.1Scgd
871.7Scgd.include "${.CURDIR}/db/Makefile.inc"
881.111Stshiozak.include "${.CURDIR}/citrus/Makefile.inc"
891.1Scgd.include "${.CURDIR}/compat-43/Makefile.inc"
901.123Schristos.include "${.CURDIR}/compat/Makefile.inc"
911.88Sminoura.include "${.CURDIR}/dlfcn/Makefile.inc"
921.1Scgd.include "${.CURDIR}/gen/Makefile.inc"
931.24Scgd.include "${.CURDIR}/gmon/Makefile.inc"
941.81Sexplorer.include "${.CURDIR}/hash/Makefile.inc"
951.111Stshiozak.include "${.CURDIR}/iconv/Makefile.inc"
961.117Schristos.include "${.CURDIR}/inet/Makefile.inc"
971.117Schristos.include "${.CURDIR}/isc/Makefile.inc"
981.1Scgd.include "${.CURDIR}/locale/Makefile.inc"
991.52Sthorpej.include "${.CURDIR}/md/Makefile.inc"
1001.1Scgd.include "${.CURDIR}/net/Makefile.inc"
1011.117Schristos.include "${.CURDIR}/nameser/Makefile.inc"
1021.25Sjtc.include "${.CURDIR}/nls/Makefile.inc"
1031.78Seeh.if (${MACHINE_ARCH} != "alpha") && (${MACHINE_ARCH} != "sparc64")
1041.24Scgd.include "${.CURDIR}/quad/Makefile.inc"
1051.34Scgd.endif
1061.24Scgd.include "${.CURDIR}/regex/Makefile.inc"
1071.117Schristos.include "${.CURDIR}/resolv/Makefile.inc"
1081.24Scgd.include "${.CURDIR}/rpc/Makefile.inc"
1091.1Scgd.include "${.CURDIR}/stdio/Makefile.inc"
1101.1Scgd.include "${.CURDIR}/stdlib/Makefile.inc"
1111.1Scgd.include "${.CURDIR}/string/Makefile.inc"
1121.40Sjtc.include "${.CURDIR}/termios/Makefile.inc"
1131.108Sthorpej.include "${.CURDIR}/thread-stub/Makefile.inc"
1141.38Sjtc.include "${.CURDIR}/time/Makefile.inc"
1151.1Scgd.include "${.CURDIR}/sys/Makefile.inc"
1161.119Sthorpej.include "${.CURDIR}/uuid/Makefile.inc"
1171.104Sthorpej.if (${MKYP} != "no")
1181.4Sderaadt.include "${.CURDIR}/yp/Makefile.inc"
1191.104Sthorpej.endif
1201.41Sjtc
1211.109SjmmvNLS=	C.msg Pig.msg ca.msg cs.msg de.msg es.msg fi.msg fr.msg nl.msg \
1221.110Ssalo	no.msg pl.msg sk.msg sv.msg
1231.1Scgd
1241.106SlukemLIBKERN=	${NETBSDSRCDIR}/sys/lib/libkern
1251.14Sjtc
1261.80SbouyerKSRCS=	bcopy.c bcmp.c bswap16.c bswap32.c bswap64.c bzero.c ffs.c \
1271.76Sperry	strcat.c strchr.c strcmp.c strcpy.c strlen.c \
1281.76Sperry	strncmp.c strncpy.c strrchr.c \
1291.76Sperry	htonl.c htons.c ntohl.c ntohs.c md5c.c \
1301.76Sperry	memchr.c memcmp.c memcpy.c memmove.c memset.c \
1311.76Sperry	index.c rindex.c
1321.78Seeh.if (${MACHINE_ARCH} != "alpha") && (${MACHINE_ARCH} != "sparc64")
1331.22ScgdKSRCS+=	adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
1341.22Scgd	lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \
1351.22Scgd	subdi3.c  ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
1361.22ScgdKINCLUDES+=	quad/quad.h
1371.35Scgd.endif
1381.14Sjtc
1391.15Sjtccopy-to-libkern:	copy-to-libkern-machind copy-to-libkern-machdep
1401.15Sjtc
1411.15Sjtccopy-to-libkern-machind: ${KSRCS}
1421.14Sjtc	cp -p ${.ALLSRC} ${LIBKERN}
1431.35Scgd.if defined(KINCLUDES) && !empty(KINCLUDES)
1441.22Scgd	(cd ${.CURDIR} ; cp -p ${KINCLUDES} ${LIBKERN})
1451.35Scgd.endif
1461.14Sjtc
1471.15Sjtccopy-to-libkern-machdep: ${KMSRCS}
1481.15Sjtc.if defined(KMSRCS) && !empty(KMSRCS)
1491.83Sdrochner	cp -p ${.ALLSRC} ${LIBKERN}/arch/${ARCHSUBDIR}
1501.18Scgd.endif
1511.18Scgd.if defined(KMINCLUDES) && !empty(KMINCLUDES)
1521.83Sdrochner	(cd ${.CURDIR} ; cp -p ${KMINCLUDES} ${LIBKERN}/arch/${ARCHSUBDIR})
1531.15Sjtc.endif
1541.15Sjtc
1551.14Sjtcrm-from-libkern:
1561.14Sjtc	for i in ${KSRCS}; do rm -f ${LIBKERN}/$$i; done
1571.15Sjtc.if defined(KMSRCS) && !empty(KMSRCS)
1581.83Sdrochner	for i in ${KMSRCS}; do rm -f ${LIBKERN}/arch/${ARCHSUBDIR}/$$i; done
1591.15Sjtc.endif
1601.36Scgd
1611.102Sthorpejrealall: tags
1621.102Sthorpejtags: ${SRCS}
1631.118Slukem	${_MKTARGET_CREATE}
1641.115Sross	-${TOOL_CTAGS} -w ${.ALLSRC:M*.c}
1651.115Sross	-egrep "^ENTRY(.*)|^FUNC(.*)|^SYSCALL(.*)" /dev/null ${.ALLSRC:M*.S} | \
1661.36Scgd	    sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
1671.64Schristos	    >> ${.TARGET}; sort -o ${.TARGET} ${.TARGET}
1681.65Schristos
1691.102SthorpejFILES=		tags
1701.82StvFILESNAME=	libc.tags
1711.82StvFILESDIR=	/var/db
1721.32Scgd
1731.97Sitojun
1741.103Stshiozak# workaround for I18N stuffs: build singlebyte setlocale() for libc.a,
1751.97Sitojun# multibyte for libc.so.  the quirk should be removed when we support
1761.97Sitojun# dlopen() from within statically linked binaries.
1771.105SyamtCSHLIBFLAGS+=	-D_I18N_DYNAMIC
1781.105Syamt
1791.105Syamt.include <bsd.lib.mk>
180