Makefile 5.12 KB
Newer Older
1
2
3
4
##########################################################################
#                                                                        #
#  This file is part of Frama-Clang                                      #
#                                                                        #
Virgile Prevosto's avatar
Virgile Prevosto committed
5
#  Copyright (C) 2012-2020                                               #
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#    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).                      #
#                                                                        #
##########################################################################

### Main Makefile. As Makefiles included from clang and Frama-C are incompatible
### we have two auxiliary Makefiles, one for each side of the front-end.
### We define here general targets that will operate on both sides.

Virgile Prevosto's avatar
Virgile Prevosto committed
27
FCLANG_VERSION=0.0.10
28
29
30
31
32
33
34
35
36
37
38
39
40
41

PLUGIN_DIR ?= .

include $(PLUGIN_DIR)/Makefile.common

PLUGIN_NAME:=Frama_Clang
PLUGIN_ENABLED:=yes
PLUGIN_CMI:=intermediate_format
PLUGIN_CMO:=intermediate_format_parser frama_Clang_option		\
	    fclang_datatype reorder_defs cxx_utils mangling		\
	    convert_env convert_acsl generate_spec class convert	\
	    convert_link frama_Clang_register
ifneq ("$(MAKECMDGOALS)","uninstall")
PLUGIN_GENERATED:= \
42
 $(addprefix $(PLUGIN_DIR)/, \
43
44
45
46
47
  intermediate_format_parser.ml \
  intermediate_format.mli intermediate_format_parser.mli)
else
PLUGIN_GENERATED:=
endif
48
PLUGIN_DEPENDENCIES:= wp
49
50
51
52
53
54
55
56
57
ifeq ("$(RUN_TESTS)","yes")
PLUGIN_TESTS_DIRS:=basic stl class val_analysis template specs exn pp ppwp bugs da
else
PLUGIN_NO_TESTS:=yes
endif
PLUGIN_DISTRIBUTED:=no
PLUGIN_DISTRIB_EXTERNAL:=configure.ac configure Makefile Makefile.clang \
Makefile.common Makefile.config.in gen_ast.ml *.cpp *.h \
intermediate_format.ast DescentParse.template frama_Clang_config.ml.in \
Virgile Prevosto's avatar
Virgile Prevosto committed
58
Doxyfile mainpage.dox README.md \
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
$(addprefix share/libc++/,$(CXX_HEADERS))
include $(FRAMAC_SHARE)/Makefile.dynamic

$(Frama_Clang_DIR)/tests/ptests_config: $(Frama_Clang_DIR)/Makefile.config

install::
	$(MKDIR) $(FRAMAC_DATADIR)/frama-clang/libc++
	$(CP) $(addprefix $(Frama_Clang_DIR)/share/libc++/, \
                $(CXX_HEADERS)) \
              $(FRAMAC_DATADIR)/frama-clang/libc++

working-tests: $(Frama_Clang_DIR)/ptests_local_config.cmxs
	@echo "FRAMAC_SHARE=$(FRAMAC_SHARE)"
	LINES=$$(sed -e '/^Tests OK:$$/b out' -e d -e ':out' -e '=' -e 'd' \
                  $(Frama_Clang_DIR)/tests_list.txt); \
         TESTS=$$(tail -n +$$((LINES+1)) \
                       $(Frama_Clang_DIR)/tests_list.txt | tr '\n' ' '); \
         cd $(Frama_Clang_DIR) && $(PTESTS) $(PTESTS_OPTS) $$TESTS
	make -C $(Frama_Clang_DIR) 

tests:: dontrun

dontrun:
	(cd tests; echo `grep -r 'DONTRUN' $(PLUGIN_TESTS_DIRS) | wc -l` test files marked DONTRUN )

84
$(Frama_Clang_DIR)/gen_ast: $(Frama_Clang_DIR)/gen_ast.ml
85
	$(PRINT_OCAMLC) $@
Virgile Prevosto's avatar
Virgile Prevosto committed
86
	$(OCAMLC) $(Frama_Clang_BFLAGS) -o $@ -pp $(CAMLP5O) \
87
        zarith.cma dynlink.cma $^
88
89
90
91
92

$(Frama_Clang_DIR)/test_ast: \
  $(Frama_Clang_DIR)/intermediate_format.cmo \
  $(Frama_Clang_DIR)/intermediate_format.o

93
94
95
$(Frama_Clang_DIR)/%_parser.ml $(Frama_Clang_DIR)/%_parser.mli \
$(Frama_Clang_DIR)/%.mli $(Frama_Clang_DIR)/%.c: \
   $(Frama_Clang_DIR)/%.ast $(Frama_Clang_DIR)/gen_ast
96
97
98
	$(PRINT_MAKING) "intermediate AST"
	$(Frama_Clang_DIR)/gen_ast $<

99
# Get verbose output by appending: SHELL='sh -x'
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
CLANG_MAKE:=$(MAKE) PLUGIN_DIR=$(Frama_Clang_DIR) FRAMAC_SHARE=$(FRAMAC_SHARE) \
            -f $(Frama_Clang_DIR)/Makefile.clang

clean::
	$(RM) gen_ast
	$(CLANG_MAKE) clean

all::
	$(CLANG_MAKE) default

install::
	@echo "BINDIR is $(BINDIR)"
	$(CLANG_MAKE) install

doc::
	$(CLANG_MAKE) doc

distrib: clean
	$(PRINT_MAKING) $@
	$(RM) -r frama-clang
	$(MKDIR) frama-clang-$(FCLANG_VERSION)
	$(MKDIR) frama-clang-$(FCLANG_VERSION)/bin
	$(TAR) cf tmp.tar $(FCLANG_DISTRIBUTED_FILES)
	cd frama-clang-$(FCLANG_VERSION) && $(TAR) xf ../tmp.tar
	$(TAR) czf frama-clang-$(FCLANG_VERSION).tar.gz frama-clang-$(FCLANG_VERSION)
	$(RM) -r frama-clang-$(FCLANG_VERSION)

Virgile Prevosto's avatar
Virgile Prevosto committed
127
NOHEADER=$(addprefix $(Frama_Clang_DIR)/, configure README.md)
128
129
130
131
132
133

headers::
	$(PRINT_MAKING) $@
	headache -c $(Frama_Clang_DIR)/.headache_config.txt \
                 -h $(Frama_Clang_DIR)/.LICENSE \
                 $(filter-out $(NOHEADER), $(FCLANG_DISTRIBUTED_FILES))