vm: fix a null dereference on out-of-memory
[minix.git] / lib / libminc / Makefile
blobb4909dc0de94312152876c01a77a80ecf8ea6945
2 # Minimal libc for servers and drivers.
5 .include <bsd.own.mk>
7 LIB= minc
9 CPPFLAGS.sched_start.c+= -I${NETBSDSRCDIR}
11 LIBCSRCDIR=${NETBSDSRCDIR}/lib/libc
14 # Shared libc with userspace (/common/lib/libc)
16 .include "${NETBSDSRCDIR}/common/lib/libc/Makefile.inc"
17 .include "${.CURDIR}/arch/${MACHINE_ARCH}/Makefile.libc.inc"
18 .if empty(SRCS:Mbyte_swap_8.*)
19 SRCS+= bswap64.c
20 .endif
22 .if (${MACHINE_ARCH} != "alpha") && \
23 (${MACHINE_ARCH} != "mips64eb") && \
24 (${MACHINE_ARCH} != "mips64el") && \
25 (${MACHINE_ARCH} != "powerpc64") && \
26 (${MACHINE_ARCH} != "sparc64") && \
27 (${MACHINE_ARCH} != "x86_64")
28 # Quad support
29 SRCS+= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c \
30 iordi3.c lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c \
31 notdi2.c qdivrem.c subdi3.c ucmpdi2.c udivdi3.c umoddi3.c \
32 xordi3.c
33 .endif
34 .for i in \
35 random.c strtoll.c strtoul.c strtoull.c strtoumax.c \
36 memchr.c memcmp.c memcpy.c memmove.c popcount32.c popcount64.c \
37 strcasecmp.c strcat.c strchr.c strcmp.c strcpy.c strlcat.c \
38 strlcpy.c strlen.c strncasecmp.c strncmp.c strncpy.c strnlen.c \
39 strrchr.c strsep.c strstr.c ptree.c rb.c sha1.c sha2.c
40 SRCS+= ${i}
41 CPPFLAGS.${i}+= -D_LIBC -I${LIBCSRCDIR}/include
42 .endfor
43 .if empty(SRCS:Mmemset2.*)
44 SRCS+= memset.c
45 .endif
48 # Customized versions of libc functions.
50 SRCS+= fputs.c _stdfile.c
51 CPPFLAGS.fputs.c+= -I${LIBCSRCDIR}/include
55 # Functions imported directly from the libc.
58 # Import from stdio
59 .for i in sprintf.c fprintf.c perror.c vsnprintf.c snprintf.c \
60 _rand48.c lrand48.c srand48.c
61 .PATH.c: ${LIBCSRCDIR}/stdio
62 CPPFLAGS.${i}= -I${LIBCSRCDIR}/stdio -I${LIBCSRCDIR}/include
63 SRCS+= ${i}
64 .endfor
65 # Import from stdlib
66 .for i in abort.c atexit.c atoi.c exit.c getenv.c \
67 getopt.c ldiv.c malloc.c
68 .PATH.c: ${LIBCSRCDIR}/stdlib
69 SRCS+= ${i}
70 CPPFLAGS.${i}+= -I${LIBCSRCDIR}/stdlib -I${LIBCSRCDIR}/include
71 .endfor
72 # Import from gen
74 errlist.c: ${LIBCSRCDIR}/gen/errlist.awk \
75 ${NETBSDSRCDIR}/include/sys/errno.h
76 cat ${NETBSDSRCDIR}/include/sys/errno.h | ${TOOL_SED} 's/(_SIGN//' | ${TOOL_AWK} -f ${LIBCSRCDIR}/gen/errlist.awk > ${.TARGET}
77 CLEANFILES+= errlist.c
79 .for i in assert.c _errno.c errno.c _env.c errlist.c \
80 execle.c getprogname.c sleep.c time.c \
81 ctype_.c isctype.c tolower_.c toupper_.c usleep.c \
82 infinityf_ieee754.c infinity_ieee754.c \
83 fpclassifyf_ieee754.c fpclassifyd_ieee754.c \
84 isinff_ieee754.c isinfd_ieee754.c \
85 isnanf_ieee754.c isnand_ieee754.c \
86 isfinitef_ieee754.c isfinited_ieee754.c \
87 signbitf_ieee754.c signbitd_ieee754.c \
88 nanf.c
89 .PATH.c: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/gen ${LIBCSRCDIR}/gen/minix \
90 ${LIBCSRCDIR}/gen ${LIBCSRCDIR}
91 SRCS+= ${i}
92 CPPFLAGS.${i}+= -I${LIBCSRCDIR}/include
93 .endfor
94 CPPFLAGS.ctype_.c+= -I${LIBCSRCDIR}/locale
95 CPPFLAGS.isctype.c+= -I${LIBCSRCDIR}/locale
96 CPPFLAGS.tolower_.c+= -I${LIBCSRCDIR}/locale
97 CPPFLAGS.toupper_.c+= -I${LIBCSRCDIR}/locale
98 # Import from regex
99 .for i in regcomp.c regerror.c regexec.c regfree.c
100 .PATH.c: ${LIBCSRCDIR}/regex
101 SRCS+= ${i}
102 CPPFLAGS.${i}+= -I${LIBCSRCDIR}/include
103 .endfor
104 # Import from string
105 .for i in strcspn.c strerror.c strerror_r.c strtol.c \
106 bcopy.S bzero.S
107 .PATH.S: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/string
108 .PATH.c: ${LIBCSRCDIR}/string
109 SRCS+= ${i}
110 CPPFLAGS.${i}+= -D_LIBC -I${LIBCSRCDIR}/include
111 .endfor
112 CPPFLAGS.strtol.c+= -I${LIBCSRCDIR}/../../common/lib/libc/stdlib
113 # Import from time
114 .for i in asctime.c localtime.c strftime.c
115 .PATH.c: ${LIBCSRCDIR}/time
116 SRCS+= ${i}
117 CPPFLAGS.${i}+= -I${LIBCSRCDIR}/include
118 .endfor
119 # Import from locale
120 .for i in _def_time.c
121 .PATH.c: ${LIBCSRCDIR}/locale
122 SRCS+= ${i}
123 CPPFLAGS.${i}+= -I${LIBCSRCDIR}/include -I${LIBCSRCDIR}/locale
124 .endfor
125 # Import from sys-minix
126 .for i in access.c brk.c close.c environ.c execve.c fork.c \
127 getgid.c getpid.c getuid.c gettimeofday.c loadname.c \
128 link.c _mcontext.c mknod.c mmap.c nanosleep.c open.c \
129 read.c sbrk.c select.c setuid.c sigprocmask.c stat.c \
130 stime.c syscall.c _ucontext.c umask.c unlink.c waitpid.c \
131 brksize.S _ipc.S _senda.S ucontext.S mmap.c init.c
132 .PATH.c: ${LIBCSRCDIR}/sys-minix
133 .PATH.S: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/sys-minix
134 SRCS+= ${i}
135 CPPFLAGS.${i}+= -I${LIBCSRCDIR}/include
136 .endfor
138 CPPFLAGS+= -D_LIBSYS
140 .include <bsd.lib.mk>