xref: /minix/share/mk/minix.service.mk (revision 4684ddb6)
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.include <bsd.prog.mk>
41