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