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}/minix
/lib
/libsys
26 LIBMINIXCDIR
= ${NETBSDSRCDIR}/minix
/lib
/libc
27 LIBMINIXCARCHDIR
= ${NETBSDSRCDIR}/minix
/lib
/libc
/arch
/${MACHINE_CPU}
28 LIBCDIR
= ${NETBSDSRCDIR}/lib
/libc
29 LIBCARCHDIR
= ${LIBCDIR}/arch
/${MACHINE_CPU}
30 LIBCOMMONCDIR
= ${NETBSDSRCDIR}/common
/lib
/libc
31 LIBCOMMONCARCHDIR
= ${LIBCOMMONCDIR}/arch
/${MACHINE_CPU}
33 CPPFLAGS
+= -I
${LIBCDIR}/include -I
${LIBCDIR}
39 # Customized versions of libc functions.
41 SRCS
+= atoi.c fputs.c _snprintf.c strtol.c
42 CPPFLAGS._snprintf.c
+= -I
${LIBSADIR}
44 CPPFLAGS.strtol.c
+= -D_STANDALONE
45 CPPFLAGS.strtol.c
+= -I
${LIBCOMMONCDIR}/stdlib
46 CPPFLAGS.strtol.c
+= -I
${NETBSDSRCDIR}/sys
48 ########################################################################
50 # Functions imported from libsa (StandAlone)
53 errno.o printf.o strerror.o subr_prf.o
54 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBSADIR}/${f
:C
/\.o
/.c
/}
55 ${f} ${f
:C
/\.o
/.go
/}: ${LIBSADIR}/${f
:C
/\.o
/.c
/}
59 .if
${USE_BITCODE
:Uno
} == "yes"
60 OBJS
+= ${f
:C
/\.o
/.bc
/}
61 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
62 .
endif # ${USE_BITCODE:Uno} == "yes"
65 CPPFLAGS.fslib.c
+= -I
${NETBSDSRCDIR}/minix
/fs
67 # LSC: I would like not to have to copy te file, but I can't
68 # have libsa appear first in the .PATH, for a lot of files
69 # would be taken from there, which is not the intention ATM.
70 CPPFLAGS.strerror.c
+= -I
${LIBSADIR}
72 # LSC: putchar and kputc have the same role / signature.
73 CPPFLAGS.subr_prf.c
+= -Dputchar
=kputc
75 # Activate optional support, may be deactivated.
76 CPPFLAGS.subr_prf.c
+= -DLIBSA_PRINTF_LONGLONG_SUPPORT
77 CPPFLAGS.subr_prf.c
+= -DLIBSA_PRINTF_WIDTH_SUPPORT
79 ########################################################################
85 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBSYSDIR}/${f
:C
/\.o
/.c
/}
86 ${f} ${f
:C
/\.o
/.go
/}: ${LIBSYSDIR}/${f
:C
/\.o
/.c
/}
90 .if
${USE_BITCODE
:Uno
} == "yes"
91 OBJS
+= ${f
:C
/\.o
/.bc
/}
92 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
93 .
endif # ${USE_BITCODE:Uno} == "yes"
96 ########################################################################
98 # Shared libc with userspace (/common/lib/libc)
103 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCOMMONCDIR}/gen
/${f
:C
/\.o
/.c
/}
104 ${f} ${f
:C
/\.o
/.go
/}: ${LIBCOMMONCDIR}/gen
/${f
:C
/\.o
/.c
/}
108 .if
${USE_BITCODE
:Uno
} == "yes"
109 OBJS
+= ${f
:C
/\.o
/.bc
/}
110 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
111 .
endif # ${USE_BITCODE:Uno} == "yes"
114 CPPFLAGS.rb.c
+= -D_LIBC
118 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCOMMONCDIR}/hash
/sha2
/${f
:C
/\.o
/.c
/}
119 ${f} ${f
:C
/\.o
/.go
/}: ${LIBCOMMONCDIR}/hash
/sha2
/${f
:C
/\.o
/.c
/}
123 .if
${USE_BITCODE
:Uno
} == "yes"
124 OBJS
+= ${f
:C
/\.o
/.bc
/}
125 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
126 .
endif # ${USE_BITCODE:Uno} == "yes"
129 CPPFLAGS.sha2.c
+= -I
${NETBSDSRCDIR}/sys
132 ashrdi3.o divdi3.o lshrdi3.o moddi3.o \
133 udivdi3.o umoddi3.o umodsi3.o udivsi3.o \
134 udivmoddi4.o divsi3.o modsi3.o divmoddi4.o \
135 divmodsi4.o udivmodsi4.o
#qdivrem.o lshldi3.o
136 ${f} ${f
:C
/\.o
/.bc
/}: ${NETBSDSRCDIR}/sys
/external
/bsd
/compiler_rt
/dist/lib
/builtins
/${f
:C
/\.o
/.c
/}
137 ${f} ${f
:C
/\.o
/.go
/}: ${NETBSDSRCDIR}/sys
/external
/bsd
/compiler_rt
/dist/lib
/builtins
/${f
:C
/\.o
/.c
/}
141 COPTS
+= -Wno-missing-prototypes \
142 -Wno-old-style-definition \
143 -Wno-strict-prototypes \
149 .if
${USE_BITCODE
:Uno
} == "yes"
150 OBJS
+= ${f
:C
/\.o
/.bc
/}
151 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
152 .
endif # ${USE_BITCODE:Uno} == "yes"
157 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCOMMONCDIR}/stdlib
/${f
:C
/\.o
/.c
/}
158 ${f} ${f
:C
/\.o
/.go
/}: ${LIBCOMMONCDIR}/stdlib
/${f
:C
/\.o
/.c
/}
162 .if
${USE_BITCODE
:Uno
} == "yes"
163 OBJS
+= ${f
:C
/\.o
/.bc
/}
164 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
165 .
endif # ${USE_BITCODE:Uno} == "yes"
168 CPPFLAGS.strtoul.c
+= -D_STANDALONE
169 CPPFLAGS.strtoul.c
+= -I
${NETBSDSRCDIR}/sys
172 strcasecmp.o strcspn.o strncasecmp.o strnlen.o strlcat.o
173 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCOMMONCDIR}/string
/${f
:C
/\.o
/.c
/}
174 ${f} ${f
:C
/\.o
/.go
/}: ${LIBCOMMONCDIR}/string
/${f
:C
/\.o
/.c
/}
178 .if
${USE_BITCODE
:Uno
} == "yes"
179 OBJS
+= ${f
:C
/\.o
/.bc
/}
180 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
181 .
endif # ${USE_BITCODE:Uno} == "yes"
184 ########################################################################
186 # Functions imported directly from libc.
189 .
include "${.CURDIR}/arch/${MACHINE_ARCH}/Makefile.libc.inc"
191 # This file is specifically generated
194 errlist.c
: ${LIBCDIR}/gen
/errlist.awk \
195 ${NETBSDSRCDIR}/sys
/sys
/errno.h
196 ${TOOL_CAT} ${NETBSDSRCDIR}/sys
/sys
/errno.h |
${TOOL_SED} 's/(_SIGN//' |
${TOOL_AWK} -f
${LIBCDIR}/gen
/errlist.awk
> ${.TARGET
}
197 CLEANFILES
+= errlist.c
201 getprogname.o setprogname.o execle.o sleep.o time.o \
202 ctype_.o tolower_.o toupper_.o usleep.o waitpid.o sigsetops.o
203 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCDIR}/gen
/${f
:C
/\.o
/.c
/}
204 ${f} ${f
:C
/\.o
/.go
/}: ${LIBCDIR}/gen
/${f
:C
/\.o
/.c
/}
208 .if
${USE_BITCODE
:Uno
} == "yes"
209 OBJS
+= ${f
:C
/\.o
/.bc
/}
210 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
211 .
endif # ${USE_BITCODE:Uno} == "yes"
214 CPPFLAGS.ctype_.c
+= -I
${LIBCDIR}/locale
215 CPPFLAGS.isctype.c
+= -I
${LIBCDIR}/locale
216 CPPFLAGS.tolower_.c
+= -I
${LIBCDIR}/locale
217 CPPFLAGS.toupper_.c
+= -I
${LIBCDIR}/locale
220 read_tsc_64.o fslib.o itoa.o
221 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBMINIXCDIR}/gen
/${f
:C
/\.o
/.c
/}
222 ${f} ${f
:C
/\.o
/.go
/}: ${LIBMINIXCDIR}/gen
/${f
:C
/\.o
/.c
/}
226 .if
${USE_BITCODE
:Uno
} == "yes"
227 OBJS
+= ${f
:C
/\.o
/.bc
/}
228 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
229 .
endif # ${USE_BITCODE:Uno} == "yes"
233 initfini.o stack_protector.o
234 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCDIR}/misc
/${f
:C
/\.o
/.c
/}
235 ${f} ${f
:C
/\.o
/.go
/}: ${LIBCDIR}/misc
/${f
:C
/\.o
/.c
/}
239 .if
${USE_BITCODE
:Uno
} == "yes"
240 OBJS
+= ${f
:C
/\.o
/.bc
/}
241 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
242 .
endif # ${USE_BITCODE:Uno} == "yes"
245 CPPFLAGS.stack_protector.c
+= -Dxprintf
=printf
248 regcomp.o regerror.o regexec.o regfree.o
249 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCDIR}/regex
/${f
:C
/\.o
/.c
/}
250 ${f} ${f
:C
/\.o
/.go
/}: ${LIBCDIR}/regex
/${f
:C
/\.o
/.c
/}
254 .if
${USE_BITCODE
:Uno
} == "yes"
255 OBJS
+= ${f
:C
/\.o
/.bc
/}
256 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
257 .
endif # ${USE_BITCODE:Uno} == "yes"
261 abort.o atexit.o _env.o exit.o getenv.o \
262 ldiv.o malloc.o setenv.o \
263 reallocarr.o _rand48.o lrand48.o srand48.o
264 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCDIR}/stdlib
/${f
:C
/\.o
/.c
/}
265 ${f} ${f
:C
/\.o
/.go
/}: ${LIBCDIR}/stdlib
/${f
:C
/\.o
/.c
/}
269 .if
${USE_BITCODE
:Uno
} == "yes"
270 OBJS
+= ${f
:C
/\.o
/.bc
/}
271 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
272 .
endif # ${USE_BITCODE:Uno} == "yes"
274 # LSC FIXME: Try to get this out of the loop
275 CPPFLAGS.
${i}+= -I
${LIBCDIR}/stdlib
278 CPPFLAGS.malloc.c
+= -D_LIBSYS
279 # Avoid magic instrumentation of the malloc data variables, since the heap is
280 # reconstructed upon state transfer. We do need to instrument the malloc
281 # functions, since we need to hook their mmap/munmap calls.
282 SECTIONIFY.malloc.c
+= -sectionify-no-override \
283 -sectionify-data-section-map
=.
*/magic_malloc_data
287 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCDIR}/string
/${f
:C
/\.o
/.c
/}
288 ${f} ${f
:C
/\.o
/.go
/}: ${LIBCDIR}/string
/${f
:C
/\.o
/.c
/}
292 .if
${USE_BITCODE
:Uno
} == "yes"
293 OBJS
+= ${f
:C
/\.o
/.bc
/}
294 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
295 .
endif # ${USE_BITCODE:Uno} == "yes"
299 access.o brk.o close.o environ.o execve.o fork.o fsync.o \
300 getgid.o getpid.o geteuid.o getuid.o gettimeofday.o getvfsstat.o \
301 init.o kernel_utils.o kill.o link.o loadname.o lseek.o _mcontext.o \
302 minix_rs.o mknod.o mmap.o nanosleep.o open.o pread.o pwrite.o read.o \
303 sbrk.o select.o setuid.o sigprocmask.o stack_utils.o \
304 stat.o stime.o svrctl.o syscall.o __sysctl.o _ucontext.o umask.o \
305 unlink.o wait4.o write.o
306 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBMINIXCDIR}/sys
/${f
:C
/\.o
/.c
/}
307 ${f} ${f
:C
/\.o
/.go
/}: ${LIBMINIXCDIR}/sys
/${f
:C
/\.o
/.c
/}
311 .if
${USE_BITCODE
:Uno
} == "yes"
312 OBJS
+= ${f
:C
/\.o
/.bc
/}
313 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
314 .
endif # ${USE_BITCODE:Uno} == "yes"
318 brksize.o _do_kernel_call_intr.o ipc_minix_kerninfo.o _ipc.o ucontext.o
319 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBMINIXCARCHDIR}/sys
/${f
:C
/\.o
/.S
/}
320 ${f} ${f
:C
/\.o
/.go
/}: ${LIBMINIXCARCHDIR}/sys
/${f
:C
/\.o
/.S
/}
324 .if
${USE_BITCODE
:Uno
} == "yes"
325 OBJS
+= ${f
:C
/\.o
/.bc
/}
326 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
327 .
endif # ${USE_BITCODE:Uno} == "yes"
332 ${f} ${f
:C
/\.o
/.bc
/}: ${LIBCDIR}/time
/${f
:C
/\.o
/.c
/}
333 ${f} ${f
:C
/\.o
/.go
/}: ${LIBCDIR}/time
/${f
:C
/\.o
/.c
/}
337 .if
${USE_BITCODE
:Uno
} == "yes"
338 OBJS
+= ${f
:C
/\.o
/.bc
/}
339 CLEANFILES
+= ${f
:C
/\.o
/.bc
/}
340 .
endif # ${USE_BITCODE:Uno} == "yes"
343 ARCHSUBDIR
=${MACHINE_CPU}
344 .
include "${NETBSDSRCDIR}/minix/lib/libc/arch/${MACHINE_CPU}/Makefile.inc"
346 .
include <bsd.lib.mk
>