1 # $NetBSD: Makefile,v 1.169 2015/06/15 14:24:01 christos Exp $
2 # @(#)Makefile 8.2 (Berkeley) 2/3/94
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.
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.
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.
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.
20 .
include "Makefile.inc"
23 CPPFLAGS
+= -I
${.CURDIR
}/include -I
${.CURDIR
}
27 .if exists
(${ARCHDIR}/Makefile.inc
)
29 .
include "${ARCHDIR}/Makefile.inc"
32 .if exists
(${ARCHDIR}/genassym.cf
)
34 CLEANFILES
+= assym.h assym.h.tmp
36 assym.h
: ${ARCHDIR}/genassym.cf
38 ${TOOL_GENASSYM} -- ${CC} ${CFLAGS
:N-Wa
,*} \
39 ${CPPFLAGS} ${CPPFLAGS.assym.h
} ${PROF} \
40 ${GENASSYM_CPPFLAGS} < ${ARCHDIR}/genassym.cf
> assym.h.tmp
&& \
41 mv
-f assym.h.tmp assym.h
44 # The following controls how to build compatibility code for old NetBSD
45 # binaries. If BUILD_LEGACY is yes, then we build a separate library; otherwise
46 # we include the code in libc.
48 .if
"${BUILD_LEGACY}" == "yes"
50 .
include <bsd.subdir.mk
>
52 COMPATDIR
=${.CURDIR
}/compat
53 .
include "${.CURDIR}/compat/Makefile.inc"
54 # Marker for compat code that can't be easily isolated
55 CPPFLAGS
+= -D__BUILD_LEGACY
58 .if defined
(__MINIX
) && 0
60 .
include <bsd.subdir.mk
>
61 .
endif # defined(__MINIX)
63 .
include "${.CURDIR}/../../common/lib/libc/Makefile.inc"
64 .
include "${.CURDIR}/atomic/Makefile.inc"
65 .
include "${.CURDIR}/cdb/Makefile.inc"
66 .
include "${.CURDIR}/db/Makefile.inc"
67 .
include "${.CURDIR}/citrus/Makefile.inc"
68 .
include "${.CURDIR}/compat-43/Makefile.inc"
69 .
include "${.CURDIR}/compiler_rt/Makefile.inc"
70 .
include "${.CURDIR}/dlfcn/Makefile.inc"
71 .
include "${.CURDIR}/gdtoa/Makefile.inc"
72 .
include "${.CURDIR}/gen/Makefile.inc"
76 .
include "${.CURDIR}/gmon/Makefile.inc"
77 .
endif # defined(__MINIX)
78 .
include "${.CURDIR}/hash/Makefile.inc"
79 .
include "${.CURDIR}/iconv/Makefile.inc"
80 .
include "${.CURDIR}/inet/Makefile.inc"
81 .
include "${.CURDIR}/isc/Makefile.inc"
82 .
include "${.CURDIR}/locale/Makefile.inc"
83 .
include "${.CURDIR}/md/Makefile.inc"
84 .
include "${.CURDIR}/misc/Makefile.inc"
85 .
include "${.CURDIR}/net/Makefile.inc"
86 .
include "${.CURDIR}/nameser/Makefile.inc"
87 .
include "${.CURDIR}/nls/Makefile.inc"
88 .if
(${USE_LIBTRE} == "yes")
89 .
include "${NETBSDSRCDIR}/external/bsd/tre/Makefile.inc"
91 .
include "${.CURDIR}/regex/Makefile.inc"
93 .
include "${.CURDIR}/resolv/Makefile.inc"
95 # RPC needs pollts() and a reserved port allocator.
97 .
include "${.CURDIR}/rpc/Makefile.inc"
98 .
endif # defined(__MINIX)
99 .
include "${.CURDIR}/ssp/Makefile.inc"
100 .
include "${.CURDIR}/stdio/Makefile.inc"
101 .
include "${.CURDIR}/stdlib/Makefile.inc"
102 .
include "${.CURDIR}/string/Makefile.inc"
103 .
include "${.CURDIR}/termios/Makefile.inc"
104 .
include "${.CURDIR}/thread-stub/Makefile.inc"
105 .
include "${.CURDIR}/time/Makefile.inc"
107 .
include "${NETBSDSRCDIR}/minix/lib/libc/sys/Makefile.inc"
109 .if
${RUMPRUN} != "yes"
110 .
include "${.CURDIR}/tls/Makefile.inc"
112 .
endif # defined(__MINIX)
113 .
include "${.CURDIR}/sys/Makefile.inc"
114 .if
${HAVE_LIBGCC_EH} == "no"
115 .
include "${NETBSDSRCDIR}/sys/lib/libunwind/Makefile.inc"
117 .
include "${.CURDIR}/uuid/Makefile.inc"
118 .if
(${MKYP} != "no")
119 .
include "${.CURDIR}/yp/Makefile.inc"
122 # Remove from SRCS the .c files for any .S files added by the MD makefiles,
123 # also remove from SRCS the .c files for the .S and .c files in NO_SRCS.
124 # Add the .c file for .S files (in both variables) to LSRCS so that the
125 # 'normal' .c file for assembly files is used for the lint librray.
128 # Add .S files to NO_SRSC when another .S file provides the entry points.
129 # Add .c files to NO_SRSC when another .c file provides the entry points.
130 # (lint is run on all .c files in SRCS)
132 .for check_file in
${SRCS
:M
*.S
} ${NO_SRCS}
133 unwanted_file
:= ${SRCS
:M
${check_file
:.S
=.c
}}
134 .if
"${unwanted_file}" != ""
135 SRCS
:= ${SRCS
:N
${unwanted_file}}
136 .if
"${unwanted_file}" != "${check_file}"
137 LSRCS
:= ${LSRCS} ${unwanted_file}
142 NLS
= C.msg Pig.msg ca.msg cs.msg de.msg es.msg fi.msg fr.msg nl.msg \
143 no.msg pl.msg sk.msg sv.msg
148 .if
${MKREPRO
:Uno
} == "yes"
149 REGEX_SPECIALS
=[][)(^
$$.?
*\\;]
150 MKREPRO_SED
= -e
's;${NETBSDSRCDIR:C/${REGEX_SPECIALS}/\\\\&/g};/usr/src;'
153 .if
!defined
(MLIBDIR
) && ${RUMPRUN} != "yes"
157 -${TOOL_CTAGS} -f
${.TARGET
}.tmp
-w
${.ALLSRC
:M
*.c
}
158 -egrep
"^ENTRY(.*)|^FUNC(.*)|^SYSCALL(.*)" /dev
/null
${.ALLSRC
:M
*.S
} | \
159 sed
"s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
161 .if
${MKREPRO
:Uno
} == "yes"
162 sed
${MKREPRO_SED} <${.TARGET
}.tmp |
sort -o
${.TARGET
}
164 sort -o
${.TARGET
} ${.TARGET
}.tmp
174 # workaround for I18N stuffs: build singlebyte setlocale() for libc.a,
175 # multibyte for libc.so. the quirk should be removed when we support
176 # dlopen() from within statically linked binaries.
177 CSHLIBFLAGS
+= -D_I18N_DYNAMIC
178 .
endif # defined(__MINIX)
180 .
include <bsd.lib.mk
>
182 # force the dynamic linker to initialize libc first
183 SHLIB_SHFLAGS
+= -Wl
,-z
,initfirst
184 .if
${HAVE_LIBGCC} == "no"
185 SHLIB_SHFLAGS
+= -Wl
,-z
,defs