Remove building with NOCRYPTO option
[minix.git] / share / mk / minix.service.mk
blobdaf7f15247ca16b8596161b580897b6ba0366a20
1 # MINIX-specific servers/drivers options
2 .include <bsd.own.mk>
4 # LSC: Our minimal c library has no putchar, which is called by the builtin
5 # functions of the compiler, so prevent using them.
7 AFLAGS+= -D__ASSEMBLY__
8 COPTS+= -fno-builtin
10 # For MKCOVERAGE builds, enable coverage options.
11 .if ${MKCOVERAGE:Uno} == "yes"
12 CPPFLAGS+= ${COVCPPFLAGS}
13 LDADD+= ${COVLDADD}
14 .endif # ${MKCOVERAGE:Uno} == "yes"
16 # LSC Static linking, order matters!
17 # We can't use --start-group/--end-group as they are not supported by our
18 # version of clang.
20 # 1. No default libs
21 LDADD:= -nodefaultlibs ${LDADD}
23 # 2. Services system library
24 LDADD+= -lsys
25 DPADD+= ${LIBSYS}
27 # 3. Minimal C library, if libc had not yet been added
28 .if ${LDADD:M-lc} == ""
29 LDADD+= -lminc
30 DPADD+= ${LIBMINC}
31 .endif # empty(${LDADD:M-lc})
33 .if ${MACHINE_ARCH} == "earm"
35 # LSC: On ARM, when compiling statically, with gcc, lgcc_eh is required
36 .if ${PROG:U} != "kernel" && !empty(CC:M*gcc)
37 # gcc_eh uses abort(), which is provided by minc
38 LDFLAGS+= ${${ACTIVE_CC} == "gcc":? -lgcc_eh:}
39 .endif # ${PROG:U} != "kernel" && !empty(CC:M*gcc)
41 .endif # ${MACHINE_ARCH} == "earm"
43 # Get (more) internal minix definitions and declarations.
44 CPPFLAGS += -D_MINIX_SYSTEM=1
46 # For MKMAGIC builds, link services against libmagicrt and run the magic pass
47 # on them, unless they have specifically requested to be built without bitcode.
48 .if ${USE_BITCODE:Uno} == "yes" && ${USE_MAGIC:Uno} == "yes"
49 LIBMAGICST?= ${DESTDIR}${LIBDIR}/libmagicrt.bcc
50 MAGICPASS?= ${NETBSDSRCDIR}/minix/llvm/bin/magic.so
52 DPADD+= ${LIBMAGICST} ${MAGICPASS}
54 .for _P in ${PROGS:U${PROG}}
55 BITCODE_LD_FLAGS_1ST.${_P}?= ${LIBMAGICST}
56 .endfor
58 MAGICFLAGS?=
59 OPTFLAGS+= -load ${MAGICPASS} -magic ${MAGICFLAGS}
61 # For MKASR builds, generate an additional set of rerandomized service
62 # binaries.
63 .if ${USE_ASR:Uno} == "yes"
64 ASRPASS?= ${NETBSDSRCDIR}/minix/llvm/bin/asr.so
65 ASRCOUNT?= 3
66 ASRDIR?= /usr/service/asr
68 DPADD+= ${ASRPASS}
70 OPTFLAGS+= -load ${ASRPASS} -asr
72 # Produce a variable _RANGE that contains "1 2 3 .. ${ASRCOUNT}". We do not
73 # want to invoke a shell command to do this; what if the host platform does not
74 # have seq(1) ? So, we do it with built-in BSD make features instead. There
75 # are probably substantially better ways to do this, though. Right now the
76 # maximum ASRCOUNT is 65536 (16**4), which should be plenty. An ASRCOUNT of 0
77 # is not supported, nor would it be very useful.
78 _RANGE= 0
79 _G0= xxxxxxxxxxxxxxxx
80 _G= ${_G0:S/x/${_G0}/g:S/x/${_G0}/g:S/x/${_G0}/g}
81 .for _X in ${_G:C/^(.{${ASRCOUNT}}).*/\1/:S/x/x /g}
82 _RANGE:= ${_RANGE} ${_RANGE:[#]}
83 .endfor
84 _RANGE:= ${_RANGE:[2..-1]}
86 # Add progname-1, progname-2, progname-3 (etc) to the list of programs to
87 # generate, and install (just) these to ASRDIR.
88 PROGS?= ${PROG}
89 _PROGLIST:= ${PROGS}
90 .for _N in ${_RANGE}
91 .for _P in ${_PROGLIST}
92 PROGS+= ${_P}-${_N}
93 SRCS.${_P}-${_N}= ${SRCS.${_P}:U${SRCS}}
94 BITCODE_LD_FLAGS_1ST.${_P}-${_N}:= ${BITCODE_LD_FLAGS_1ST.${_P}}
95 BINDIR.${_P}-${_N}= ${ASRDIR}
96 .endfor
97 .endfor
99 .endif # ${USE_ASR:Uno} == "yes"
100 .endif # ${USE_BITCODE:Uno} == "yes" && ${USE_MAGIC:Uno} == "yes"
102 .include <bsd.prog.mk>