Makefile revision 1.109
1#	$NetBSD: Makefile,v 1.109 2003/04/09 20:17:06 jmmv Exp $
2#	@(#)Makefile	8.2 (Berkeley) 2/3/94
3#
4# All library objects contain sccsid strings by default; they may be
5# excluded as a space-saving measure.  To produce a library that does
6# not contain these strings, delete -DLIBC_SCCS and -DSYSLIBC_SCCS
7# from CPPFLAGS below.  To remove these strings from just the system call
8# stubs, remove just -DSYSLIBC_SCCS from CPPFLAGS.
9#
10# The NLS (message catalog) functions are always in libc.  To choose that
11# strerror(), perror(), strsignal(), psignal(), etc. actually call the NLS
12# functions, put -DNLS on the CPPFLAGS line below.
13#
14# The YP functions are always in libc. To choose that getpwent() and friends
15# actually call the YP functions, put -DYP on the CPPFLAGS line below.
16#
17# The Hesiod functions are always in libc. To choose that getpwent() and friends
18# actually call the Hesiod functions, put -DHESIOD on the CPPFLAGS line below.
19
20USE_SHLIBDIR=	yes
21
22.include <bsd.own.mk>
23
24LIB=		c
25CPPFLAGS+=	-D_LIBC -DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT
26CPPFLAGS+=	-I${.CURDIR}/include
27
28.if (${USE_HESIOD} != "no")
29CPPFLAGS+=	-DHESIOD
30.endif
31
32CPPFLAGS+=	-DINET6
33CPPFLAGS+=	-DNLS
34
35.if (${USE_YP} != "no")
36CPPFLAGS+=	-DYP
37.endif
38
39.if ${MACHINE_ARCH} == "i386"
40# Set lint to exit on warnings
41LINTFLAGS+=	-w
42.endif
43# ignore 'empty translation unit' warnings.
44LINTFLAGS+=	-X 272
45
46.if exists(${.CURDIR}/arch/${MACHINE_ARCH})
47ARCHSUBDIR=	${MACHINE_ARCH}
48.elif exists(${.CURDIR}/arch/${MACHINE_CPU}) 
49ARCHSUBDIR=	${MACHINE_CPU}
50.else
51.BEGIN:
52	@echo no ARCHSUBDIR for ${MACHINE_ARCH} nor ${MACHINE_CPU}
53	@false
54.endif
55
56ARCHDIR=	${.CURDIR}/arch/${ARCHSUBDIR}
57AINC=		-I${ARCHDIR}
58.if defined(DESTDIR)
59AINC+=		-nostdinc -idirafter ${DESTDIR}/usr/include
60.endif
61CLEANFILES+=	tags
62
63# Don't try to lint the C library against itself when creating llib-lc.ln
64LLIBS=
65
66INCSDIR=	/usr/include
67
68.if exists (${ARCHDIR}/Makefile.inc)
69.PATH:	${ARCHDIR}
70.include "${ARCHDIR}/Makefile.inc"
71.endif
72
73.include "${.CURDIR}/db/Makefile.inc"
74.include "${.CURDIR}/compat-43/Makefile.inc"
75.include "${.CURDIR}/dlfcn/Makefile.inc"
76.include "${.CURDIR}/gen/Makefile.inc"
77.include "${.CURDIR}/gmon/Makefile.inc"
78.include "${.CURDIR}/hash/Makefile.inc"
79.include "${.CURDIR}/citrus/Makefile.inc"
80.include "${.CURDIR}/locale/Makefile.inc"
81.include "${.CURDIR}/md/Makefile.inc"
82.include "${.CURDIR}/net/Makefile.inc"
83.include "${.CURDIR}/nls/Makefile.inc"
84.if (${MACHINE_ARCH} != "alpha") && (${MACHINE_ARCH} != "sparc64")
85.include "${.CURDIR}/quad/Makefile.inc"
86.endif
87.include "${.CURDIR}/regex/Makefile.inc"
88.include "${.CURDIR}/rpc/Makefile.inc"
89.include "${.CURDIR}/stdio/Makefile.inc"
90.include "${.CURDIR}/stdlib/Makefile.inc"
91.include "${.CURDIR}/string/Makefile.inc"
92.include "${.CURDIR}/termios/Makefile.inc"
93.include "${.CURDIR}/thread-stub/Makefile.inc"
94.include "${.CURDIR}/time/Makefile.inc"
95.include "${.CURDIR}/sys/Makefile.inc"
96.if (${MKYP} != "no")
97.include "${.CURDIR}/yp/Makefile.inc"
98.endif
99
100NLS=	C.msg Pig.msg ca.msg cs.msg de.msg es.msg fi.msg fr.msg nl.msg \
101	no.msg sv.msg pl.msg
102
103LIBKERN=	${NETBSDSRCDIR}/sys/lib/libkern
104
105KSRCS=	bcopy.c bcmp.c bswap16.c bswap32.c bswap64.c bzero.c ffs.c \
106	strcat.c strchr.c strcmp.c strcpy.c strlen.c \
107	strncmp.c strncpy.c strrchr.c \
108	htonl.c htons.c ntohl.c ntohs.c md5c.c \
109	memchr.c memcmp.c memcpy.c memmove.c memset.c \
110	index.c rindex.c
111.if (${MACHINE_ARCH} != "alpha") && (${MACHINE_ARCH} != "sparc64")
112KSRCS+=	adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
113	lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \
114	subdi3.c  ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
115KINCLUDES+=	quad/quad.h
116.endif
117
118copy-to-libkern:	copy-to-libkern-machind copy-to-libkern-machdep
119
120copy-to-libkern-machind: ${KSRCS}
121	cp -p ${.ALLSRC} ${LIBKERN}
122.if defined(KINCLUDES) && !empty(KINCLUDES)
123	(cd ${.CURDIR} ; cp -p ${KINCLUDES} ${LIBKERN})
124.endif
125
126copy-to-libkern-machdep: ${KMSRCS}
127.if defined(KMSRCS) && !empty(KMSRCS)
128	cp -p ${.ALLSRC} ${LIBKERN}/arch/${ARCHSUBDIR}
129.endif
130.if defined(KMINCLUDES) && !empty(KMINCLUDES)
131	(cd ${.CURDIR} ; cp -p ${KMINCLUDES} ${LIBKERN}/arch/${ARCHSUBDIR})
132.endif
133
134rm-from-libkern:
135	for i in ${KSRCS}; do rm -f ${LIBKERN}/$$i; done
136.if defined(KMSRCS) && !empty(KMSRCS)
137	for i in ${KMSRCS}; do rm -f ${LIBKERN}/arch/${ARCHSUBDIR}/$$i; done
138.endif
139
140CTAGS?=		ctags
141
142realall: tags
143tags: ${SRCS}
144	${CTAGS} -w ${.ALLSRC:M*.c}
145	egrep "^ENTRY(.*)|^FUNC(.*)|^SYSCALL(.*)" /dev/null ${.ALLSRC:M*.S} | \
146	    sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
147	    >> ${.TARGET}; sort -o ${.TARGET} ${.TARGET}
148
149FILES=		tags
150FILESNAME=	libc.tags
151FILESDIR=	/var/db
152
153
154# workaround for I18N stuffs: build singlebyte setlocale() for libc.a,
155# multibyte for libc.so.  the quirk should be removed when we support
156# dlopen() from within statically linked binaries.
157CSHLIBFLAGS+=	-D_I18N_DYNAMIC
158
159.include <bsd.lib.mk>
160