2 # Minimal libc for servers and drivers.
5 # LSC: TODO: Explaination of how this works
7 #${f} ${f:C/\.o/.bc/}: ${NETBSDSRCDIR}//${f:C/\.o/.S/}
8 #OBJS+= ${f} ${f:C/\.o/.bc/}
9 #CLEANFILES+= ${f} ${f:C/\.o/.bc/}
11 #.if ${USE_BITCODE:Uno} == "yes"
12 #OBJS+= ${f:C/\.o/.bc/}
13 #CLEANFILES+= ${f:C/\.o/.bc/}
14 #.endif # ${USE_BITCODE:Uno} == "yes"
22 MKPIC
= no
# Never used as a dynamic library
24 LIBSADIR
= ${NETBSDSRCDIR}/sys
/lib
/libsa
25 LIBSYSDIR
= ${NETBSDSRCDIR}/lib
/libsys
26 LIBCDIR
= ${NETBSDSRCDIR}/lib
/libc
27 LIBCARCHDIR
= ${LIBCDIR}/arch
/${MACHINE_CPU}
28 LIBCOMMONCDIR
= ${NETBSDSRCDIR}/common
/lib
/libc
29 LIBCOMMONCARCHDIR
= ${LIBCOMMONCDIR}/arch
/${MACHINE_CPU}
31 CPPFLAGS
+= -I
${LIBCDIR}/include -I
${LIBCDIR}
37 # Customized versions of libc functions.
39 SRCS
+= atoi.c fputs.c _snprintf.c strtol.c
40 CPPFLAGS._snprintf.c
+= -I
${LIBSADIR}
42 CPPFLAGS.strtol.c
+= -D_STANDALONE
43 CPPFLAGS.strtol.c
+= -I
${LIBCOMMONCDIR}/stdlib
44 CPPFLAGS.strtol.c
+= -I
${NETBSDSRCDIR}/sys
46 ########################################################################
48 # Functions imported from libsa (StandAlone)
51 errno.o printf.o sprintf.o strerror.o subr_prf.o
52 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBSADIR}/${f
:C
/\.o
/.c
/}
56 .if
${USE_BITCODE
:Uno
} == "yes"
57 OBJS
+= ${f
:C
/\.o
/.bc
/}
58 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
59 .
endif # ${USE_BITCODE:Uno} == "yes"
62 # LSC: I would like not to have to copy te file, but I can't
63 # have libsa appear first in the .PATH, for a lot of files
64 # would be taken from there, which is not the intention ATM.
65 CPPFLAGS.strerror.c
+= -I
${LIBSADIR}
67 # LSC: putchar and kputc have the same role / signature.
68 CPPFLAGS.subr_prf.c
+= -Dputchar
=kputc
70 # Activate optional support, may be deactivated.
71 CPPFLAGS.subr_prf.c
+= -DLIBSA_PRINTF_LONGLONG_SUPPORT
72 CPPFLAGS.subr_prf.c
+= -DLIBSA_PRINTF_WIDTH_SUPPORT
74 ########################################################################
80 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBSYSDIR}/${f
:C
/\.o
/.c
/}
84 .if
${USE_BITCODE
:Uno
} == "yes"
85 OBJS
+= ${f
:C
/\.o
/.bc
/}
86 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
87 .
endif # ${USE_BITCODE:Uno} == "yes"
90 ########################################################################
92 # Shared libc with userspace (/common/lib/libc)
97 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCOMMONCDIR}/gen
/${f
:C
/\.o
/.c
/}
101 .if
${USE_BITCODE
:Uno
} == "yes"
102 OBJS
+= ${f
:C
/\.o
/.bc
/}
103 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
104 .
endif # ${USE_BITCODE:Uno} == "yes"
107 CPPFLAGS.bswap64.c
+= -D_STANDALONE
108 CPPFLAGS.rb.c
+= -D_LIBC
112 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCOMMONCDIR}/hash
/sha2
/${f
:C
/\.o
/.c
/}
116 .if
${USE_BITCODE
:Uno
} == "yes"
117 OBJS
+= ${f
:C
/\.o
/.bc
/}
118 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
119 .
endif # ${USE_BITCODE:Uno} == "yes"
122 CPPFLAGS.sha2.c
+= -D_STANDALONE
123 CPPFLAGS.sha2.c
+= -I
${NETBSDSRCDIR}/sys
126 divdi3.o moddi3.o udivdi3.o umoddi3.o qdivrem.o
127 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCOMMONCDIR}/quad
/${f
:C
/\.o
/.c
/}
131 .if
${USE_BITCODE
:Uno
} == "yes"
132 OBJS
+= ${f
:C
/\.o
/.bc
/}
133 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
134 .
endif # ${USE_BITCODE:Uno} == "yes"
139 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCOMMONCDIR}/stdlib
/${f
:C
/\.o
/.c
/}
143 .if
${USE_BITCODE
:Uno
} == "yes"
144 OBJS
+= ${f
:C
/\.o
/.bc
/}
145 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
146 .
endif # ${USE_BITCODE:Uno} == "yes"
149 CPPFLAGS.strtoul.c
+= -D_STANDALONE
150 CPPFLAGS.strtoul.c
+= -I
${NETBSDSRCDIR}/sys
153 strcasecmp.o strncasecmp.o strnlen.o strlcat.o
154 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCOMMONCDIR}/string
/${f
:C
/\.o
/.c
/}
158 .if
${USE_BITCODE
:Uno
} == "yes"
159 OBJS
+= ${f
:C
/\.o
/.bc
/}
160 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
161 .
endif # ${USE_BITCODE:Uno} == "yes"
164 ########################################################################
166 # Functions imported directly from libc.
169 .
include "${.CURDIR}/arch/${MACHINE_ARCH}/Makefile.libc.inc"
171 # This file is specifically generated
174 errlist.c
: ${LIBCDIR}/gen
/errlist.awk \
175 ${NETBSDSRCDIR}/sys
/sys
/errno.h
176 ${TOOL_CAT} ${NETBSDSRCDIR}/sys
/sys
/errno.h |
${TOOL_SED} 's/(_SIGN//' |
${TOOL_AWK} -f
${LIBCDIR}/gen
/errlist.awk
> ${.TARGET
}
177 CLEANFILES
+= errlist.c
181 getprogname.o setprogname.o execle.o sleep.o time.o \
182 ctype_.o tolower_.o toupper_.o usleep.o sigsetops.o
183 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCDIR}/gen
/${f
:C
/\.o
/.c
/}
187 .if
${USE_BITCODE
:Uno
} == "yes"
188 OBJS
+= ${f
:C
/\.o
/.bc
/}
189 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
190 .
endif # ${USE_BITCODE:Uno} == "yes"
193 CPPFLAGS.ctype_.c
+= -I
${LIBCDIR}/locale
194 CPPFLAGS.isctype.c
+= -I
${LIBCDIR}/locale
195 CPPFLAGS.tolower_.c
+= -I
${LIBCDIR}/locale
196 CPPFLAGS.toupper_.c
+= -I
${LIBCDIR}/locale
200 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCDIR}/gen
/minix
/${f
:C
/\.o
/.c
/}
204 .if
${USE_BITCODE
:Uno
} == "yes"
205 OBJS
+= ${f
:C
/\.o
/.bc
/}
206 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
207 .
endif # ${USE_BITCODE:Uno} == "yes"
211 initfini.o stack_protector.o
212 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCDIR}/misc
/${f
:C
/\.o
/.c
/}
216 .if
${USE_BITCODE
:Uno
} == "yes"
217 OBJS
+= ${f
:C
/\.o
/.bc
/}
218 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
219 .
endif # ${USE_BITCODE:Uno} == "yes"
222 CPPFLAGS.stack_protector.c
+= -Dxprintf
=printf
225 regcomp.o regerror.o regexec.o regfree.o
226 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCDIR}/regex
/${f
:C
/\.o
/.c
/}
230 .if
${USE_BITCODE
:Uno
} == "yes"
231 OBJS
+= ${f
:C
/\.o
/.bc
/}
232 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
233 .
endif # ${USE_BITCODE:Uno} == "yes"
237 abort.o atexit.o _env.o exit.o getenv.o \
239 _rand48.o lrand48.o srand48.o
240 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCDIR}/stdlib
/${f
:C
/\.o
/.c
/}
244 .if
${USE_BITCODE
:Uno
} == "yes"
245 OBJS
+= ${f
:C
/\.o
/.bc
/}
246 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
247 .
endif # ${USE_BITCODE:Uno} == "yes"
249 # LSC FIXME: Try to get this out of the loop
250 CPPFLAGS.
${i}+= -I
${LIBCDIR}/stdlib
255 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCDIR}/string
/${f
:C
/\.o
/.c
/}
259 .if
${USE_BITCODE
:Uno
} == "yes"
260 OBJS
+= ${f
:C
/\.o
/.bc
/}
261 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
262 .
endif # ${USE_BITCODE:Uno} == "yes"
264 CPPFLAGS.strcspn.c
+= -D_LIBC
267 access.o brk.o close.o environ.o execve.o fork.o fsync.o \
268 getgid.o getpid.o geteuid.o getuid.o gettimeofday.o getvfsstat.o \
269 init.o link.o loadname.o lseek.o _mcontext.o mknod.o \
270 mmap.o nanosleep.o open.o pread.o pwrite.o read.o sbrk.o \
271 select.o setuid.o sigprocmask.o stack_utils.o stat.o stime.o \
272 syscall.o _ucontext.o umask.o unlink.o write.o \
274 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCDIR}/sys-minix
/${f
:C
/\.o
/.c
/}
278 .if
${USE_BITCODE
:Uno
} == "yes"
279 OBJS
+= ${f
:C
/\.o
/.bc
/}
280 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
281 .
endif # ${USE_BITCODE:Uno} == "yes"
284 CPPFLAGS.malloc.c
+= -D_LIBSYS
287 brksize.o _do_kernel_call_intr.o get_minix_kerninfo.o _ipc.o ucontext.o
288 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCARCHDIR}/sys-minix
/${f
:C
/\.o
/.S
/}
292 .if
${USE_BITCODE
:Uno
} == "yes"
293 OBJS
+= ${f
:C
/\.o
/.bc
/}
294 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
295 .
endif # ${USE_BITCODE:Uno} == "yes"
298 .
include <bsd.lib.mk
>