Newer
Older
##########################################################################
# #
# This file is part of Frama-Clang #
# #
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# CEA (Commissariat à l'énergie atomique et aux énergies #
# alternatives) #
# #
# you can redistribute it and/or modify it under the terms of the GNU #
# Lesser General Public License as published by the Free Software #
# Foundation, version 2.1. #
# #
# It is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU Lesser General Public License for more details. #
# #
# See the GNU Lesser General Public License version 2.1 #
# for more details (enclosed in the file LICENSE). #
# #
##########################################################################
##===- tools/frama-c/Makefile --------------------------*- Makefile -*-===##
#
##===----------------------------------------------------------------------===##
### Clang specific Makefile. Don't call it directly, use the targets from
### main Makefile
### NB: This directory is supposed to be placed in clang/tools, which itself
### should reside in llvm/tools. LLVM Makefile does not seem robust enough to
### support a completely external compilation.
TOOLNAME = framaCIRGen
PLUGIN_DIR ?= .
Frama_Clang_DIR=$(PLUGIN_DIR)
include $(PLUGIN_DIR)/Makefile.common
.PHONY: default clean install doc
OBJS=\
$(addprefix $(PLUGIN_DIR)/, \
Clang_utils.o intermediate_format.o ACSLComment.o ACSLLogicType.o \
ACSLTermOrPredicate.o ACSLLoopAnnotation.o ACSLStatementAnnotation.o\
ACSLGlobalAnnotation.o ACSLCodeAnnotation.o ACSLFunctionContract.o \
ACSLComponent.o ACSLLexer.o ACSLParser.o \
ACSLToken.o DescentParse.o RTTITable.o VisitTable.o \
ClangVisitor.o FramaCIRGen.o)
DEPS=$(OBJS:.o=.d)
CXXFLAGS?=$(CLANG_CXXFLAGS)
Virgile Prevosto
committed
CXXFLAGS+=-DCLANG_BIN_DIR=\"$(CLANG_BIN_DIR)\" \
# enabling non-null assertions for AST construction would require
# some refactoring in RTTITable.cpp. Still TODO at this point.
CHECK_AST_CONSTRUCTION?=no
ifeq ("$(CHECK_AST_CONSTRUCTION)","no")
$(Frama_Clang_DIR)/intermediate_format.o: CFLAGS+=-DNDEBUG
endif
ifeq ("$(CLANG_DEBUG)","yes")
CXXFLAGS+=-g
CFLAGS+=-g
CLANG_LINKFLAGS+=-g
endif
LLVM_MAJOR:= $(shell echo $(LLVM_VERSION) | sed -e 's/^\([0-9]*\).*/\1/')
LLVM_MAJOR_10:= \
$(shell if test $(LLVM_MAJOR) -ge 10; then echo "yes"; else echo "no"; fi)
# for use in main Makefile
default: $(PLUGIN_DIR)/bin/$(TOOLNAME)
$(PLUGIN_DIR)/bin/$(TOOLNAME): $(OBJS) $(PLUGIN_DIR)/bin
$(PRINT_LINKING) $@
$(CXX) $(CLANG_LINKFLAGS) -o $@ \
$(OBJS) $(addprefix -l,$(CLANG_LIBS)) $(LLVM_LIBS) $(CLANG_SYSLIBS) $(CLANG_LINKFLAGS)
$(PLUGIN_DIR)/bin:
$(MKDIR) $@
clean:
$(PRINT_RM) 'FramaCIRGen'
rm -f $(PLUGIN_DIR)/bin/$(TOOLNAME) *.o *.d
%.o: %.cpp
$(PRINT) 'Compiling '$<
$(CXX) -c $(CXXFLAGS) -I $(CLANG_INCDIR) -I $(PLUGIN_DIR) \
-MD -MF $(@:.o=.d) -o $@ $<
%.o: %.c
$(PRINT) 'Compiling '$<
$(CC) -c $(CFLAGS) -I $(CLANG_INCDIR) -I $(PLUGIN_DIR) -o $@ $<
install:
$(PRINT_INSTALL) $(TOOLNAME) in $(BINDIR)
$(MKDIR) -p $(BINDIR)
cp $(PLUGIN_DIR)/bin/$(TOOLNAME) $(BINDIR)
doc:
$(PRINT_MAKING) "FramaCIRGen documentation"
cd $(PLUGIN_DIR) && doxygen
cd $(PLUGIN_DIR)/doc/latex && make
-include $(DEPS)