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