custom message type for VM_INFO
[minix3.git] / lib / libminc / Makefile
blob4c5a0db32a34572d94c17e84ced5e1bd135f3d00
2 # Minimal libc for servers and drivers.
5 # LSC: TODO: Explaination of how this works
6 #.for f in \
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"
16 #.endfor
18 .include <bsd.own.mk>
20 LIB= minc
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}
32 CPPFLAGS+= -D_LIBMINC
34 CFLAGS+= -fno-builtin
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)
50 .for f in \
51 errno.o printf.o sprintf.o strerror.o subr_prf.o
52 ${f} ${f:C/\.o/.bc/}: ${LIBSADIR}/${f:C/\.o/.c/}
53 OBJS+= ${f}
54 CLEANFILES+= ${f}
56 .if ${USE_BITCODE:Uno} == "yes"
57 OBJS+= ${f:C/\.o/.bc/}
58 CLEANFILES+= ${f:C/\.o/.bc/}
59 .endif # ${USE_BITCODE:Uno} == "yes"
60 .endfor
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 ########################################################################
76 # Imports from libsys
78 .for f in \
79 kputc.o sys_diagctl.o
80 ${f} ${f:C/\.o/.bc/}: ${LIBSYSDIR}/${f:C/\.o/.c/}
81 OBJS+= ${f}
82 CLEANFILES+= ${f}
84 .if ${USE_BITCODE:Uno} == "yes"
85 OBJS+= ${f:C/\.o/.bc/}
86 CLEANFILES+= ${f:C/\.o/.bc/}
87 .endif # ${USE_BITCODE:Uno} == "yes"
88 .endfor
90 ########################################################################
92 # Shared libc with userspace (/common/lib/libc)
95 .for f in \
96 bswap64.o rb.o
97 ${f} ${f:C/\.o/.bc/}: ${LIBCOMMONCDIR}/gen/${f:C/\.o/.c/}
98 OBJS+= ${f}
99 CLEANFILES+= ${f}
101 .if ${USE_BITCODE:Uno} == "yes"
102 OBJS+= ${f:C/\.o/.bc/}
103 CLEANFILES+= ${f:C/\.o/.bc/}
104 .endif # ${USE_BITCODE:Uno} == "yes"
105 .endfor
107 CPPFLAGS.bswap64.c+= -D_STANDALONE
108 CPPFLAGS.rb.c+= -D_LIBC
110 .for f in \
111 sha2.o
112 ${f} ${f:C/\.o/.bc/}: ${LIBCOMMONCDIR}/hash/sha2/${f:C/\.o/.c/}
113 OBJS+= ${f}
114 CLEANFILES+= ${f}
116 .if ${USE_BITCODE:Uno} == "yes"
117 OBJS+= ${f:C/\.o/.bc/}
118 CLEANFILES+= ${f:C/\.o/.bc/}
119 .endif # ${USE_BITCODE:Uno} == "yes"
120 .endfor
122 CPPFLAGS.sha2.c+= -D_STANDALONE
123 CPPFLAGS.sha2.c+= -I${NETBSDSRCDIR}/sys
125 .for f in \
126 divdi3.o moddi3.o udivdi3.o umoddi3.o qdivrem.o
127 ${f} ${f:C/\.o/.bc/}: ${LIBCOMMONCDIR}/quad/${f:C/\.o/.c/}
128 OBJS+= ${f}
129 CLEANFILES+= ${f}
131 .if ${USE_BITCODE:Uno} == "yes"
132 OBJS+= ${f:C/\.o/.bc/}
133 CLEANFILES+= ${f:C/\.o/.bc/}
134 .endif # ${USE_BITCODE:Uno} == "yes"
135 .endfor
137 .for f in \
138 random.o strtoul.o
139 ${f} ${f:C/\.o/.bc/}: ${LIBCOMMONCDIR}/stdlib/${f:C/\.o/.c/}
140 OBJS+= ${f}
141 CLEANFILES+= ${f}
143 .if ${USE_BITCODE:Uno} == "yes"
144 OBJS+= ${f:C/\.o/.bc/}
145 CLEANFILES+= ${f:C/\.o/.bc/}
146 .endif # ${USE_BITCODE:Uno} == "yes"
147 .endfor
149 CPPFLAGS.strtoul.c+= -D_STANDALONE
150 CPPFLAGS.strtoul.c+= -I${NETBSDSRCDIR}/sys
152 .for f in \
153 strcasecmp.o strncasecmp.o strnlen.o strlcat.o
154 ${f} ${f:C/\.o/.bc/}: ${LIBCOMMONCDIR}/string/${f:C/\.o/.c/}
155 OBJS+= ${f}
156 CLEANFILES+= ${f}
158 .if ${USE_BITCODE:Uno} == "yes"
159 OBJS+= ${f:C/\.o/.bc/}
160 CLEANFILES+= ${f:C/\.o/.bc/}
161 .endif # ${USE_BITCODE:Uno} == "yes"
162 .endfor
164 ########################################################################
166 # Functions imported directly from libc.
169 .include "${.CURDIR}/arch/${MACHINE_ARCH}/Makefile.libc.inc"
171 # This file is specifically generated
172 SRCS+= errlist.c
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
179 .for f in \
180 _errno.o \
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/}
184 OBJS+= ${f}
185 CLEANFILES+= ${f}
187 .if ${USE_BITCODE:Uno} == "yes"
188 OBJS+= ${f:C/\.o/.bc/}
189 CLEANFILES+= ${f:C/\.o/.bc/}
190 .endif # ${USE_BITCODE:Uno} == "yes"
191 .endfor
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
198 .for f in \
199 waitpid.o
200 ${f} ${f:C/\.o/.bc/}: ${LIBCDIR}/gen/minix/${f:C/\.o/.c/}
201 OBJS+= ${f}
202 CLEANFILES+= ${f}
204 .if ${USE_BITCODE:Uno} == "yes"
205 OBJS+= ${f:C/\.o/.bc/}
206 CLEANFILES+= ${f:C/\.o/.bc/}
207 .endif # ${USE_BITCODE:Uno} == "yes"
208 .endfor
210 .for f in \
211 initfini.o stack_protector.o
212 ${f} ${f:C/\.o/.bc/}: ${LIBCDIR}/misc/${f:C/\.o/.c/}
213 OBJS+= ${f}
214 CLEANFILES+= ${f}
216 .if ${USE_BITCODE:Uno} == "yes"
217 OBJS+= ${f:C/\.o/.bc/}
218 CLEANFILES+= ${f:C/\.o/.bc/}
219 .endif # ${USE_BITCODE:Uno} == "yes"
220 .endfor
222 CPPFLAGS.stack_protector.c+= -Dxprintf=printf
224 .for f in \
225 regcomp.o regerror.o regexec.o regfree.o
226 ${f} ${f:C/\.o/.bc/}: ${LIBCDIR}/regex/${f:C/\.o/.c/}
227 OBJS+= ${f}
228 CLEANFILES+= ${f}
230 .if ${USE_BITCODE:Uno} == "yes"
231 OBJS+= ${f:C/\.o/.bc/}
232 CLEANFILES+= ${f:C/\.o/.bc/}
233 .endif # ${USE_BITCODE:Uno} == "yes"
234 .endfor
236 .for f in \
237 abort.o atexit.o _env.o exit.o getenv.o \
238 ldiv.o malloc.o \
239 _rand48.o lrand48.o srand48.o
240 ${f} ${f:C/\.o/.bc/}: ${LIBCDIR}/stdlib/${f:C/\.o/.c/}
241 OBJS+= ${f}
242 CLEANFILES+= ${f}
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
251 .endfor
253 .for f in \
254 strcspn.o
255 ${f} ${f:C/\.o/.bc/}: ${LIBCDIR}/string/${f:C/\.o/.c/}
256 OBJS+= ${f}
257 CLEANFILES+= ${f}
259 .if ${USE_BITCODE:Uno} == "yes"
260 OBJS+= ${f:C/\.o/.bc/}
261 CLEANFILES+= ${f:C/\.o/.bc/}
262 .endif # ${USE_BITCODE:Uno} == "yes"
263 .endfor
264 CPPFLAGS.strcspn.c+= -D_LIBC
266 .for f in \
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 \
273 kill.o
274 ${f} ${f:C/\.o/.bc/}: ${LIBCDIR}/sys-minix/${f:C/\.o/.c/}
275 OBJS+= ${f}
276 CLEANFILES+= ${f}
278 .if ${USE_BITCODE:Uno} == "yes"
279 OBJS+= ${f:C/\.o/.bc/}
280 CLEANFILES+= ${f:C/\.o/.bc/}
281 .endif # ${USE_BITCODE:Uno} == "yes"
282 .endfor
284 CPPFLAGS.malloc.c+= -D_LIBSYS
286 .for f in \
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/}
289 OBJS+= ${f}
290 CLEANFILES+= ${f}
292 .if ${USE_BITCODE:Uno} == "yes"
293 OBJS+= ${f:C/\.o/.bc/}
294 CLEANFILES+= ${f:C/\.o/.bc/}
295 .endif # ${USE_BITCODE:Uno} == "yes"
296 .endfor
298 .include <bsd.lib.mk>