]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tools/build/mk/Makefile.boot
dialog: correctly mark the libaries
[FreeBSD/FreeBSD.git] / tools / build / mk / Makefile.boot
1
2 CFLAGS+=        -I${WORLDTMP}/legacy/usr/include
3 DPADD+=         ${WORLDTMP}/legacy/usr/lib/libegacy.a
4 LDADD+=         -legacy
5 LDFLAGS+=       -L${WORLDTMP}/legacy/usr/lib
6
7 .if ${.MAKE.OS} != "FreeBSD"
8 # On MacOS using a non-mac ar will fail the build, similarly on Linux using
9 # nm may not work as expected if the nm for the target architecture comes in
10 # $PATH before a nm that supports the host architecture.
11 # To ensure that host binary compile as expected we use the tools from /usr/bin.
12 AR:=    /usr/bin/ar
13 RANLIB:=        /usr/bin/ranlib
14 NM:=    /usr/bin/nm
15
16 # Avoid stale dependecy warnings:
17 LIBC:=
18 LIBM:=
19 LIBUTIL:=
20 LIBCPLUSPLUS:=
21 LIBARCHIVE:=
22 LIBPTHREAD:=
23 LIBMD:=${WORLDTMP}/legacy/usr/lib/libmd.a
24 LIBNV:=${WORLDTMP}/legacy/usr/lib/libnv.a
25 LIBSBUF:=${WORLDTMP}/legacy/usr/lib/libsbuf.a
26 LIBY:=${WORLDTMP}/legacy/usr/lib/liby.a
27 LIBL:=${WORLDTMP}/legacy/usr/lib/libl.a
28 LIBROKEN:=${WORLDTMP}/legacy/usr/lib/libroken.a
29 LIBDWARF:=${WORLDTMP}/legacy/usr/lib/libdwarf.a
30 LIBELF:=${WORLDTMP}/legacy/usr/lib/libelf.a
31 LIBZ:=${WORLDTMP}/legacy/usr/lib/libz.a
32
33 # Add various -Werror flags to catch missing function declarations
34 CFLAGS+=        -Werror=implicit-function-declaration -Werror=implicit-int \
35                 -Werror=return-type -Wundef
36 CFLAGS+=        -DHAVE_NBTOOL_CONFIG_H=1
37 # This is needed for code that compiles for pre-C11 C standards
38 CWARNFLAGS.clang+=-Wno-typedef-redefinition
39 # bsd.sys.mk explicitly turns on -Wsystem-headers, but that's extremely
40 # noisy when building on Linux.
41 CWARNFLAGS+=    -Wno-system-headers
42 CWARNFLAGS.clang+=-Werror=incompatible-pointer-types-discards-qualifiers
43
44 # b64_pton and b64_ntop is in libresolv on MacOS and Linux:
45 # TODO: only needed for uuencode and uudecode
46 LDADD+=-lresolv
47
48 .if ${.MAKE.OS} == "Linux"
49 CFLAGS+=        -I${SRCTOP}/tools/build/cross-build/include/linux
50 CFLAGS+=        -D_GNU_SOURCE=1
51 # Needed for sem_init, etc. on Linux (used by usr.bin/sort)
52 LDADD+= -pthread
53
54 .elif ${.MAKE.OS} == "Darwin"
55 CFLAGS+=        -D_DARWIN_C_SOURCE=1
56 CFLAGS+=        -I${SRCTOP}/tools/build/cross-build/include/mac
57 # The macOS ar and ranlib don't understand all the flags supported by the
58 # FreeBSD and Linux ar/ranlib
59 ARFLAGS:=       -crs
60 RANLIBFLAGS:=
61
62 # to get libarchive (needed for elftoolchain)
63 # MacOS ships /usr/lib/libarchive.dylib but doesn't provide the headers
64 CFLAGS+=        -idirafter ${SRCTOP}/contrib/libarchive/libarchive
65 .else
66 .error Unsupported build OS: ${.MAKE.OS}
67 .endif
68 .endif # ${.MAKE.OS} != "FreeBSD"
69
70 .if ${.MAKE.OS} != "FreeBSD"
71 # Add the common compatibility headers after the OS-specific ones.
72 CFLAGS+=        -I${SRCTOP}/tools/build/cross-build/include/common
73 .endif
74
75 # we do not want to capture dependencies referring to the above
76 UPDATE_DEPENDFILE= no
77
78 # When building host tools we should never pull in headers from the source sys
79 # directory to avoid any ABI issues that might cause the built binary to crash.
80 # The only exceptions to this are sys/cddl/compat for dtrace bootstrap tools and
81 # sys/crypto for libmd bootstrap.
82 # We have to skip this check during make obj since bsd.crunchgen.mk will run
83 # make obj on every directory during the build-tools phase.
84 .if !make(obj)
85 .if !empty(CFLAGS:M*${SRCTOP}/sys)
86 .error Do not include $${SRCTOP}/sys when building bootstrap tools. \
87     Copy the header to $${WORLDTMP}/legacy in tools/build/Makefile instead. \
88     Error was caused by Makefile in ${.CURDIR}
89 .endif
90
91 # ${SRCTOP}/include should also never be used to avoid ABI issues
92 .if !empty(CFLAGS:M*${SRCTOP}/include*)
93 .error Do not include $${SRCTOP}/include when building bootstrap tools. \
94     Copy the header to $${WORLDTMP}/legacy in tools/build/Makefile instead. \
95     Error was caused by Makefile in ${.CURDIR}
96 .endif
97 .endif
98
99 # GCC doesn't allow silencing warn_unused_result calls with (void) casts.
100 CFLAGS.gcc+=-Wno-unused-result