Makefile revision 1.138
11.138Sdsl#	$NetBSD: Makefile,v 1.138 2009/08/11 17:29:04 dsl 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.127Schristos.include "Makefile.inc"
211.107Slukem
221.82StvLIB=		c
231.117SchristosCPPFLAGS+=	-I${.CURDIR}/include -I${.CURDIR}
241.104Sthorpej
251.136SmrgLIBCDIR=	${.CURDIR}
261.136Smrg
271.82Stv.if exists (${ARCHDIR}/Makefile.inc)
281.82Stv.PATH:	${ARCHDIR}
291.82Stv.include "${ARCHDIR}/Makefile.inc"
301.9Sderaadt.endif
311.127Schristos
321.114Smatt.if exists (${ARCHDIR}/genassym.cf)
331.114SmattDPSRCS+=	assym.h
341.114SmattCLEANFILES+=	assym.h assym.h.tmp
351.114Smatt
361.122Sthorpejassym.h: ${ARCHDIR}/genassym.cf
371.114Smatt	${_MKTARGET_CREATE}
381.122Sthorpej	${TOOL_GENASSYM} -- ${CC} ${CFLAGS} \
391.121Smatt		${CPPFLAGS} ${CPPFLAGS.assym.h} ${PROF} \
401.114Smatt		< ${ARCHDIR}/genassym.cf > assym.h.tmp && \
411.114Smatt	mv -f assym.h.tmp assym.h
421.114Smatt.endif
431.1Scgd
441.127Schristos# The following controls how to build compatibility code for old NetBSD
451.127Schristos# binaries. If BUILDCOLD is yes, then we build a separate library; otherwise
461.127Schristos# we include the code in libc.
471.127SchristosBUILDCOLD?= no
481.127Schristos.if "${BUILDCOLD}" == "yes"
491.127SchristosSUBDIR=compat
501.127Schristos.include <bsd.subdir.mk>
511.127Schristos.else
521.127SchristosCOMPATDIR=${.CURDIR}/compat
531.127Schristos.include "${.CURDIR}/compat/Makefile.inc"
541.127Schristos.endif
551.127Schristos
561.125Schristos.include "${.CURDIR}/../../common/lib/libc/Makefile.inc"
571.135Sad.include "${.CURDIR}/atomic/Makefile.inc"
581.7Scgd.include "${.CURDIR}/db/Makefile.inc"
591.111Stshiozak.include "${.CURDIR}/citrus/Makefile.inc"
601.1Scgd.include "${.CURDIR}/compat-43/Makefile.inc"
611.88Sminoura.include "${.CURDIR}/dlfcn/Makefile.inc"
621.126Skleink.include "${.CURDIR}/gdtoa/Makefile.inc"
631.1Scgd.include "${.CURDIR}/gen/Makefile.inc"
641.24Scgd.include "${.CURDIR}/gmon/Makefile.inc"
651.81Sexplorer.include "${.CURDIR}/hash/Makefile.inc"
661.111Stshiozak.include "${.CURDIR}/iconv/Makefile.inc"
671.117Schristos.include "${.CURDIR}/inet/Makefile.inc"
681.117Schristos.include "${.CURDIR}/isc/Makefile.inc"
691.1Scgd.include "${.CURDIR}/locale/Makefile.inc"
701.52Sthorpej.include "${.CURDIR}/md/Makefile.inc"
711.132Sad.include "${.CURDIR}/misc/Makefile.inc"
721.1Scgd.include "${.CURDIR}/net/Makefile.inc"
731.117Schristos.include "${.CURDIR}/nameser/Makefile.inc"
741.25Sjtc.include "${.CURDIR}/nls/Makefile.inc"
751.78Seeh.if (${MACHINE_ARCH} != "alpha") && (${MACHINE_ARCH} != "sparc64")
761.24Scgd.include "${.CURDIR}/quad/Makefile.inc"
771.34Scgd.endif
781.24Scgd.include "${.CURDIR}/regex/Makefile.inc"
791.117Schristos.include "${.CURDIR}/resolv/Makefile.inc"
801.24Scgd.include "${.CURDIR}/rpc/Makefile.inc"
811.131Stls.include "${.CURDIR}/ssp/Makefile.inc"
821.1Scgd.include "${.CURDIR}/stdio/Makefile.inc"
831.1Scgd.include "${.CURDIR}/stdlib/Makefile.inc"
841.1Scgd.include "${.CURDIR}/string/Makefile.inc"
851.40Sjtc.include "${.CURDIR}/termios/Makefile.inc"
861.108Sthorpej.include "${.CURDIR}/thread-stub/Makefile.inc"
871.38Sjtc.include "${.CURDIR}/time/Makefile.inc"
881.1Scgd.include "${.CURDIR}/sys/Makefile.inc"
891.119Sthorpej.include "${.CURDIR}/uuid/Makefile.inc"
901.104Sthorpej.if (${MKYP} != "no")
911.4Sderaadt.include "${.CURDIR}/yp/Makefile.inc"
921.104Sthorpej.endif
931.41Sjtc
941.138Sdsl# Remove from SRCS the .c files for any .S files added by the MD makefiles,
951.138Sdsl# also remove from SRCS the .c files for the .S and .c files in NO_SRCS.
961.138Sdsl# Add the .c file for .S files (in both variables) to LSRCS so that the
971.138Sdsl# 'normal' .c file for assembly files is used for the lint librray.
981.138Sdsl#
991.138Sdsl# Usage:
1001.138Sdsl# Add .S files to NO_SRSC when another .S file provides the entry points.
1011.138Sdsl# Add .c files to NO_SRSC when another .c file provides the entry points.
1021.138Sdsl# (lint is run on all .c files in SRCS)
1031.138Sdsl
1041.138Sdsl.for check_file in ${SRCS:M*.S} ${NO_SRCS}
1051.138Sdslunwanted_file := ${SRCS:M${check_file:.S=.c}}
1061.137Sdsl.if "${unwanted_file}" != ""
1071.137SdslSRCS := ${SRCS:N${unwanted_file}}
1081.138Sdsl.if "${unwanted_file}" != "${check_file}"
1091.138SdslLSRCS := ${LSRCS} ${unwanted_file}
1101.138Sdsl.endif
1111.137Sdsl.endif
1121.137Sdsl.endfor
1131.137Sdsl
1141.109SjmmvNLS=	C.msg Pig.msg ca.msg cs.msg de.msg es.msg fi.msg fr.msg nl.msg \
1151.110Ssalo	no.msg pl.msg sk.msg sv.msg
1161.1Scgd
1171.102Sthorpejrealall: tags
1181.102Sthorpejtags: ${SRCS}
1191.118Slukem	${_MKTARGET_CREATE}
1201.115Sross	-${TOOL_CTAGS} -w ${.ALLSRC:M*.c}
1211.115Sross	-egrep "^ENTRY(.*)|^FUNC(.*)|^SYSCALL(.*)" /dev/null ${.ALLSRC:M*.S} | \
1221.36Scgd	    sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
1231.64Schristos	    >> ${.TARGET}; sort -o ${.TARGET} ${.TARGET}
1241.65Schristos
1251.102SthorpejFILES=		tags
1261.82StvFILESNAME=	libc.tags
1271.82StvFILESDIR=	/var/db
1281.32Scgd
1291.97Sitojun
1301.103Stshiozak# workaround for I18N stuffs: build singlebyte setlocale() for libc.a,
1311.97Sitojun# multibyte for libc.so.  the quirk should be removed when we support
1321.97Sitojun# dlopen() from within statically linked binaries.
1331.130StnozakiCSHLIBFLAGS+=	-D_I18N_DYNAMIC
1341.105Syamt
1351.105Syamt.include <bsd.lib.mk>
1361.133Sad
1371.133Sad# force the dynamic linker to initialize libc first
1381.134SheSHLIB_SHFLAGS+=	-Wl,-z,initfirst
1391.133Sad
140