2011-04-27 15:00:52 +02:00
|
|
|
#
|
|
|
|
# Minimal libc for servers and drivers.
|
|
|
|
#
|
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
# LSC: TODO: Explaination of how this works
|
|
|
|
#.for f in \
|
2013-12-06 16:46:30 +01:00
|
|
|
#${f} ${f:C/\.o/.bc/}: ${NETBSDSRCDIR}//${f:C/\.o/.S/}
|
|
|
|
#OBJS+= ${f} ${f:C/\.o/.bc/}
|
|
|
|
#CLEANFILES+= ${f} ${f:C/\.o/.bc/}
|
|
|
|
#
|
|
|
|
#.if ${USE_BITCODE:Uno} == "yes"
|
|
|
|
#OBJS+= ${f:C/\.o/.bc/}
|
|
|
|
#CLEANFILES+= ${f:C/\.o/.bc/}
|
|
|
|
#.endif # ${USE_BITCODE:Uno} == "yes"
|
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
#.endfor
|
|
|
|
|
2011-07-09 15:17:12 +02:00
|
|
|
.include <bsd.own.mk>
|
|
|
|
|
|
|
|
LIB= minc
|
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
MKPIC= no # Never used as a dynamic library
|
2011-07-09 15:17:12 +02:00
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
LIBSADIR= ${NETBSDSRCDIR}/sys/lib/libsa
|
|
|
|
LIBSYSDIR= ${NETBSDSRCDIR}/lib/libsys
|
2013-06-16 01:43:39 +02:00
|
|
|
LIBCDIR= ${NETBSDSRCDIR}/lib/libc
|
2013-12-06 12:04:52 +01:00
|
|
|
LIBCARCHDIR= ${LIBCDIR}/arch/${MACHINE_CPU}
|
|
|
|
LIBCOMMONCDIR= ${NETBSDSRCDIR}/common/lib/libc
|
|
|
|
LIBCOMMONCARCHDIR= ${LIBCOMMONCDIR}/arch/${MACHINE_CPU}
|
|
|
|
|
|
|
|
CPPFLAGS+= -I${LIBCDIR}/include -I${LIBCDIR}
|
2012-11-15 12:06:41 +01:00
|
|
|
CPPFLAGS+= -D_LIBMINC
|
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
CFLAGS+= -fno-builtin
|
|
|
|
|
2012-11-15 12:06:41 +01:00
|
|
|
#
|
|
|
|
# Customized versions of libc functions.
|
|
|
|
#
|
2013-12-06 12:04:52 +01:00
|
|
|
SRCS+= atoi.c fputs.c _snprintf.c strtol.c
|
|
|
|
CPPFLAGS._snprintf.c+= -I${LIBSADIR}
|
|
|
|
|
|
|
|
CPPFLAGS.strtol.c+= -D_STANDALONE
|
|
|
|
CPPFLAGS.strtol.c+= -I${LIBCOMMONCDIR}/stdlib
|
|
|
|
CPPFLAGS.strtol.c+= -I${NETBSDSRCDIR}/sys
|
2011-04-27 15:00:52 +02:00
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
########################################################################
|
2011-04-27 15:00:52 +02:00
|
|
|
#
|
2013-12-06 12:04:52 +01:00
|
|
|
# Functions imported from libsa (StandAlone)
|
2011-04-27 15:00:52 +02:00
|
|
|
#
|
2013-12-06 12:04:52 +01:00
|
|
|
.for f in \
|
|
|
|
errno.o printf.o sprintf.o strerror.o subr_prf.o
|
2013-12-06 16:46:30 +01:00
|
|
|
${f} ${f:C/\.o/.bc/}: ${LIBSADIR}/${f:C/\.o/.c/}
|
2013-12-06 12:04:52 +01:00
|
|
|
OBJS+= ${f}
|
|
|
|
CLEANFILES+= ${f}
|
2013-12-06 16:46:30 +01:00
|
|
|
|
|
|
|
.if ${USE_BITCODE:Uno} == "yes"
|
|
|
|
OBJS+= ${f:C/\.o/.bc/}
|
|
|
|
CLEANFILES+= ${f:C/\.o/.bc/}
|
|
|
|
.endif # ${USE_BITCODE:Uno} == "yes"
|
2013-12-06 12:04:52 +01:00
|
|
|
.endfor
|
|
|
|
|
|
|
|
# LSC: I would like not to have to copy te file, but I can't
|
|
|
|
# have libsa appear first in the .PATH, for a lot of files
|
|
|
|
# would be taken from there, which is not the intention ATM.
|
|
|
|
CPPFLAGS.strerror.c+= -I${LIBSADIR}
|
2012-11-15 12:06:41 +01:00
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
# LSC: putchar and kputc have the same role / signature.
|
|
|
|
CPPFLAGS.subr_prf.c+= -Dputchar=kputc
|
|
|
|
|
|
|
|
# Activate optional support, may be deactivated.
|
|
|
|
CPPFLAGS.subr_prf.c+= -DLIBSA_PRINTF_LONGLONG_SUPPORT
|
|
|
|
CPPFLAGS.subr_prf.c+= -DLIBSA_PRINTF_WIDTH_SUPPORT
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
#
|
|
|
|
# Imports from libsys
|
|
|
|
#
|
|
|
|
.for f in \
|
|
|
|
kputc.o sys_diagctl.o
|
2013-12-06 16:46:30 +01:00
|
|
|
${f} ${f:C/\.o/.bc/}: ${LIBSYSDIR}/${f:C/\.o/.c/}
|
2013-12-06 12:04:52 +01:00
|
|
|
OBJS+= ${f}
|
|
|
|
CLEANFILES+= ${f}
|
2013-12-06 16:46:30 +01:00
|
|
|
|
|
|
|
.if ${USE_BITCODE:Uno} == "yes"
|
|
|
|
OBJS+= ${f:C/\.o/.bc/}
|
|
|
|
CLEANFILES+= ${f:C/\.o/.bc/}
|
|
|
|
.endif # ${USE_BITCODE:Uno} == "yes"
|
2011-04-27 15:00:52 +02:00
|
|
|
.endfor
|
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
########################################################################
|
2011-04-27 15:00:52 +02:00
|
|
|
#
|
2013-12-06 12:04:52 +01:00
|
|
|
# Shared libc with userspace (/common/lib/libc)
|
2011-04-27 15:00:52 +02:00
|
|
|
#
|
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
.for f in \
|
|
|
|
bswap64.o rb.o
|
2013-12-06 16:46:30 +01:00
|
|
|
${f} ${f:C/\.o/.bc/}: ${LIBCOMMONCDIR}/gen/${f:C/\.o/.c/}
|
2013-12-06 12:04:52 +01:00
|
|
|
OBJS+= ${f}
|
|
|
|
CLEANFILES+= ${f}
|
2013-12-06 16:46:30 +01:00
|
|
|
|
|
|
|
.if ${USE_BITCODE:Uno} == "yes"
|
|
|
|
OBJS+= ${f:C/\.o/.bc/}
|
|
|
|
CLEANFILES+= ${f:C/\.o/.bc/}
|
|
|
|
.endif # ${USE_BITCODE:Uno} == "yes"
|
2012-11-15 12:06:41 +01:00
|
|
|
.endfor
|
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
CPPFLAGS.bswap64.c+= -D_STANDALONE
|
|
|
|
CPPFLAGS.rb.c+= -D_LIBC
|
|
|
|
|
|
|
|
.for f in \
|
|
|
|
sha2.o
|
2013-12-06 16:46:30 +01:00
|
|
|
${f} ${f:C/\.o/.bc/}: ${LIBCOMMONCDIR}/hash/sha2/${f:C/\.o/.c/}
|
2013-12-06 12:04:52 +01:00
|
|
|
OBJS+= ${f}
|
|
|
|
CLEANFILES+= ${f}
|
2013-12-06 16:46:30 +01:00
|
|
|
|
|
|
|
.if ${USE_BITCODE:Uno} == "yes"
|
|
|
|
OBJS+= ${f:C/\.o/.bc/}
|
|
|
|
CLEANFILES+= ${f:C/\.o/.bc/}
|
|
|
|
.endif # ${USE_BITCODE:Uno} == "yes"
|
2011-04-27 15:00:52 +02:00
|
|
|
.endfor
|
2012-11-15 12:06:41 +01:00
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
CPPFLAGS.sha2.c+= -D_STANDALONE
|
|
|
|
CPPFLAGS.sha2.c+= -I${NETBSDSRCDIR}/sys
|
|
|
|
|
|
|
|
.for f in \
|
|
|
|
divdi3.o moddi3.o udivdi3.o umoddi3.o qdivrem.o
|
2013-12-06 16:46:30 +01:00
|
|
|
${f} ${f:C/\.o/.bc/}: ${LIBCOMMONCDIR}/quad/${f:C/\.o/.c/}
|
2013-12-06 12:04:52 +01:00
|
|
|
OBJS+= ${f}
|
|
|
|
CLEANFILES+= ${f}
|
2013-12-06 16:46:30 +01:00
|
|
|
|
|
|
|
.if ${USE_BITCODE:Uno} == "yes"
|
|
|
|
OBJS+= ${f:C/\.o/.bc/}
|
|
|
|
CLEANFILES+= ${f:C/\.o/.bc/}
|
|
|
|
.endif # ${USE_BITCODE:Uno} == "yes"
|
2011-04-27 15:00:52 +02:00
|
|
|
.endfor
|
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
.for f in \
|
|
|
|
random.o strtoul.o
|
2013-12-06 16:46:30 +01:00
|
|
|
${f} ${f:C/\.o/.bc/}: ${LIBCOMMONCDIR}/stdlib/${f:C/\.o/.c/}
|
2013-12-06 12:04:52 +01:00
|
|
|
OBJS+= ${f}
|
|
|
|
CLEANFILES+= ${f}
|
2013-12-06 16:46:30 +01:00
|
|
|
|
|
|
|
.if ${USE_BITCODE:Uno} == "yes"
|
|
|
|
OBJS+= ${f:C/\.o/.bc/}
|
|
|
|
CLEANFILES+= ${f:C/\.o/.bc/}
|
|
|
|
.endif # ${USE_BITCODE:Uno} == "yes"
|
2013-12-06 12:04:52 +01:00
|
|
|
.endfor
|
|
|
|
|
|
|
|
CPPFLAGS.strtoul.c+= -D_STANDALONE
|
|
|
|
CPPFLAGS.strtoul.c+= -I${NETBSDSRCDIR}/sys
|
|
|
|
|
|
|
|
.for f in \
|
|
|
|
strcasecmp.o strncasecmp.o strnlen.o strlcat.o
|
2013-12-06 16:46:30 +01:00
|
|
|
${f} ${f:C/\.o/.bc/}: ${LIBCOMMONCDIR}/string/${f:C/\.o/.c/}
|
2013-12-06 12:04:52 +01:00
|
|
|
OBJS+= ${f}
|
|
|
|
CLEANFILES+= ${f}
|
2013-12-06 16:46:30 +01:00
|
|
|
|
|
|
|
.if ${USE_BITCODE:Uno} == "yes"
|
|
|
|
OBJS+= ${f:C/\.o/.bc/}
|
|
|
|
CLEANFILES+= ${f:C/\.o/.bc/}
|
|
|
|
.endif # ${USE_BITCODE:Uno} == "yes"
|
2013-12-06 12:04:52 +01:00
|
|
|
.endfor
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
#
|
|
|
|
# Functions imported directly from libc.
|
|
|
|
#
|
|
|
|
|
|
|
|
.include "${.CURDIR}/arch/${MACHINE_ARCH}/Makefile.libc.inc"
|
|
|
|
|
|
|
|
# This file is specifically generated
|
|
|
|
SRCS+= errlist.c
|
|
|
|
|
2013-06-16 01:43:39 +02:00
|
|
|
errlist.c: ${LIBCDIR}/gen/errlist.awk \
|
2012-11-15 12:06:41 +01:00
|
|
|
${NETBSDSRCDIR}/sys/sys/errno.h
|
2013-06-16 01:43:39 +02:00
|
|
|
${TOOL_CAT} ${NETBSDSRCDIR}/sys/sys/errno.h | ${TOOL_SED} 's/(_SIGN//' | ${TOOL_AWK} -f ${LIBCDIR}/gen/errlist.awk > ${.TARGET}
|
2012-06-13 11:25:15 +02:00
|
|
|
CLEANFILES+= errlist.c
|
2011-04-27 15:00:52 +02:00
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
.for f in \
|
|
|
|
_errno.o \
|
|
|
|
getprogname.o setprogname.o execle.o sleep.o time.o \
|
|
|
|
ctype_.o tolower_.o toupper_.o usleep.o sigsetops.o
|
2013-12-06 16:46:30 +01:00
|
|
|
${f} ${f:C/\.o/.bc/}: ${LIBCDIR}/gen/${f:C/\.o/.c/}
|
2013-12-06 12:04:52 +01:00
|
|
|
OBJS+= ${f}
|
|
|
|
CLEANFILES+= ${f}
|
2013-12-06 16:46:30 +01:00
|
|
|
|
|
|
|
.if ${USE_BITCODE:Uno} == "yes"
|
|
|
|
OBJS+= ${f:C/\.o/.bc/}
|
|
|
|
CLEANFILES+= ${f:C/\.o/.bc/}
|
|
|
|
.endif # ${USE_BITCODE:Uno} == "yes"
|
2011-04-27 15:00:52 +02:00
|
|
|
.endfor
|
2013-12-06 12:04:52 +01:00
|
|
|
|
2013-06-16 01:43:39 +02:00
|
|
|
CPPFLAGS.ctype_.c+= -I${LIBCDIR}/locale
|
|
|
|
CPPFLAGS.isctype.c+= -I${LIBCDIR}/locale
|
|
|
|
CPPFLAGS.tolower_.c+= -I${LIBCDIR}/locale
|
|
|
|
CPPFLAGS.toupper_.c+= -I${LIBCDIR}/locale
|
2012-11-15 12:06:41 +01:00
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
.for f in \
|
|
|
|
waitpid.o
|
2013-12-06 16:46:30 +01:00
|
|
|
${f} ${f:C/\.o/.bc/}: ${LIBCDIR}/gen/minix/${f:C/\.o/.c/}
|
2013-12-06 12:04:52 +01:00
|
|
|
OBJS+= ${f}
|
|
|
|
CLEANFILES+= ${f}
|
2013-12-06 16:46:30 +01:00
|
|
|
|
|
|
|
.if ${USE_BITCODE:Uno} == "yes"
|
|
|
|
OBJS+= ${f:C/\.o/.bc/}
|
|
|
|
CLEANFILES+= ${f:C/\.o/.bc/}
|
|
|
|
.endif # ${USE_BITCODE:Uno} == "yes"
|
2011-04-27 15:00:52 +02:00
|
|
|
.endfor
|
2012-11-15 12:06:41 +01:00
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
.for f in \
|
|
|
|
initfini.o stack_protector.o
|
2013-12-06 16:46:30 +01:00
|
|
|
${f} ${f:C/\.o/.bc/}: ${LIBCDIR}/misc/${f:C/\.o/.c/}
|
2013-12-06 12:04:52 +01:00
|
|
|
OBJS+= ${f}
|
|
|
|
CLEANFILES+= ${f}
|
2013-12-06 16:46:30 +01:00
|
|
|
|
|
|
|
.if ${USE_BITCODE:Uno} == "yes"
|
|
|
|
OBJS+= ${f:C/\.o/.bc/}
|
|
|
|
CLEANFILES+= ${f:C/\.o/.bc/}
|
|
|
|
.endif # ${USE_BITCODE:Uno} == "yes"
|
2011-04-27 15:00:52 +02:00
|
|
|
.endfor
|
2012-11-15 12:06:41 +01:00
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
CPPFLAGS.stack_protector.c+= -Dxprintf=printf
|
2012-11-15 12:06:41 +01:00
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
.for f in \
|
|
|
|
regcomp.o regerror.o regexec.o regfree.o
|
2013-12-06 16:46:30 +01:00
|
|
|
${f} ${f:C/\.o/.bc/}: ${LIBCDIR}/regex/${f:C/\.o/.c/}
|
2013-12-06 12:04:52 +01:00
|
|
|
OBJS+= ${f}
|
|
|
|
CLEANFILES+= ${f}
|
2013-12-06 16:46:30 +01:00
|
|
|
|
|
|
|
.if ${USE_BITCODE:Uno} == "yes"
|
|
|
|
OBJS+= ${f:C/\.o/.bc/}
|
|
|
|
CLEANFILES+= ${f:C/\.o/.bc/}
|
|
|
|
.endif # ${USE_BITCODE:Uno} == "yes"
|
2013-12-06 12:04:52 +01:00
|
|
|
.endfor
|
2013-02-08 13:12:45 +01:00
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
.for f in \
|
|
|
|
abort.o atexit.o _env.o exit.o getenv.o \
|
|
|
|
ldiv.o malloc.o \
|
|
|
|
_rand48.o lrand48.o srand48.o
|
2013-12-06 16:46:30 +01:00
|
|
|
${f} ${f:C/\.o/.bc/}: ${LIBCDIR}/stdlib/${f:C/\.o/.c/}
|
2013-12-06 12:04:52 +01:00
|
|
|
OBJS+= ${f}
|
|
|
|
CLEANFILES+= ${f}
|
2013-12-06 16:46:30 +01:00
|
|
|
|
|
|
|
.if ${USE_BITCODE:Uno} == "yes"
|
|
|
|
OBJS+= ${f:C/\.o/.bc/}
|
|
|
|
CLEANFILES+= ${f:C/\.o/.bc/}
|
|
|
|
.endif # ${USE_BITCODE:Uno} == "yes"
|
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
# LSC FIXME: Try to get this out of the loop
|
|
|
|
CPPFLAGS.${i}+= -I${LIBCDIR}/stdlib
|
2011-04-27 15:00:52 +02:00
|
|
|
.endfor
|
2012-11-15 12:06:41 +01:00
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
.for f in \
|
|
|
|
strcspn.o
|
2013-12-06 16:46:30 +01:00
|
|
|
${f} ${f:C/\.o/.bc/}: ${LIBCDIR}/string/${f:C/\.o/.c/}
|
2013-12-06 12:04:52 +01:00
|
|
|
OBJS+= ${f}
|
|
|
|
CLEANFILES+= ${f}
|
2013-12-06 16:46:30 +01:00
|
|
|
|
|
|
|
.if ${USE_BITCODE:Uno} == "yes"
|
|
|
|
OBJS+= ${f:C/\.o/.bc/}
|
|
|
|
CLEANFILES+= ${f:C/\.o/.bc/}
|
|
|
|
.endif # ${USE_BITCODE:Uno} == "yes"
|
2013-12-06 12:04:52 +01:00
|
|
|
.endfor
|
|
|
|
CPPFLAGS.strcspn.c+= -D_LIBC
|
|
|
|
|
|
|
|
.for f in \
|
|
|
|
access.o brk.o close.o environ.o execve.o fork.o fsync.o \
|
|
|
|
getgid.o getpid.o geteuid.o getuid.o gettimeofday.o getvfsstat.o \
|
|
|
|
init.o link.o loadname.o lseek.o _mcontext.o mknod.o \
|
|
|
|
mmap.o nanosleep.o open.o pread.o pwrite.o read.o sbrk.o \
|
|
|
|
select.o setuid.o sigprocmask.o stack_utils.o stat.o stime.o \
|
|
|
|
syscall.o _ucontext.o umask.o unlink.o write.o \
|
|
|
|
kill.o
|
2013-12-06 16:46:30 +01:00
|
|
|
${f} ${f:C/\.o/.bc/}: ${LIBCDIR}/sys-minix/${f:C/\.o/.c/}
|
2013-12-06 12:04:52 +01:00
|
|
|
OBJS+= ${f}
|
|
|
|
CLEANFILES+= ${f}
|
2013-12-06 16:46:30 +01:00
|
|
|
|
|
|
|
.if ${USE_BITCODE:Uno} == "yes"
|
|
|
|
OBJS+= ${f:C/\.o/.bc/}
|
|
|
|
CLEANFILES+= ${f:C/\.o/.bc/}
|
|
|
|
.endif # ${USE_BITCODE:Uno} == "yes"
|
2011-04-27 15:00:52 +02:00
|
|
|
.endfor
|
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
CPPFLAGS.malloc.c+= -D_LIBSYS
|
2011-04-27 15:00:52 +02:00
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
.for f in \
|
|
|
|
brksize.o _do_kernel_call_intr.o get_minix_kerninfo.o _ipc.o ucontext.o
|
2013-12-06 16:46:30 +01:00
|
|
|
${f} ${f:C/\.o/.bc/}: ${LIBCARCHDIR}/sys-minix/${f:C/\.o/.S/}
|
2013-12-06 12:04:52 +01:00
|
|
|
OBJS+= ${f}
|
|
|
|
CLEANFILES+= ${f}
|
2013-12-06 16:46:30 +01:00
|
|
|
|
|
|
|
.if ${USE_BITCODE:Uno} == "yes"
|
|
|
|
OBJS+= ${f:C/\.o/.bc/}
|
|
|
|
CLEANFILES+= ${f:C/\.o/.bc/}
|
|
|
|
.endif # ${USE_BITCODE:Uno} == "yes"
|
2013-12-06 12:04:52 +01:00
|
|
|
.endfor
|
2013-06-16 01:43:39 +02:00
|
|
|
|
2011-07-09 15:17:12 +02:00
|
|
|
.include <bsd.lib.mk>
|