Remove building with NOCRYPTO option
[minix.git] / minix / lib / libminc / Makefile
blobe9bab6a734f0a9483631d8bc0fc55da9bc09c310
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}/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}
34 CPPFLAGS+= -D_LIBMINC
36 CFLAGS+= -fno-builtin
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)
52 .for f in \
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/}
56 OBJS+= ${f}
57 CLEANFILES+= ${f}
59 .if ${USE_BITCODE:Uno} == "yes"
60 OBJS+= ${f:C/\.o/.bc/}
61 CLEANFILES+= ${f:C/\.o/.bc/}
62 .endif # ${USE_BITCODE:Uno} == "yes"
63 .endfor
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 ########################################################################
81 # Imports from libsys
83 .for f in \
84 kputc.o sys_diagctl.o
85 ${f} ${f:C/\.o/.bc/}: ${LIBSYSDIR}/${f:C/\.o/.c/}
86 ${f} ${f:C/\.o/.go/}: ${LIBSYSDIR}/${f:C/\.o/.c/}
87 OBJS+= ${f}
88 CLEANFILES+= ${f}
90 .if ${USE_BITCODE:Uno} == "yes"
91 OBJS+= ${f:C/\.o/.bc/}
92 CLEANFILES+= ${f:C/\.o/.bc/}
93 .endif # ${USE_BITCODE:Uno} == "yes"
94 .endfor
96 ########################################################################
98 # Shared libc with userspace (/common/lib/libc)
101 .for f in \
102 bswap64.o rb.o
103 ${f} ${f:C/\.o/.bc/}: ${LIBCOMMONCDIR}/gen/${f:C/\.o/.c/}
104 ${f} ${f:C/\.o/.go/}: ${LIBCOMMONCDIR}/gen/${f:C/\.o/.c/}
105 OBJS+= ${f}
106 CLEANFILES+= ${f}
108 .if ${USE_BITCODE:Uno} == "yes"
109 OBJS+= ${f:C/\.o/.bc/}
110 CLEANFILES+= ${f:C/\.o/.bc/}
111 .endif # ${USE_BITCODE:Uno} == "yes"
112 .endfor
114 CPPFLAGS.rb.c+= -D_LIBC
116 .for f in \
117 sha2.o
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/}
120 OBJS+= ${f}
121 CLEANFILES+= ${f}
123 .if ${USE_BITCODE:Uno} == "yes"
124 OBJS+= ${f:C/\.o/.bc/}
125 CLEANFILES+= ${f:C/\.o/.bc/}
126 .endif # ${USE_BITCODE:Uno} == "yes"
127 .endfor
129 CPPFLAGS.sha2.c+= -I${NETBSDSRCDIR}/sys
131 .for f in \
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/}
138 OBJS+= ${f}
139 CLEANFILES+= ${f}
141 COPTS+= -Wno-missing-prototypes \
142 -Wno-old-style-definition \
143 -Wno-strict-prototypes \
144 -Wno-uninitialized \
145 -Wno-cast-qual
149 .if ${USE_BITCODE:Uno} == "yes"
150 OBJS+= ${f:C/\.o/.bc/}
151 CLEANFILES+= ${f:C/\.o/.bc/}
152 .endif # ${USE_BITCODE:Uno} == "yes"
153 .endfor
155 .for f in \
156 random.o strtoul.o
157 ${f} ${f:C/\.o/.bc/}: ${LIBCOMMONCDIR}/stdlib/${f:C/\.o/.c/}
158 ${f} ${f:C/\.o/.go/}: ${LIBCOMMONCDIR}/stdlib/${f:C/\.o/.c/}
159 OBJS+= ${f}
160 CLEANFILES+= ${f}
162 .if ${USE_BITCODE:Uno} == "yes"
163 OBJS+= ${f:C/\.o/.bc/}
164 CLEANFILES+= ${f:C/\.o/.bc/}
165 .endif # ${USE_BITCODE:Uno} == "yes"
166 .endfor
168 CPPFLAGS.strtoul.c+= -D_STANDALONE
169 CPPFLAGS.strtoul.c+= -I${NETBSDSRCDIR}/sys
171 .for f in \
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/}
175 OBJS+= ${f}
176 CLEANFILES+= ${f}
178 .if ${USE_BITCODE:Uno} == "yes"
179 OBJS+= ${f:C/\.o/.bc/}
180 CLEANFILES+= ${f:C/\.o/.bc/}
181 .endif # ${USE_BITCODE:Uno} == "yes"
182 .endfor
184 ########################################################################
186 # Functions imported directly from libc.
189 .include "${.CURDIR}/arch/${MACHINE_ARCH}/Makefile.libc.inc"
191 # This file is specifically generated
192 SRCS+= errlist.c
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
199 .for f in \
200 _errno.o \
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/}
205 OBJS+= ${f}
206 CLEANFILES+= ${f}
208 .if ${USE_BITCODE:Uno} == "yes"
209 OBJS+= ${f:C/\.o/.bc/}
210 CLEANFILES+= ${f:C/\.o/.bc/}
211 .endif # ${USE_BITCODE:Uno} == "yes"
212 .endfor
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
219 .for f in \
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/}
223 OBJS+= ${f}
224 CLEANFILES+= ${f}
226 .if ${USE_BITCODE:Uno} == "yes"
227 OBJS+= ${f:C/\.o/.bc/}
228 CLEANFILES+= ${f:C/\.o/.bc/}
229 .endif # ${USE_BITCODE:Uno} == "yes"
230 .endfor
232 .for f in \
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/}
236 OBJS+= ${f}
237 CLEANFILES+= ${f}
239 .if ${USE_BITCODE:Uno} == "yes"
240 OBJS+= ${f:C/\.o/.bc/}
241 CLEANFILES+= ${f:C/\.o/.bc/}
242 .endif # ${USE_BITCODE:Uno} == "yes"
243 .endfor
245 CPPFLAGS.stack_protector.c+= -Dxprintf=printf
247 .for f in \
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/}
251 OBJS+= ${f}
252 CLEANFILES+= ${f}
254 .if ${USE_BITCODE:Uno} == "yes"
255 OBJS+= ${f:C/\.o/.bc/}
256 CLEANFILES+= ${f:C/\.o/.bc/}
257 .endif # ${USE_BITCODE:Uno} == "yes"
258 .endfor
260 .for f in \
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/}
266 OBJS+= ${f}
267 CLEANFILES+= ${f}
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
276 .endfor
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
285 .for f in \
286 strdup.o
287 ${f} ${f:C/\.o/.bc/}: ${LIBCDIR}/string/${f:C/\.o/.c/}
288 ${f} ${f:C/\.o/.go/}: ${LIBCDIR}/string/${f:C/\.o/.c/}
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 .for f in \
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/}
308 OBJS+= ${f}
309 CLEANFILES+= ${f}
311 .if ${USE_BITCODE:Uno} == "yes"
312 OBJS+= ${f:C/\.o/.bc/}
313 CLEANFILES+= ${f:C/\.o/.bc/}
314 .endif # ${USE_BITCODE:Uno} == "yes"
315 .endfor
317 .for f in \
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/}
321 OBJS+= ${f}
322 CLEANFILES+= ${f}
324 .if ${USE_BITCODE:Uno} == "yes"
325 OBJS+= ${f:C/\.o/.bc/}
326 CLEANFILES+= ${f:C/\.o/.bc/}
327 .endif # ${USE_BITCODE:Uno} == "yes"
328 .endfor
330 .for f in \
331 localtime.o
332 ${f} ${f:C/\.o/.bc/}: ${LIBCDIR}/time/${f:C/\.o/.c/}
333 ${f} ${f:C/\.o/.go/}: ${LIBCDIR}/time/${f:C/\.o/.c/}
334 OBJS+= ${f}
335 CLEANFILES+= ${f}
337 .if ${USE_BITCODE:Uno} == "yes"
338 OBJS+= ${f:C/\.o/.bc/}
339 CLEANFILES+= ${f:C/\.o/.bc/}
340 .endif # ${USE_BITCODE:Uno} == "yes"
341 .endfor
343 ARCHSUBDIR=${MACHINE_CPU}
344 .include "${NETBSDSRCDIR}/minix/lib/libc/arch/${MACHINE_CPU}/Makefile.inc"
346 .include <bsd.lib.mk>