diff --git a/Makefile.inc1 b/Makefile.inc1 index 24af34e701a9..805a42befb48 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -676,7 +676,7 @@ BSARGS= DESTDIR= \ MK_HTML=no NO_LINT=yes MK_MAN=no \ -DNO_PIC MK_PROFILE=no -DNO_SHARED \ -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ - MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \ + MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \ MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no \ MK_INCLUDES=yes @@ -697,7 +697,7 @@ TMAKE= \ SSP_CFLAGS= \ -DNO_LINT \ -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ - MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \ + MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \ MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no # cross-tools stage @@ -2577,6 +2577,7 @@ NXBMAKEARGS+= \ SSP_CFLAGS= \ MK_CASPER=no \ MK_CLANG_EXTRAS=no \ + MK_CLANG_FORMAT=no \ MK_CLANG_FULL=no \ MK_CTF=no \ MK_DEBUG_FILES=no \ diff --git a/lib/clang/libclang/Makefile b/lib/clang/libclang/Makefile index 698e2eaa7e76..8eb526e93b5b 100644 --- a/lib/clang/libclang/Makefile +++ b/lib/clang/libclang/Makefile @@ -22,7 +22,7 @@ SRCDIR= clang/lib # Explanation of different SRCS variants below: # SRCS_MIN: always required, even for bootstrap -# SRCS_EXT: required for MK_CLANG_EXTRAS +# SRCS_EXT: required for MK_CLANG_EXTRAS || MK_CLANG_FORMAT # SRCS_FUL: required for MK_CLANG_FULL # SRCS_LDB: required for MK_LLDB @@ -686,7 +686,7 @@ SRCS_MIN+= Tooling/RefactoringCallbacks.cpp SRCS_MIN+= Tooling/Tooling.cpp SRCS_ALL+= ${SRCS_MIN} -.if ${MK_CLANG_EXTRAS} != "no" +.if ${MK_CLANG_EXTRAS} != "no" || ${MK_CLANG_FORMAT} != "no" SRCS_ALL+= ${SRCS_EXT} .endif .if ${MK_CLANG_FULL} != "no" diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 9f315af22ba8..1ef9d7b09286 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -202,6 +202,7 @@ __DEFAULT_NO_OPTIONS = \ BHYVE_SNAPSHOT \ BSD_GREP \ CLANG_EXTRAS \ + CLANG_FORMAT \ DTRACE_TESTS \ EXPERIMENTAL \ GNU_GREP_COMPAT \ @@ -482,6 +483,7 @@ MK_LLDB:= no .if ${MK_CLANG} == "no" MK_CLANG_EXTRAS:= no +MK_CLANG_FORMAT:= no MK_CLANG_FULL:= no MK_LLVM_COV:= no .endif diff --git a/targets/pseudo/bootstrap-tools/Makefile b/targets/pseudo/bootstrap-tools/Makefile index 08ed40273c17..88b89a5c9d10 100644 --- a/targets/pseudo/bootstrap-tools/Makefile +++ b/targets/pseudo/bootstrap-tools/Makefile @@ -43,7 +43,7 @@ BSARGS= DESTDIR= \ MK_HTML=no NO_LINT=yes MK_MAN=no \ -DNO_PIC MK_PROFILE=no -DNO_SHARED \ -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ - MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \ + MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \ MK_LLDB=no MK_TESTS=no \ MK_INCLUDES=yes diff --git a/targets/pseudo/clang/Makefile.depend b/targets/pseudo/clang/Makefile.depend index 4d7b21cf64aa..29ac41e06ef2 100644 --- a/targets/pseudo/clang/Makefile.depend +++ b/targets/pseudo/clang/Makefile.depend @@ -42,7 +42,6 @@ DIRDEPS+= \ .if ${MK_CLANG_EXTRAS} == "yes" DIRDEPS+= \ usr.bin/clang/bugpoint \ - usr.bin/clang/clang-format \ usr.bin/clang/llc \ usr.bin/clang/lli \ usr.bin/clang/llvm-ar \ @@ -71,6 +70,10 @@ DIRDEPS+= \ .endif +.if ${MK_CLANG_EXTRAS} == "yes" || ${MK_CLANG_FORMAT} == "yes" +DIRDEPS+= usr.bin/clang/clang-format +.endif + .if ${MK_LLD} == "yes" DIRDEPS+= usr.bin/clang/lld .endif diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index 0cfa34714133..f2633da40351 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -1481,7 +1481,6 @@ OLD_FILES+=usr/share/man/man1/llvm-tblgen.1.gz .if ${MK_CLANG_EXTRAS} == no OLD_FILES+=usr/bin/bugpoint -OLD_FILES+=usr/bin/clang-format OLD_FILES+=usr/bin/llc OLD_FILES+=usr/bin/lli OLD_FILES+=usr/bin/llvm-as @@ -1517,6 +1516,10 @@ OLD_FILES+=usr/share/man/man1/llvm-pdbutil.1.gz OLD_FILES+=usr/share/man/man1/opt.1.gz .endif +.if ${MK_CLANG_EXTRAS} == no && ${MK_CLANG_FORMAT} == no +OLD_FILES+=usr/bin/clang-format +.endif + .if ${MK_CPP} == no OLD_FILES+=usr/bin/cpp OLD_FILES+=usr/share/man/man1/cpp.1.gz diff --git a/tools/build/options/WITH_CLANG_FORMAT b/tools/build/options/WITH_CLANG_FORMAT new file mode 100644 index 000000000000..0483ffca7094 --- /dev/null +++ b/tools/build/options/WITH_CLANG_FORMAT @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to build clang-format. diff --git a/usr.bin/clang/Makefile b/usr.bin/clang/Makefile index b0a46157685f..5ac0607338e3 100644 --- a/usr.bin/clang/Makefile +++ b/usr.bin/clang/Makefile @@ -18,7 +18,6 @@ SUBDIR+= llvm-symbolizer .if ${MK_CLANG_EXTRAS} != "no" SUBDIR+= bugpoint -SUBDIR+= clang-format SUBDIR+= llc SUBDIR+= lli SUBDIR+= llvm-as @@ -42,6 +41,10 @@ SUBDIR+= llvm-xray SUBDIR+= opt .endif +.if ${MK_CLANG_EXTRAS} != "no" || ${MK_CLANG_FORMAT} != "no" +SUBDIR+= clang-format +.endif + .if ${MK_LLD} != "no" SUBDIR+= lld .endif