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