2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 # Make sure variables in this Makefile do not conflict with other variables (e.g. from gbuild).
11 # The list of source files.
16 postfixincrementfix.
cxx \
18 unusedvariablecheck.
cxx \
21 # You may occassionally want to override some of these
23 # Compile flags ('make CLANGCXXFLAGS=-g' if you need to debug the plugin)
24 CLANGCXXFLAGS
=-O2
-Wall
-g
25 # The prefix where Clang resides, override to where Clang resides if using a source build.
27 # The build directory (different from CLANGDIR if using a Clang out-of-source build)
30 # The uninteresting rest.
32 # Clang headers require these.
33 CLANGDEFS
=-D__STDC_CONSTANT_MACROS
-D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS
-fno-rtti
34 # All include locations needed.
35 CLANGINCLUDES
=-I
$(CLANGDIR
)/include -I
$(CLANGDIR
)/tools
/clang
/include -I
$(CLANGBUILD
)/include -I
$(CLANGBUILD
)/tools
/clang
/include
37 # Clang/LLVM libraries are intentionally not linked in, they are usually built as static libraries, which means the resulting
38 # plugin would be big (even though the clang binary already includes it all) and it'd be necessary to explicitly specify
39 # also all the dependency libraries.
41 CLANGINDIR
=$(SRCDIR
)/compilerplugins
/clang
42 # Cannot use $(WORKDIR), the plugin should survive even 'make clean', otherwise the rebuilt
43 # plugin will cause cache misses with ccache.
44 CLANGOUTDIR
=$(SRCDIR
)/compilerplugins
/obj
46 compilerplugins
: $(CLANGOUTDIR
) $(CLANGOUTDIR
)/plugin.so
48 compilerplugins-clean
:
52 mkdir
-p
$(CLANGOUTDIR
)
57 $(3): $(2) $(SRCDIR
)/compilerplugins
/Makefile-clang.mk
$(CLANGOUTDIR
)/clang-timestamp
58 @echo
[build CXX
] $(subst $(SRCDIR
)/,,$(2))
59 $(CXX
) $(CLANGPLUGIN_CPPFLAGS
) $(CLANGCXXFLAGS
) $(CLANGDEFS
) $(CLANGINCLUDES
) -DSRCDIR
=$(SRCDIR
) $(2) -fPIC
-c
-o
$(3) -MMD
-MT
$(3) -MP
-MF
$(CLANGOUTDIR
)/$(1).d
61 -include $(CLANGOUTDIR
)/$(1).d
63 $(CLANGOUTDIR
)/plugin.so
: $(3)
64 $(CLANGOUTDIR
)/plugin.so
: CLANGOBJS
+= $(3)
67 $(foreach src
, $(CLANGSRC
), $(eval
$(call clangbuildsrc
,$(src
),$(CLANGINDIR
)/$(src
),$(CLANGOUTDIR
)/$(src
:.
cxx=.o
))))
69 $(CLANGOUTDIR
)/plugin.so
: $(CLANGOBJS
)
70 @echo
[build LNK
] $(subst $(SRCDIR
)/,,$@
)
71 $(CXX
) -shared
$(CLANGOBJS
) -o
$@
73 # Clang most probably doesn't maintain binary compatibility, so rebuild when clang changes.
74 $(CLANGOUTDIR
)/clang-timestamp
: $(CLANGBUILD
)/bin
/clang
77 # vim: set noet sw=4 ts=4: