Makefile 87.4 KB
Newer Older
1
2
3
4
##########################################################################
#                                                                        #
#  This file is part of Frama-C.                                         #
#                                                                        #
Andre Maroneze's avatar
Andre Maroneze committed
5
#  Copyright (C) 2007-2020                                               #
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
#    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 licenses/LGPLv2.1).            #
#                                                                        #
##########################################################################

# This file is the main makefile of Frama-C.

FRAMAC_SRC=.
MAKECONFIG_DIR=share
PLUGIN_TESTS_LIST:=
include share/Makefile.common
include share/Makefile.dynamic_config.internal

#Check share/Makefile.config available
ifndef FRAMAC_ROOT_SRCDIR
33
34
$(error \
  "You should run ./configure first (or autoconf if there is no configure)")
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
endif

###################
# Frama-C Version #
###################

VERSION:=$(shell $(CAT) VERSION)
VERSION_CODENAME:=$(shell $(CAT) VERSION_CODENAME)

###########################
# Global plugin variables #
###########################

# the directory where compiled plugin non-GUI files are stored
PLUGIN_TOP_LIB_DIR= $(PLUGIN_LIB_DIR)/top

# the directory where compiled plugin GUI files are stored
PLUGIN_GUI_LIB_DIR= $(PLUGIN_LIB_DIR)/gui

# the directory where the other Makefiles are
FRAMAC_SHARE	= share

# Shared lists between Makefile.plugin and Makefile :
# initialized them as "simply extended variables" (with :=)
# for a correct behavior of += (see section 6.6 of GNU Make manual)
PLUGIN_LIST	:=
PLUGIN_GENERATED_LIST:=
PLUGIN_CMO_LIST	:=
PLUGIN_CMX_LIST	:=
PLUGIN_META_LIST :=
PLUGIN_DYN_CMI_LIST :=
PLUGIN_DYN_CMO_LIST :=
PLUGIN_DYN_CMX_LIST :=
PLUGIN_INTERNAL_CMO_LIST:=
PLUGIN_INTERNAL_CMX_LIST:=
PLUGIN_GUI_CMO_LIST:=
PLUGIN_GUI_CMX_LIST:=
PLUGIN_DYN_DEP_GUI_CMO_LIST:=
PLUGIN_DYN_DEP_GUI_CMX_LIST:=
PLUGIN_DYN_GUI_CMO_LIST :=
PLUGIN_DYN_GUI_CMX_LIST :=
PLUGIN_TYPES_CMO_LIST :=
PLUGIN_TYPES_CMX_LIST :=
PLUGIN_DEP_LIST:=
PLUGIN_DOC_LIST :=
PLUGIN_DOC_DIRS :=
PLUGIN_DISTRIBUTED_LIST:=
PLUGIN_DIST_TARGET_LIST:=
PLUGIN_DIST_DOC_LIST:=
PLUGIN_BIN_DOC_LIST:=
PLUGIN_DIST_EXTERNAL_LIST:=
PLUGIN_DIST_TESTS_LIST:=
PLUGIN_DISTRIBUTED_NAME_LIST:=
MERLIN_PACKAGES:=

PLUGIN_HEADER_SPEC_LIST :=
PLUGIN_HEADER_DIRS_LIST :=
PLUGIN_HEADER_EXCEPTIONS_LIST :=
PLUGIN_CEA_PROPRIETARY_HEADERS_LIST :=
PLUGIN_CEA_PROPRIETARY_FILES_LIST :=

# default value used for HEADER_SPEC and PLUGIN_HEADER_SPEC
DEFAULT_HEADER_SPEC := headers/header_spec.txt
# default value used for HEADER_DIRS and PLUGIN_HEADER_DIRS
DEFAULT_HEADER_DIRS := headers
# default value used for HEADER_EXCEPTIONS and PLUGIN_HEADER_EXCEPTIONS
DEFAULT_HEADER_EXCEPTIONS := configure
# default value used for CEA_PROPRIETARY_FILES and PLUGIN_CEA_PROPRIETARY_FILES
DEFAULT_CEA_PROPRIETARY_FILES := tests/non-free/%
104
105
# default value used for CEA_PROPRIETARY_HEADERS
# and PLUGIN_CEA_PROPRIETARY_HEADERS
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
DEFAULT_CEA_PROPRIETARY_HEADERS := CEA_PROPRIETARY

MERLIN_PACKAGES:=

###############################
# Additional global variables #
###############################

# Directories containing some source code
SRC_DIRS= ptests $(PLUGIN_LIB_DIR) $(FRAMAC_SRC_DIRS)

# Directory containing source code documentation
DOC_DIR	= doc/code

# Source files to document
MODULES_TODOC=

# Directories to include when compiling
INCLUDES=$(addprefix -I ,$(FRAMAC_SRC_DIRS)) -I $(PLUGIN_LIB_DIR)
ifneq ($(ENABLE_GUI),no)
GUI_INCLUDES = $(addprefix -package ,$(LIBRARY_NAMES_GUI))
else
GUI_INCLUDES =
endif

# Files for which dependencies must be computed.
# Other files are added later in this Makefile.
FILES_FOR_OCAMLDEP+=$(PLUGIN_LIB_DIR)/*.mli

BFLAGS	= $(PACKAGES) $(FLAGS) $(DEBUG) $(INCLUDES) \
		$(FRAMAC_USER_BFLAGS)
OFLAGS	= $(PACKAGES) $(FLAGS) $(DEBUG) $(INCLUDES) -compact \
		$(FRAMAC_USER_OFLAGS)

BLINKFLAGS += -linkpkg $(BFLAGS) -linkall -custom
OLINKFLAGS += -linkpkg $(OFLAGS) -linkall

143
DOC_FLAGS= -charset utf8 -colorize-code -stars -m A $(PACKAGES) $(INCLUDES) $(GUI_INCLUDES)
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193

ifneq ($(VERBOSEMAKE),yes)
DOC_FLAGS+= -hide-warnings
endif

# Files that depend on external libraries -namely Zarith- whose interface
# has not been explicitely declared -opaque, hence would trigger warning 58.
# This can't be solved by Frama-C itself, we can only wait for an update of
# said library.

NON_OPAQUE_DEPS:=

# Libraries generated by Frama-C
GEN_BYTE_LIBS=
GEN_OPT_LIBS=

# Libraries used in Frama-C
EXTRA_OPT_LIBS:=
PACKAGES = $(addprefix -package ,$(LIBRARY_NAMES))
BYTE_LIBS = $(GEN_BYTE_LIBS)
OPT_LIBS = $(EXTRA_OPT_LIBS)

OPT_LIBS+= $(GEN_OPT_LIBS)

ICONS:= $(addprefix share/,\
		frama-c.ico frama-c.png unmark.png \
		switch-on.png switch-off.png)

THEME_ICON_NAMES:= \
		never_tried.png \
		unknown.png \
		surely_valid.png \
		surely_invalid.png \
		considered_valid.png \
		valid_under_hyp.png \
		invalid_under_hyp.png \
		invalid_but_dead.png \
		unknown_but_dead.png \
		valid_but_dead.png \
		inconsistent.png \
		fold.png unfold.png

THEME_ICONS_DEFAULT:= \
  $(addprefix share/theme/default/,$(THEME_ICON_NAMES))
THEME_ICONS_COLORBLIND:= \
  $(addprefix share/theme/colorblind/,$(THEME_ICON_NAMES))
THEME_ICONS_FLAT:= \
  $(addprefix share/theme/flat/,$(THEME_ICON_NAMES))

ROOT_LIBC_DIR:= share/libc
Andre Maroneze's avatar
Andre Maroneze committed
194
LIBC_SUBDIRS:= sys netinet net arpa
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
LIBC_DIR:= $(ROOT_LIBC_DIR) $(addprefix $(ROOT_LIBC_DIR)/,$(LIBC_SUBDIRS))
LIBC_FILES:= \
	$(wildcard share/*.h share/*.c) \
	$(wildcard $(addsuffix /*.h,$(LIBC_DIR))) \
	$(wildcard $(addsuffix /*.c,$(LIBC_DIR)))

# Checks that all .h can be included multiple times.
ALL_LIBC_HEADERS:=$(wildcard share/*.h $(addsuffix /*.h,$(LIBC_DIR)))

check-libc: bin/toplevel.$(OCAMLBEST)$(EXE)
	@echo "checking libc..."; \
	 EXIT_VALUE=0; \
	 for file in $(filter-out share/builtin.h,$(ALL_LIBC_HEADERS)); do \
	   echo "#include \"$$file\"" > check-libc.c; \
	   echo "#include \"$$file\"" >> check-libc.c; \
	   FRAMAC_SHARE=share bin/toplevel.$(OCAMLBEST)$(EXE) \
	   -cpp-extra-args="-Ishare/libc -nostdinc" check-libc.c \
	       > $$(basename $$file .h).log 2>&1; \
	   if test $$? -ne 0; then \
	     if grep -q -e '#error "Frama-C:' $$file; then : ; \
	     else \
	       echo "$$file cannot be included twice. \
Output is in $$(basename $$file .h).log"; \
	       EXIT_VALUE=1; \
	     fi; \
	   else \
	     rm $$(basename $$file .h).log; \
	   fi; \
	 done; \
	 rm check-libc.c; \
	 exit $$EXIT_VALUE

clean-check-libc:
	$(RM) *.log

# Kernel files to be included in the distribution.
# Plug-ins should use PLUGIN_DISTRIB_EXTERNAL if they export something else
# than *.ml* files in their directory.
# NB: configure for the distribution is generated in the distrib directory
# itself, rather than copied: otherwise, it could include references to
# non-distributed plug-ins.
DISTRIB_FILES:=\
237
      $(wildcard bin/migration_scripts/*2*.sh) bin/local_export.sh      \
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
      bin/frama-c bin/frama-c.byte bin/frama-c-gui bin/frama-c-gui.byte \
      bin/frama-c-config bin/frama-c-script                             \
      share/frama-c.WIN32.rc share/frama-c.Unix.rc                      \
      $(ICONS) $(THEME_ICONS_DEFAULT) $(THEME_ICONS_COLORBLIND)         \
      $(THEME_ICONS_FLAT)                                               \
      man/frama-c.1 doc/README						\
      doc/code/docgen.ml                                                \
      doc/code/*.css doc/code/intro_plugin.txt				\
      doc/code/intro_plugin_D_and_S.txt                                 \
      doc/code/intro_plugin_default.txt                                 \
      doc/code/intro_kernel_plugin.txt					\
      doc/code/toc_head.htm                                             \
      doc/code/toc_tail.htm                                             \
      doc/Makefile                                                      \
      $(filter-out ptests/ptests_config.ml,$(wildcard ptests/*.ml*))   \
      configure.in Makefile Makefile.generating				\
      Changelog config.h.in						\
      VERSION VERSION_CODENAME $(wildcard licenses/*)                   \
      $(LIBC_FILES)							\
257
      share/analysis-scripts/analysis.mk                                \
258
      share/analysis-scripts/benchmark_database.py                      \
259
      share/analysis-scripts/cmd-dep.sh                                 \
260
      share/analysis-scripts/concat-csv.sh                              \
261
      share/analysis-scripts/clone.sh                                   \
262
      share/analysis-scripts/creduce.sh                                 \
263
      share/analysis-scripts/epilogue.mk                                \
264
      share/analysis-scripts/fc_stubs.c                                 \
265
      share/analysis-scripts/find_fun.py                                \
266
      share/analysis-scripts/flamegraph.pl                              \
267
      share/analysis-scripts/frama_c_results.py                         \
268
      share/analysis-scripts/function_finder.py                         \
269
      share/analysis-scripts/git_utils.py                               \
270
      share/analysis-scripts/list_files.py                              \
271
      share/analysis-scripts/make_template.py                           \
272
      share/analysis-scripts/make_wrapper.py                            \
273
      share/analysis-scripts/normalize_jcdb.py                          \
274
      share/analysis-scripts/parse-coverage.sh                          \
275
      share/analysis-scripts/prologue.mk                                \
276
      share/analysis-scripts/README.md                                  \
277
278
      share/analysis-scripts/results_display.py                         \
      share/analysis-scripts/summary.py                                 \
279
280
281
      share/analysis-scripts/template.mk                                \
      $(wildcard share/emacs/*.el) share/autocomplete_frama-c           \
      share/_frama-c                                                    \
282
283
284
285
      share/compliance/c11_functions.json                               \
      share/compliance/glibc_functions.json                             \
      share/compliance/nonstandard_identifiers.json                     \
      share/compliance/posix_identifiers.json                           \
286
287
288
289
290
291
      share/configure.ac                                                \
      share/Makefile.config.in share/Makefile.common                    \
      share/Makefile.generic						\
      share/Makefile.plugin.template share/Makefile.dynamic		\
      share/Makefile.dynamic_config.external				\
      share/Makefile.dynamic_config.internal				\
292
      share/META.frama-c                                                \
293
      $(filter-out src/kernel_internals/runtime/fc_config.ml,              \
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
	  $(wildcard src/kernel_internals/runtime/*.ml*))               \
      $(wildcard src/kernel_services/abstract_interp/*.ml*)             \
      $(wildcard src/plugins/gui/*.ml*)                                 \
      $(wildcard src/libraries/stdlib/*.ml*)                            \
      $(wildcard src/libraries/utils/*.ml*)                             \
      $(wildcard src/libraries/utils/*.c)                               \
      $(wildcard src/libraries/project/*.ml*)                           \
      $(filter-out src/kernel_internals/parsing/check_logic_parser.ml,  \
          $(wildcard src/kernel_internals/parsing/*.ml*))               \
      $(wildcard src/kernel_internals/typing/*.ml*)                     \
      $(wildcard src/kernel_services/ast_data/*.ml*)                    \
      $(wildcard src/kernel_services/ast_queries/*.ml*)                 \
      $(wildcard src/kernel_services/ast_printing/*.ml*)                \
      $(wildcard src/kernel_services/cmdline_parameters/*.ml*)          \
      $(wildcard src/kernel_services/analysis/*.ml*)                    \
      $(wildcard src/kernel_services/ast_transformations/*.ml*)         \
      $(wildcard src/kernel_services/plugin_entry_points/*.ml*)         \
      $(wildcard src/kernel_services/visitors/*.ml*)                    \
      $(wildcard src/kernel_services/parsetree/*.ml*)                   \
      $(wildcard src/libraries/datatype/*.ml*)                          \
      bin/sed_get_make_major bin/sed_get_make_minor                     \
      INSTALL.md README.md .make-clean	                        \
      .make-clean-stamp .force-reconfigure 	\
317
      opam/opam \
318
319
320

# Test files to be included in the distribution (without header checking).
# Plug-ins should use PLUGIN_DISTRIB_TESTS to export their test files. 
321
322
323
324
DISTRIB_TESTS=$(shell git ls-files \
                  tests \
                  src/plugins/aorai/tests \
                  src/plugins/report/tests \
325
                  src/plugins/wp/tests | $(SED) 's/ /@/g')
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367


# files that are needed to compile API documentation of external plugins
DOC_GEN_FILES:=$(addprefix doc/code/,\
	*.css intro_plugin.txt intro_kernel_plugin.txt \
	intro_plugin_default.txt intro_plugin_D_and_S \
	kernel-doc.ocamldoc \
	docgen.ml docgen.cm* *.htm)

################
# Main targets #
################

# additional compilation targets for 'make all'.
# cannot be delayed after 'make all'
EXTRAS	= ptests bin/fc-config$(EXE)

ifneq ($(ENABLE_GUI),no)
ifeq ($(HAS_LABLGTK),yes)
EXTRAS	+= gui
endif
endif

all:: byte $(OCAMLBEST) $(EXTRAS) plugins_ptests_config

.PHONY: top opt byte dist bdist rebuild rebuild-branch

dist: clean
	$(QUIET_MAKE) all

clean-rebuild: clean
	$(QUIET_MAKE) all

rebuild: config.status
	$(MAKE) smartclean
	$(MAKE) depend $(FRAMAC_PARALLEL)
	$(MAKE) all $(FRAMAC_PARALLEL) || \
		(touch .force-reconfigure; \
		 $(MAKE) config.status && \
		 $(MAKE) depend $(FRAMAC_PARALLEL) && \
		 $(MAKE) all $(FRAMAC_PARALLEL))

368
369
sinclude .Makefile.user
# Should define FRAMAC_PARALLEL, FRAMAC_USER_FLAGS, FRAMAC_USER_MERLIN_FLAGS
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401

#Create link in share for local execution if
.PHONY:create_share_link
create_share_link: share/.gitignore

# note: when using opam pin path in a cloned Frama-C git, the symbolic links
# become directories, so a different command is necessary for each situation

share/.gitignore: share/Makefile.config
	if test -f $@; then \
	  for link in $$(cat $@); do \
	    if test -L share$$link; then \
	      rm -f share$$link \
	    else \
	      rm -rf share$$link; \
	    fi; \
	  done; \
	fi
	$(RM) $@.tmp
	touch $@.tmp
	$(foreach dir,$(EXTERNAL_PLUGINS),\
		if test -d $(dir)/share; then \
			echo "Sharing $(dir)/link"; \
			ln -s $(realpath $(dir)/share) share/$(notdir $(dir)); \
			echo /$(notdir $(dir)) >> $@.tmp; \
		fi; )
	mv $@.tmp $@

ifeq ("$(DEVELOPMENT)","yes")
all:: share/.gitignore
endif

François Bobot's avatar
François Bobot committed
402
clean_share_link:
403
404
405
406
407
408
409
410
411
412
413
	if test -f share/.gitignore; then \
	  for link in $$(cat share/.gitignore); do \
	    if test -L share$$link; then \
	      rm -f share$$link \
	    else \
	      rm -rf share$$link; \
	    fi; \
	  done; \
	  rm share/.gitignore; \
	fi

François Bobot's avatar
François Bobot committed
414
415
clean:: clean_share_link

416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
##############
# Ocamlgraph #
##############

# dgraph (included in ocamlgraph)
#[LC] Cf https://github.com/backtracking/ocamlgraph/pull/32
ifeq ($(HAS_GNOMECANVAS),yes)
ifneq ($(ENABLE_GUI),no)
GRAPH_GUICMO= dgraph.cmo
GRAPH_GUICMX= dgraph.cmx
GRAPH_GUIO= dgraph.o
HAS_DGRAPH=yes
else # enable_gui is no: disable dgraph
HAS_DGRAPH=no
endif
else # gnome_canvas is not yes: disable dgraph
HAS_DGRAPH=no
endif

##################
# Frama-C Kernel #
##################

# Libraries which could be compiled fully independently
#######################################################

VERY_FIRST_CMO = src/kernel_internals/runtime/frama_c_init.cmo
CMO	+= $(VERY_FIRST_CMO)

LIB_CMO =\
        src/libraries/stdlib/transitioning \
	src/libraries/stdlib/FCHashtbl \
	src/libraries/stdlib/extlib \
	src/libraries/datatype/unmarshal \
	src/libraries/datatype/unmarshal_z \
	src/libraries/datatype/structural_descr \
	src/libraries/datatype/type \
	src/libraries/datatype/descr \
	src/libraries/utils/filepath \
455
	src/libraries/utils/sanitizer \
456
457
458
459
460
461
462
463
464
465
466
467
	src/libraries/utils/pretty_utils \
	src/libraries/utils/hook \
	src/libraries/utils/bag \
	src/libraries/utils/wto \
	src/libraries/utils/vector \
	src/libraries/utils/indexer \
	src/libraries/utils/rgmap \
	src/libraries/utils/bitvector \
	src/libraries/utils/qstack \
	src/libraries/stdlib/integer \
	src/libraries/utils/json \
	src/libraries/utils/markdown \
Loïc Correnson's avatar
Loïc Correnson committed
468
469
	src/libraries/utils/rich_text \
	src/libraries/utils/dotgraph
470
471
472
473
474
475
476
477
478
479
480

NON_OPAQUE_DEPS+=\
  src/libraries/datatype/unmarshal_z \
  src/libraries/stdlib/integer

LIB_CMO:= $(addsuffix .cmo,$(LIB_CMO))
CMO	+= $(LIB_CMO)

# Very first files to be linked (most modules use them)
###############################

481
FIRST_CMO= src/kernel_internals/runtime/fc_config \
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
	src/kernel_internals/runtime/gui_init \
	src/kernel_services/plugin_entry_points/log \
	src/kernel_services/cmdline_parameters/cmdline \
	src/libraries/project/project_skeleton \
	src/libraries/datatype/datatype \
	src/kernel_services/plugin_entry_points/journal

# project_skeleton requires log
# datatype requires project_skeleton
# rangemap requires datatype

FIRST_CMO:= $(addsuffix .cmo,$(FIRST_CMO))
CMO	+= $(FIRST_CMO)

#Project (Project_skeleton must be linked before Journal)
PROJECT_CMO= \
	state \
	state_dependency_graph \
	state_topological \
	state_selection \
	project \
	state_builder
PROJECT_CMO:= $(patsubst %,src/libraries/project/%.cmo,$(PROJECT_CMO))
CMO	+= $(PROJECT_CMO)

# kernel
########

KERNEL_CMO=\
	src/libraries/utils/utf8_logic.cmo                              \
	src/libraries/utils/binary_cache.cmo                            \
	src/libraries/utils/hptmap.cmo                                  \
	src/libraries/utils/hptset.cmo                                  \
	src/libraries/utils/escape.cmo                                  \
	src/kernel_services/ast_queries/cil_datatype.cmo             \
	src/kernel_services/cmdline_parameters/typed_parameter.cmo      \
	src/kernel_services/plugin_entry_points/dynamic.cmo             \
	src/kernel_services/cmdline_parameters/parameter_category.cmo   \
	src/kernel_services/cmdline_parameters/parameter_customize.cmo  \
	src/kernel_services/cmdline_parameters/parameter_state.cmo      \
	src/kernel_services/cmdline_parameters/parameter_builder.cmo    \
	src/kernel_services/plugin_entry_points/plugin.cmo              \
	src/kernel_services/plugin_entry_points/kernel.cmo              \
	src/libraries/utils/unicode.cmo                                 \
	src/kernel_services/plugin_entry_points/emitter.cmo             \
	src/libraries/utils/floating_point.cmo                          \
	src/libraries/utils/rangemap.cmo                                \
	src/kernel_services/ast_printing/cil_types_debug.cmo            \
	src/kernel_services/ast_printing/printer_builder.cmo            \
	src/libraries/utils/cilconfig.cmo                               \
	src/kernel_internals/typing/alpha.cmo                         \
	src/kernel_services/ast_queries/cil_state_builder.cmo        \
	src/kernel_internals/runtime/machdeps.cmo                       \
	src/kernel_services/ast_queries/cil_const.cmo                \
	src/kernel_services/ast_queries/logic_env.cmo                \
	src/kernel_services/ast_queries/logic_const.cmo              \
538
	src/kernel_services/visitors/visitor_behavior.cmo		\
539
540
541
542
543
544
545
546
547
548
549
	src/kernel_services/ast_queries/cil.cmo                      \
	src/kernel_internals/parsing/errorloc.cmo                      \
	src/kernel_services/ast_printing/cil_printer.cmo                \
	src/kernel_services/ast_printing/cil_descriptive_printer.cmo    \
	src/kernel_services/parsetree/cabs.cmo                               \
	src/kernel_services/parsetree/cabshelper.cmo                         \
	src/kernel_services/ast_printing/logic_print.cmo                \
	src/kernel_services/ast_queries/logic_utils.cmo              \
	src/kernel_internals/parsing/logic_parser.cmo                  \
	src/kernel_internals/parsing/logic_lexer.cmo                   \
	src/kernel_services/ast_queries/logic_typing.cmo             \
550
	src/kernel_services/ast_queries/acsl_extension.cmo				\
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
	src/kernel_services/ast_queries/ast_info.cmo                 \
	src/kernel_services/ast_data/ast.cmo                            \
	src/kernel_services/ast_printing/cprint.cmo                     \
	src/kernel_services/visitors/cabsvisit.cmo                      \
	src/kernel_internals/typing/cabs2cil.cmo                      \
	src/kernel_services/ast_data/globals.cmo                        \
	src/kernel_internals/typing/cfg.cmo                           \
	src/kernel_services/ast_data/kernel_function.cmo                \
	src/kernel_services/ast_data/property.cmo                       \
	src/kernel_services/ast_data/property_status.cmo                \
	src/kernel_services/ast_data/annotations.cmo                    \
	src/kernel_services/ast_printing/printer.cmo                    \
	src/kernel_internals/typing/logic_builtin.cmo                 \
	src/kernel_services/ast_printing/cabs_debug.cmo                 \
	src/kernel_internals/parsing/lexerhack.cmo                     \
	src/kernel_internals/parsing/clexer.cmo                        \
	src/kernel_internals/parsing/cparser.cmo                       \
	src/kernel_internals/parsing/logic_preprocess.cmo              \
	src/kernel_internals/typing/mergecil.cmo                      \
	src/kernel_internals/typing/rmtmps.cmo                        \
	src/kernel_internals/typing/oneret.cmo                        \
	src/kernel_internals/typing/frontc.cmo                        \
573
	src/kernel_internals/typing/substitute_const_globals.cmo        \
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
	src/kernel_services/analysis/ordered_stmt.cmo                   \
	src/kernel_services/analysis/wto_statement.cmo                  \
	src/kernel_services/analysis/dataflows.cmo                      \
	src/kernel_services/analysis/dataflow2.cmo                      \
	src/kernel_services/analysis/stmts_graph.cmo                    \
	src/kernel_services/analysis/dominators.cmo                     \
	src/kernel_services/analysis/service_graph.cmo                  \
	src/kernel_services/analysis/undefined_sequence.cmo             \
	src/kernel_services/analysis/interpreted_automata.cmo           \
	src/kernel_services/ast_data/alarms.cmo                         \
	src/kernel_services/ast_printing/description.cmo                \
	src/kernel_services/abstract_interp/lattice_messages.cmo        \
	src/kernel_services/abstract_interp/abstract_interp.cmo         \
	src/kernel_services/abstract_interp/bottom.cmo                  \
	src/kernel_services/abstract_interp/int_Base.cmo                \
	src/kernel_services/analysis/bit_utils.cmo                      \
	src/kernel_services/abstract_interp/fc_float.cmo                \
	src/kernel_services/abstract_interp/float_interval.cmo          \
	src/kernel_services/abstract_interp/fval.cmo                    \
593
594
	src/kernel_services/abstract_interp/int_interval.cmo            \
	src/kernel_services/abstract_interp/int_set.cmo                 \
595
	src/kernel_services/abstract_interp/int_val.cmo                 \
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
	src/kernel_services/abstract_interp/ival.cmo                    \
	src/kernel_services/abstract_interp/base.cmo                    \
	src/kernel_services/abstract_interp/origin.cmo                  \
	src/kernel_services/abstract_interp/map_lattice.cmo             \
	src/kernel_services/abstract_interp/tr_offset.cmo               \
	src/kernel_services/abstract_interp/offsetmap.cmo               \
	src/kernel_services/abstract_interp/int_Intervals.cmo           \
	src/kernel_services/abstract_interp/locations.cmo               \
	src/kernel_services/abstract_interp/lmap.cmo                    \
	src/kernel_services/abstract_interp/lmap_bitwise.cmo            \
	src/kernel_services/visitors/visitor.cmo                        \
	src/kernel_services/ast_data/statuses_by_call.cmo               \
	src/kernel_services/ast_printing/printer_tag.cmo                \
	$(PLUGIN_TYPES_CMO_LIST)                                        \
	src/kernel_services/plugin_entry_points/db.cmo                  \
	src/libraries/utils/command.cmo                                 \
	src/libraries/utils/task.cmo                                    \
	src/kernel_services/ast_queries/filecheck.cmo                \
	src/kernel_services/ast_queries/json_compilation_database.cmo   \
	src/kernel_services/ast_queries/file.cmo                     \
	src/kernel_internals/typing/translate_lightweight.cmo         \
617
	src/kernel_internals/typing/ghost_cfg.cmo			\
618
	src/kernel_internals/typing/ghost_accesses.cmo  		\
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
	src/kernel_internals/typing/allocates.cmo                     \
	src/kernel_internals/typing/unroll_loops.cmo                  \
	src/kernel_internals/typing/asm_contracts.cmo                 \
	src/kernel_services/analysis/loop.cmo                           \
	src/kernel_services/analysis/exn_flow.cmo                       \
        src/kernel_services/analysis/destructors.cmo                    \
	src/kernel_services/analysis/logic_interp.cmo                   \
	src/kernel_internals/typing/infer_annotations.cmo             \
	src/kernel_services/ast_transformations/clone.cmo                           \
	src/kernel_services/ast_transformations/filter.cmo                          \
	src/kernel_services/ast_transformations/inline.cmo              \
	src/kernel_internals/runtime/special_hooks.cmo                  \
	src/kernel_internals/runtime/messages.cmo

CMO	+= $(KERNEL_CMO)

MLI_ONLY+=\
	src/libraries/utils/hptmap_sig.mli                                   \
	src/kernel_services/cmdline_parameters/parameter_sig.mli             \
	src/kernel_services/ast_data/cil_types.mli                           \
	src/kernel_services/parsetree/logic_ptree.mli                             \
	src/kernel_services/ast_printing/printer_api.mli                     \
	src/kernel_services/abstract_interp/float_sig.mli                    \
	src/kernel_services/abstract_interp/float_interval_sig.mli           \
	src/kernel_services/abstract_interp/lattice_type.mli                 \
644
	src/kernel_services/abstract_interp/eva_lattice_type.mli             \
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
	src/kernel_services/abstract_interp/int_Intervals_sig.mli            \
	src/kernel_services/abstract_interp/offsetmap_lattice_with_isotropy.mli \
	src/kernel_services/abstract_interp/offsetmap_sig.mli                \
	src/kernel_services/abstract_interp/lmap_sig.mli                     \
	src/kernel_services/abstract_interp/offsetmap_bitwise_sig.mli

NO_MLI+= src/kernel_services/parsetree/cabs.mli                \
	src/kernel_internals/runtime/machdep_ppc_32.mli         \
	src/kernel_internals/runtime/machdep_x86_16.mli         \
	src/kernel_internals/runtime/machdep_x86_32.mli         \
	src/kernel_internals/runtime/machdep_x86_64.mli         \
	src/kernel_services/ast_printing/cabs_debug.mli        \
	src/kernel_internals/parsing/logic_lexer.mli           \
	src/kernel_internals/parsing/lexerhack.mli             \

MODULES_NODOC+= src/kernel_internals/runtime/machdep_ppc_32.ml \
	src/kernel_internals/runtime/machdep_x86_16.ml         \
	src/kernel_internals/runtime/machdep_x86_32.ml         \
	src/kernel_internals/runtime/machdep_x86_64.ml         \
	external/unmarshal_z.mli


GENERATED += $(addprefix src/kernel_internals/parsing/,\
		clexer.ml cparser.ml cparser.mli \
		logic_lexer.ml logic_parser.ml \
		logic_parser.mli logic_preprocess.ml)


.PHONY: check-logic-parser-wildcard
check-logic-parser-wildcard:
	cd src/kernel_internals/parsing && ocaml check_logic_parser.ml

NON_OPAQUE_DEPS+= src/kernel_services/plugin_entry_points/dynamic

# C Bindings
############

GEN_C_BINDINGS=src/libraries/utils/c_bindings.o
GEN_C_BINDINGS_FLAGS= -fPIC
GEN_BYTE_LIBS+= $(GEN_C_BINDINGS)
GEN_OPT_LIBS+= $(GEN_C_BINDINGS)

src/libraries/utils/c_bindings.o: src/libraries/utils/c_bindings.c
	$(PRINT_CC) $@
	$(CC) $(GEN_C_BINDINGS_FLAGS) -c -I$(call winpath,$(OCAMLLIB)) -O3 -Wall -o $@ $<

# Common startup module
# All link command should add it as last linked module and depend on it.
########################################################################

STARTUP_CMO=src/kernel_internals/runtime/boot.cmo
STARTUP_CMX=$(STARTUP_CMO:.cmo=.cmx)

# GUI modules
# See below for GUI compilation
##############################################################################

WTOOLKIT= \
	wutil widget wbox wfile wpane wpalette wtext wtable

705
ifeq ("$(LABLGTK_VERSION)","3")
706

707
src/plugins/gui/GSourceView.ml: src/plugins/gui/GSourceView3.ml.in
708
709
710
	$(CP) $< $@
	$(CHMOD_RO) $@

711
src/plugins/gui/GSourceView.mli: src/plugins/gui/GSourceView3.mli.in
712
713
714
	$(CP) $< $@
	$(CHMOD_RO) $@

715
716
717
718
719
720
721
722
else
src/plugins/gui/GSourceView.ml: src/plugins/gui/GSourceView2.ml.in
	$(CP) $< $@
	$(CHMOD_RO) $@

src/plugins/gui/GSourceView.mli: src/plugins/gui/GSourceView2.mli.in
	$(CP) $< $@
	$(CHMOD_RO) $@
723

724
725
endif

726
SOURCEVIEWCOMPAT:=GSourceView
727
728
GENERATED+=src/plugins/gui/GSourceView.ml src/plugins/gui/GSourceView.mli \
           src/plugins/gui/dgraph_helper.ml src/plugins/gui/gtk_compat.ml
729

730
731
ifeq ($(LABLGTK),lablgtk3)
src/plugins/gui/gtk_compat.ml: src/plugins/gui/gtk_compat.3.ml
732
733
	$(CP) $< $@
	$(CHMOD_RO) $@
734
735
else
src/plugins/gui/gtk_compat.ml: src/plugins/gui/gtk_compat.2.ml
736
737
	$(CP) $< $@
	$(CHMOD_RO) $@
738
endif
739
GENERATED+=src/plugins/gui/gtk_compat.ml
740

741
ifeq ($(HAS_DGRAPH),yes)
742
743
  DGRAPHFILES:=debug_manager
  src/plugins/gui/dgraph_helper.ml: src/plugins/gui/dgraph_helper.yes.ml
744
745
746
	$(CP) $< $@
	$(CHMOD_RO) $@
else
747
  DGRAPHFILES:=
748
  src/plugins/gui/dgraph_helper.ml: src/plugins/gui/dgraph_helper.no.ml
749
750
751
752
	$(CP) $< $@
	$(CHMOD_RO) $@
endif

753
SINGLE_GUI_CMO:= \
754
	wutil_once \
755
	gtk_compat \
756
	$(WTOOLKIT) \
757
	$(SOURCEVIEWCOMPAT) \
758
	gui_parameters \
759
	gtk_helper \
760
        dgraph_helper \
761
        gtk_form \
762
763
764
765
766
767
768
769
	source_viewer pretty_source source_manager book_manager \
	warning_manager \
	filetree \
	launcher \
	menu_manager \
	history \
	gui_printers \
	design \
770
	analyses_manager file_manager project_manager \
771
	help_manager \
772
773
        $(DGRAPHFILES) \
        property_navigator \
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812

SINGLE_GUI_CMO:= $(patsubst %,src/plugins/gui/%.cmo,$(SINGLE_GUI_CMO))

###############################################################################
#                                                                             #
####################                                                          #
# Plug-in sections #                                                          #
####################                                                          #
#                                                                             #
# For 'internal' developers:                                                  #
# you can add your own plug-in here,                                          #
# but it is better to have your own separated Makefile                        #
###############################################################################

###########
# Metrics #
###########

PLUGIN_ENABLE:=$(ENABLE_METRICS)
PLUGIN_NAME:=Metrics
PLUGIN_DISTRIBUTED:=yes
PLUGIN_DIR:=src/plugins/metrics
PLUGIN_CMO:= metrics_parameters css_html metrics_base metrics_acsl \
	     metrics_cabs metrics_cilast metrics_coverage \
	     register
PLUGIN_GUI_CMO:= metrics_gui register_gui
PLUGIN_DEPENDENCIES:=Eva
PLUGIN_INTERNAL_TEST:=yes
$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME)))

#############
# Callgraph #
#############

PLUGIN_ENABLE:=$(ENABLE_CALLGRAPH)
PLUGIN_NAME:=Callgraph
PLUGIN_DISTRIBUTED:=yes
PLUGIN_DIR:=src/plugins/callgraph
PLUGIN_CMO:= options journalize subgraph cg services uses register
813
ifeq ($(HAS_DGRAPH),yes)
814
PLUGIN_GUI_CMO:=cg_viewer
815
816
else
PLUGIN_GUI_CMO:=
817
PLUGIN_DISTRIB_EXTERNAL:=cg_viewer.ml
818
endif
819
820
821
822
823
824
825
826
827
828
829
830
831
832
PLUGIN_CMI:= callgraph_api
PLUGIN_INTERNAL_TEST:=yes
PLUGIN_TESTS_DIRS:=callgraph
PLUGIN_TESTS_LIB:=tests/callgraph/function_pointer.ml
$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME)))


##################
# Evolved Value Analysis #
##################

PLUGIN_ENABLE:=$(ENABLE_EVA)
PLUGIN_NAME:=Eva
PLUGIN_DIR:=src/plugins/value
833
PLUGIN_EXTRA_DIRS:=engine values domains api domains/cvalue domains/apron \
834
	domains/gauges domains/equality legacy partitioning utils gui_files \
835
	api values/numerors domains/numerors
836
PLUGIN_TESTS_DIRS+=value/traces
837
838
839
840

# Files for the binding to Apron domains. Only available if Apron is available.
ifeq ($(HAS_APRON),yes)
PLUGIN_REQUIRES+= apron.octMPQ apron.boxMPQ apron.polkaMPQ apron.apron gmp
841
APRON_CMO:= domains/apron/apron_domain
842
else
843
APRON_CMO:=
844
PLUGIN_DISTRIB_EXTERNAL+= \
845
846
	domains/apron/apron_domain.ml domains/apron/apron_domain.mli
endif
847
848
849
850
851

# Files for the numerors domain. Only available is MPFR is available.
NUMERORS_FILES:= \
	values/numerors/numerors_utils values/numerors/numerors_float \
	values/numerors/numerors_interval values/numerors/numerors_arithmetics \
852
	values/numerors/numerors_value domains/numerors/numerors_domain
853
854
855
856
857
858
859
860
861
862
863
864
865
866

ifeq ($(HAS_MPFR),yes)
PLUGIN_REQUIRES+= gmp
PLUGIN_TESTS_DIRS+=value/numerors
NUMERORS_CMO:= $(NUMERORS_FILES)
else
# Do not compile numerors files, but include them in the distributed files.
NUMERORS_CMO:=
PLUGIN_DISTRIB_EXTERNAL+= $(addsuffix .ml,$(NUMERORS_FILES))
PLUGIN_DISTRIB_EXTERNAL+= $(addsuffix .mli,$(NUMERORS_FILES))
endif

# General rules for ordering files within PLUGIN_CMO:
# - try to keep the legacy Value before Eva
867
PLUGIN_CMO:= partitioning/split_strategy domains/domain_mode value_parameters \
868
869
	utils/value_perf utils/eva_annotations \
	utils/value_util utils/red_statuses \
870
	utils/mark_noresults \
871
	utils/widen_hints_ext utils/widen \
872
	partitioning/split_return \
873
	partitioning/per_stmt_slevel \
874
875
	utils/library_functions \
	utils/eval_typ utils/backward_formals \
876
	alarmset eval utils/structure utils/abstract \
877
878
879
880
881
882
883
884
	values/value_product values/location_lift \
	values/cvalue_forward values/cvalue_backward \
	values/main_values values/main_locations \
	values/offsm_value values/sign_value \
	legacy/eval_op legacy/function_args \
	domains/domain_store domains/domain_builder \
	domains/domain_product domains/domain_lift domains/unit_domain \
	domains/printer_domain \
885
	domains/traces_domain \
886
	domains/simple_memory \
David Bühler's avatar
David Bühler committed
887
	domains/octagons \
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
	domains/gauges/gauges_domain \
	domains/hcexprs \
	domains/equality/equality domains/equality/equality_domain \
	domains/offsm_domain \
	domains/symbolic_locs \
	domains/sign_domain \
	domains/cvalue/warn domains/cvalue/locals_scoping \
	domains/cvalue/cvalue_offsetmap \
	utils/value_results \
	domains/cvalue/builtins domains/cvalue/builtins_malloc \
	domains/cvalue/builtins_string domains/cvalue/builtins_misc \
	domains/cvalue/builtins_memory domains/cvalue/builtins_print_c \
	domains/cvalue/builtins_watchpoint \
	domains/cvalue/builtins_float domains/cvalue/builtins_split \
	domains/inout_domain \
	legacy/eval_terms legacy/eval_annots \
	domains/powerset engine/transfer_logic \
	domains/cvalue/cvalue_transfer domains/cvalue/cvalue_init \
	domains/cvalue/cvalue_specification \
	domains/cvalue/cvalue_domain \
908
	engine/subdivided_evaluation engine/evaluation engine/abstractions \
909
	engine/recursion engine/transfer_stmt engine/transfer_specification \
910
	partitioning/auto_loop_unroll \
911
912
913
	partitioning/partition partitioning/partitioning_parameters \
	partitioning/partitioning_index partitioning/trace_partitioning \
	engine/mem_exec engine/iterator engine/initialization \
914
	engine/compute_functions engine/analysis register \
915
	api/general_requests \
Loïc Correnson's avatar
Loïc Correnson committed
916
	utils/unit_tests \
917
	api/values_request \
918
	$(APRON_CMO) $(NUMERORS_CMO)
919
920
PLUGIN_CMI:= values/abstract_value values/abstract_location \
	domains/abstract_domain domains/simpler_domains
921
PLUGIN_DEPENDENCIES:=Callgraph LoopAnalysis RteGen Server
922
923
924
925
926
927
928
929

# These files are used by the GUI, but do not depend on Lablgtk
VALUE_GUI_AUX:=gui_files/gui_types gui_files/gui_eval \
		gui_files/gui_callstacks_filters
PLUGIN_GUI_CMO:=$(VALUE_GUI_AUX) gui_files/gui_callstacks_manager \
		gui_files/gui_red gui_files/register_gui

PLUGIN_INTERNAL_TEST:= yes
930
PLUGIN_TESTS_LIB=tests/float/fval_test.ml
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
PLUGIN_DISTRIBUTED:=yes
VALUE_TYPES:=$(addprefix src/plugins/value_types/,\
		cilE cvalue precise_locs value_types widen_type)
PLUGIN_TYPES_CMO:=$(VALUE_TYPES)
PLUGIN_TYPES_TODOC:=$(addsuffix .mli,$(VALUE_TYPES))

$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME)))

##################
# Occurrence     #
##################

PLUGIN_ENABLE:=$(ENABLE_OCCURRENCE)
PLUGIN_NAME:=Occurrence
PLUGIN_DISTRIBUTED:=yes
PLUGIN_DIR:=src/plugins/occurrence
PLUGIN_CMO:= options register
PLUGIN_GUI_CMO:=register_gui
PLUGIN_INTRO:=doc/code/intro_occurrence.txt
PLUGIN_INTERNAL_TEST:=yes
PLUGIN_DEPENDENCIES:=Eva
$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME)))

################################################
# Runtime Error Annotation Generation analysis #
################################################

PLUGIN_ENABLE:=$(ENABLE_RTEGEN)
PLUGIN_NAME:=RteGen
PLUGIN_DIR:=src/plugins/rte
961
PLUGIN_CMO:= options generator rte flags visit register
962
963
964
PLUGIN_DISTRIBUTED:=yes
PLUGIN_INTERNAL_TEST:=yes
PLUGIN_TESTS_DIRS:=rte rte_manual
965
966
967
968
969
PLUGIN_TESTS_LIB:=\
  tests/rte/my_annotation/my_annotation.ml \
  tests/rte/rte_api/rte_get_annot.ml \
  tests/rte/compute_annot/compute_annot.ml \
  tests/rte/my_annot_proxy/my_annot_proxy.ml
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME)))

#################
# From analysis #
#################

PLUGIN_ENABLE:=$(ENABLE_FROM_ANALYSIS)
PLUGIN_NAME:=From
PLUGIN_DIR:=src/plugins/from
PLUGIN_CMO:= from_parameters from_compute \
	functionwise callwise from_register
PLUGIN_GUI_CMO:=from_register_gui
PLUGIN_TESTS_DIRS:=idct test float
PLUGIN_DISTRIBUTED:=yes
PLUGIN_INTERNAL_TEST:=yes
FROM_TYPES:=src/plugins/value_types/function_Froms
PLUGIN_TYPES_CMO:=$(FROM_TYPES)
PLUGIN_TYPES_TODOC:=$(addsuffix .mli,$(FROM_TYPES))
PLUGIN_DEPENDENCIES:=Callgraph Eva Postdominators

$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME)))

##################
# Users analysis #
##################

PLUGIN_ENABLE:=$(ENABLE_USERS)
PLUGIN_NAME:=Users
PLUGIN_DIR:=src/plugins/users
PLUGIN_CMO:= users_register
PLUGIN_NO_TEST:=yes
PLUGIN_DISTRIBUTED:=yes
PLUGIN_INTERNAL_TEST:=yes
PLUGIN_DEPENDENCIES:=Callgraph Eva

$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME)))

########################
# Constant propagation #
########################

PLUGIN_ENABLE:=$(ENABLE_CONSTANT_PROPAGATION)
PLUGIN_NAME:=Constant_Propagation
PLUGIN_DIR:=src/plugins/constant_propagation
1014
PLUGIN_TESTS_LIB:=tests/constant_propagation/introduction_of_non_explicit_cast.ml
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
PLUGIN_CMO:= propagationParameters \
	api
PLUGIN_DISTRIBUTED:=yes
PLUGIN_INTERNAL_TEST:=yes
PLUGIN_DEPENDENCIES:=Eva

$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME)))

###################
# Post-dominators #
###################

PLUGIN_ENABLE:=$(ENABLE_POSTDOMINATORS)
PLUGIN_NAME:=Postdominators
PLUGIN_DIR:=src/plugins/postdominators
PLUGIN_CMO:= postdominators_parameters print compute
PLUGIN_NO_TEST:=yes
PLUGIN_DISTRIBUTED:=yes
PLUGIN_INTERNAL_TEST:=yes
$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME)))

#########
# inout #
#########

PLUGIN_ENABLE:=$(ENABLE_INOUT)
PLUGIN_NAME:=Inout
PLUGIN_DIR:=src/plugins/inout
PLUGIN_CMO:= inout_parameters cumulative_analysis \
	     operational_inputs outputs inputs derefs register
PLUGIN_NO_TEST:=yes
PLUGIN_DISTRIBUTED:=yes
PLUGIN_INTERNAL_TEST:=yes
INOUT_TYPES:=src/plugins/value_types/inout_type
PLUGIN_TYPES_CMO:=$(INOUT_TYPES)
PLUGIN_TYPES_TODOC:=$(addsuffix .mli,$(INOUT_TYPES))
PLUGIN_DEPENDENCIES:=Callgraph Eva From

$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME)))

###################
# Impact analysis #
###################

PLUGIN_ENABLE:=$(ENABLE_IMPACT)
PLUGIN_NAME:=Impact
PLUGIN_DIR:=src/plugins/impact
PLUGIN_CMO:= options pdg_aux reason_graph compute_impact register
PLUGIN_GUI_CMO:= register_gui
PLUGIN_DISTRIBUTED:=yes
PLUGIN_INTERNAL_TEST:=yes
PLUGIN_DEPENDENCIES:=Inout Eva Pdg Slicing

$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME)))

##################################
# PDG : program dependence graph #
##################################

PLUGIN_ENABLE:=$(ENABLE_PDG)
PLUGIN_NAME:=Pdg
PLUGIN_DIR:=src/plugins/pdg
1077
1078
PLUGIN_TESTS_LIB:=tests/pdg/dyn_dpds.ml \
                  tests/pdg/sets.ml
1079
PLUGIN_TESTS_DIRS:=pdg
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
PLUGIN_CMO:= pdg_parameters \
	    ctrlDpds \
	    pdg_state \
	    build \
	    sets \
	    annot \
	    marks \
	    register

PDG_TYPES:=pdgIndex pdgTypes pdgMarks
PDG_TYPES:=$(addprefix src/plugins/pdg_types/,$(PDG_TYPES))
PLUGIN_TYPES_CMO:=$(PDG_TYPES)

PLUGIN_INTRO:=doc/code/intro_pdg.txt
PLUGIN_TYPES_TODOC:=$(addsuffix .mli,$(PDG_TYPES))
PLUGIN_DEPENDENCIES:=Callgraph Eva From
PLUGIN_DISTRIBUTED:=yes
PLUGIN_INTERNAL_TEST:=yes

$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME)))

################################################
# Scope : show different kinds of dependencies #
################################################

PLUGIN_ENABLE:=$(ENABLE_SCOPE)
PLUGIN_NAME:=Scope
PLUGIN_DIR:=src/plugins/scope
1108
1109
PLUGIN_TESTS_LIB:=tests/scope/bts971.ml \
                  tests/scope/zones.ml
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
PLUGIN_CMO:= datascope zones defs
PLUGIN_GUI_CMO:=dpds_gui
PLUGIN_DEPENDENCIES:=Eva Inout
PLUGIN_INTRO:=doc/code/intro_scope.txt
PLUGIN_DISTRIBUTED:=yes
PLUGIN_INTERNAL_TEST:=yes
$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME)))

#####################################
# Sparecode : unused code detection #
#####################################

PLUGIN_ENABLE:=$(ENABLE_SPARECODE)
PLUGIN_NAME:=Sparecode
PLUGIN_DIR:=src/plugins/sparecode
PLUGIN_CMO:= sparecode_params globs spare_marks transform register
PLUGIN_INTRO:=doc/code/intro_sparecode.txt
PLUGIN_DISTRIBUTED:=yes
PLUGIN_INTERNAL_TEST:=yes
PLUGIN_DEPENDENCIES:=Pdg Eva Users

$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME)))

###########
# Slicing #
###########

PLUGIN_ENABLE:=$(ENABLE_SLICING)
PLUGIN_NAME:=Slicing
PLUGIN_DIR:=src/plugins/slicing
PLUGIN_CMO:= slicingInternals \
	    slicingTypes \
	    slicingParameters \
	    slicingState \
	    slicingMacros \
	    slicingMarks \
	    slicingActions \
	    fct_slice \
	    printSlice \
	    slicingProject \
	    slicingTransform \
	    slicingSelect \
	    slicingCmds \
	    api \
	    register

PLUGIN_GUI_CMO:=register_gui

PLUGIN_INTRO:=doc/code/intro_slicing.txt
PLUGIN_UNDOC:=register.ml # slicing_gui.ml

PLUGIN_TESTS_DIRS:= slicing
PLUGIN_TESTS_LIB:= tests/slicing/libSelect.ml tests/slicing/libAnim.ml \
	tests/slicing/simple_intra_slice.ml tests/slicing/combine.ml \
	tests/slicing/ex_spec_interproc.ml tests/slicing/horwitz.ml \
	tests/slicing/mark_all_slices.ml tests/slicing/merge.ml \
	tests/slicing/min_call.ml tests/slicing/select_by_annot.ml \
	tests/slicing/select_simple.ml tests/slicing/simple_intra_slice.ml \
	tests/slicing/slice_no_body.ml tests/slicing/switch.ml \
	tests/slicing/adpcm.ml
PLUGIN_DISTRIBUTED:=yes
PLUGIN_INTERNAL_TEST:=yes
1172
PLUGIN_DEPENDENCIES:=Pdg Callgraph Eva Sparecode
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240

$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME)))

#####################
# External plug-ins #
#####################

define INCLUDE_PLUGIN
FRAMAC_SHARE:=$(FRAMAC_ROOT_SRCDIR)/share
FRAMAC_PLUGIN:=$(FRAMAC_ROOT_SRCDIR)/lib/plugins
FRAMAC_PLUGIN_GUI:=$(FRAMAC_ROOT_SRCDIR)/lib/plugins/gui
PLUGIN_DIR:=$(1)
include $(1)/Makefile
endef

$(foreach p,$(EXTERNAL_PLUGINS),$(eval $(call INCLUDE_PLUGIN,$p)))

###############################################################################
#                                                                             #
###########################                                                   #
# End of plug-in sections #                                                   #
###########################                                                   #
#                                                                             #
###############################################################################

#####################
# Generic variables #
#####################

CMX	= $(CMO:.cmo=.cmx)
CMI	= $(CMO:.cmo=.cmi)

ALL_CMO	= $(CMO) $(PLUGIN_CMO_LIST) $(STARTUP_CMO)
ALL_CMX	= $(CMX) $(PLUGIN_CMX_LIST) $(STARTUP_CMX)

FILES_FOR_OCAMLDEP+= $(addsuffix /*.mli,$(FRAMAC_SRC_DIRS)) \
	$(addsuffix /*.ml,$(FRAMAC_SRC_DIRS))

MODULES_TODOC+=$(filter-out $(MODULES_NODOC),\
	$(MLI_ONLY) $(NO_MLI:.mli=.ml) \
	$(filter-out $(NO_MLI),\
	$(filter-out $(PLUGIN_TYPES_CMO_LIST:.cmo=.mli),$(CMO:.cmo=.mli))))

################################
# toplevel.{byte,opt} binaries #
################################

ALL_BATCH_CMO= $(filter-out src/kernel_internals/runtime/gui_init.cmo,\
	$(ALL_CMO))
ALL_BATCH_CMX= $(filter-out src/kernel_internals/runtime/gui_init.cmx,\
	$(ALL_CMX))

bin/toplevel.byte$(EXE): $(ALL_BATCH_CMO) $(GEN_BYTE_LIBS) \
			$(PLUGIN_DYN_CMO_LIST)
	$(PRINT_LINKING) $@
	$(OCAMLC) $(BLINKFLAGS) -o $@ $(BYTE_LIBS) $(ALL_BATCH_CMO)

#Profiling version of toplevel.byte using ocamlprof
bin/toplevel.prof$(EXE): $(ALL_BATCH_CMO) $(GEN_BYTE_LIBS) \
			$(PLUGIN_DYN_CMO_LIST)
	$(PRINT_OCAMLCP) $@
	$(OCAMLCP) $(BLINKFLAGS) -o $@ $(BYTE_LIBS) $(ALL_BATCH_CMO)

bin/toplevel.opt$(EXE): $(ALL_BATCH_CMX) $(GEN_OPT_LIBS) \
			$(PLUGIN_DYN_CMX_LIST)
	$(PRINT_LINKING) $@
	$(OCAMLOPT) $(OLINKFLAGS) -o $@ $(OPT_LIBS) $(ALL_BATCH_CMX)

François Bobot's avatar
François Bobot committed
1241
1242
1243
LIB_KERNEL_CMO= $(filter-out src/kernel_internals/runtime/gui_init.cmo, $(CMO))
LIB_KERNEL_CMX= $(filter-out src/kernel_internals/runtime/gui_init.cmx, $(CMX))

1244
1245
lib/fc/frama-c.cma: $(LIB_KERNEL_CMO) $(GEN_BYTE_LIBS) lib/fc/META.frama-c
	$(PRINT_LINKING) $@
François Bobot's avatar
François Bobot committed
1246
	$(MKDIR) $(FRAMAC_LIB)
1247
	$(OCAMLMKLIB) -o lib/fc/frama-c $(BYTE_LIBS) $(LIB_KERNEL_CMO)
François Bobot's avatar
François Bobot committed
1248

1249
1250
1251
1252
lib/fc/frama-c.cmxa: lib/fc/frama-c.cma $(GEN_OPT_LIBS) $(LIB_KERNEL_CMX)
	$(MKDIR) $(FRAMAC_LIB)
	$(PRINT_LINKING) $@
	$(OCAMLMKLIB) -o lib/fc/frama-c $(OPT_LIBS) $(LIB_KERNEL_CMX)
François Bobot's avatar
François Bobot committed
1253

1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
####################
# (Ocaml) Toplevel #
####################

bin/toplevel.top$(EXE): $(filter-out src/kernel_internals/runtime/boot.ml,$(ALL_BATCH_CMO)) \
			src/kernel_internals/runtime/toplevel_config.cmo \
			$(GEN_BYTE_LIBS) $(PLUGIN_DYN_CMO_LIST)
	$(PRINT_OCAMLMKTOP) $@
	$(OCAMLMKTOP) $(BFLAGS) -warn-error -31 -custom -o $@ \
	  -linkpkg $(BYTE_LIBS) $(ALL_BATCH_CMO) \
	   src/kernel_internals/runtime/toplevel_config.cmo

#######
# GUI #
#######

ifneq ($(ENABLE_GUI),no)

SINGLE_GUI_CMI = $(SINGLE_GUI_CMO:.cmo=.cmi)
SINGLE_GUI_CMX = $(SINGLE_GUI_CMO:.cmo=.cmx)

GUICMO += $(SINGLE_GUI_CMO) $(PLUGIN_GUI_CMO_LIST)

MODULES_TODOC+= $(filter-out src/plugins/gui/book_manager.mli,\
	$(SINGLE_GUI_CMO:.cmo=.mli))

GUICMI = $(GUICMO:.cmo=.cmi)
GUICMX = $(SINGLE_GUI_CMX) $(PLUGIN_GUI_CMX_LIST)

$(GUICMI) $(GUICMO) bin/viewer.byte$(EXE): BFLAGS+= $(GUI_INCLUDES)
$(GUICMX) bin/viewer.opt$(EXE): OFLAGS+= $(GUI_INCLUDES)

$(PLUGIN_DYN_DEP_GUI_CMO_LIST): BFLAGS+= $(GUI_INCLUDES)
$(PLUGIN_DYN_DEP_GUI_CMX_LIST): OFLAGS+= $(GUI_INCLUDES)

.PHONY:gui

gui-byte:: bin/viewer.byte$(EXE) share/Makefile.dynamic_config \
           $(PLUGIN_META_LIST)

gui-opt:: gui-byte bin/viewer.opt$(EXE)

gui: gui-$(OCAMLBEST)

ALL_GUI_CMO= $(ALL_CMO) $(GRAPH_GUICMO) $(GUICMO)
ALL_GUI_CMX= $(patsubst %.cma,%.cmxa,$(ALL_GUI_CMO:.cmo=.cmx))

bin/viewer.byte$(EXE): BYTE_LIBS+= $(GRAPH_GUICMO)
bin/viewer.byte$(EXE): $(filter-out $(GRAPH_GUICMO),$(ALL_GUI_CMO)) \
			$(GEN_BYTE_LIBS) \
			$(PLUGIN_DYN_CMO_LIST) $(PLUGIN_DYN_GUI_CMO_LIST)
	$(PRINT_LINKING) $@
1306
	$(OCAMLC) $(BLINKFLAGS) $(THREAD) -o $@ $(BYTE_LIBS) \
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
	  $(CMO) \
	  $(filter-out \
	    $(patsubst $(PLUGIN_GUI_LIB_DIR)/%,$(PLUGIN_LIB_DIR)/%,\
		$(PLUGIN_GUI_CMO_LIST)),\
	    $(PLUGIN_CMO_LIST)) \
	  $(GUICMO) $(STARTUP_CMO)

bin/viewer.opt$(EXE): OPT_LIBS+= $(GRAPH_GUICMX)
bin/viewer.opt$(EXE): $(filter-out $(GRAPH_GUICMX),$(ALL_GUI_CMX)) \
			$(GEN_OPT_LIBS) \
			$(PLUGIN_DYN_CMX_LIST) $(PLUGIN_DYN_GUI_CMX_LIST) \
			$(PLUGIN_CMX_LIST) $(PLUGIN_GUI_CMX_LIST)
	$(PRINT_LINKING) $@
1320
	$(OCAMLOPT) $(OLINKFLAGS) $(THREAD) -o $@ $(OPT_LIBS) \
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
	  $(CMX) \
	  $(filter-out \
	    $(patsubst $(PLUGIN_GUI_LIB_DIR)/%,$(PLUGIN_LIB_DIR)/%,\
	      $(PLUGIN_GUI_CMX_LIST)),\
	    $(PLUGIN_CMX_LIST)) \
	  $(GUICMX) $(STARTUP_CMX)
endif

#####################
# Config Ocaml File #
#####################

CONFIG_DIR=src/kernel_internals/runtime
1334
1335
CONFIG_FILE=$(CONFIG_DIR)/fc_config.ml
CONFIG_CMO=$(CONFIG_DIR)/fc_config.cmo
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
GENERATED +=$(CONFIG_FILE)
#Generated in Makefile.generating

empty:=
space:=$(empty) $(empty)

ifeq ($(ENABLE_GUI),no)
CONFIG_CMO=$(ALL_CMO)
CONFIG_PLUGIN_CMO=$(PLUGIN_CMO_LIST)
else
CONFIG_CMO=$(ALL_GUI_CMO)
CONFIG_PLUGIN_CMO=$(PLUGIN_GUI_CMO_LIST)
endif

ifeq ($(HAS_DOT),yes)
OPTDOT=Some \"$(DOT)\"
else
OPTDOT=None
endif

COMPILATION_UNITS=\
  $(foreach p,$(CONFIG_CMO),\"$(notdir $(patsubst %.cmo,%,$p))\"; )

###################
# Generating part #
###################
# It is in another file in order to have a dependency only on Makefile.generating.
# It must be before `.depend` definition because it modifies $GENERATED.

include Makefile.generating

#########
# Tests #
#########

1371
ifeq ($(OCAMLBEST),opt)
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
PTESTS_FILES=ptests_config.cmi ptests_config.cmx ptests_config.o
else
PTESTS_FILES=ptests_config.cmi ptests_config.cmo
endif

.PHONY: tests oracles btests tests_dist libc_tests plugins_ptests_config external_tests \
	update_external_tests

tests:: byte opt ptests
	$(PRINT_EXEC) ptests
	time -p $(PTESTS) $(PTESTS_OPTS) $(FRAMAC_PARALLEL) \
		-make "$(MAKE)" $(PLUGIN_TESTS_LIST)

external_tests: byte opt ptests
tests:: external_tests

update_external_tests: PTESTS_OPTS="-update"
update_external_tests: external_tests

oracles: byte opt ptests
	$(PRINT_MAKING) oracles
1393
	./bin/ptests.$(OCAMLBEST)$(EXE) -make "$(MAKE)" $(PLUGIN_TESTS_LIST) \
1394
		> /dev/null 2>&1
1395
	./bin/ptests.$(OCAMLBEST)$(EXE) -make "$(MAKE)" -update \
1396
1397
1398
1399
1400
1401
1402
1403
1404
		$(PLUGIN_TESTS_LIST)

btests: byte ./bin/ptests.byte$(EXE)
	$(PRINT_EXEC) ptests -byte
	time -p ./bin/ptests.byte$(EXE) -make "$(MAKE)" -byte \
		$(PLUGIN_TESTS_LIST)

tests_dist: dist ptests
	$(PRINT_EXEC) ptests
1405
	time -p ./bin/ptests.$(OCAMLBEST)$(EXE) -make "$(MAKE)" \
1406
1407
1408
1409
1410
		$(PLUGIN_TESTS_LIST)

# test only one test suite : make suite_tests
%_tests: opt ptests
	$(PRINT_EXEC) ptests
1411
	./bin/ptests.$(OCAMLBEST)$(EXE) -make "$(MAKE)" $($*_TESTS_OPTS) $*
1412
1413
1414
1415
1416
1417
1418
1419
1420

# full test suite
wp_TESTS_OPTS=-j 1
fulltests: tests wp_tests

acsl_tests: byte
	$(PRINT_EXEC) acsl_tests
	find doc/speclang -name \*.c -exec ./bin/toplevel.byte$(EXE) {} \; > /dev/null

1421
1422
1423
1424
1425
1426
1427
LONELY_TESTS_DIR:=$(wildcard $(TEST_DIRS_AS_PLUGIN:%=tests/%))
ifeq ($(strip $(LONELY_TESTS_DIR)),)
  LONELY_TESTS_ML_FILES:=
else
  LONELY_TESTS_ML_FILES:=\
    $(sort $(shell find $(TEST_DIRS_AS_PLUGIN:%=tests/%) -not -path '*/\.*' -name '*.ml'))
endif
1428
1429
1430
1431
1432
1433
1434
$(foreach file,$(LONELY_TESTS_ML_FILES),\
  $(eval $(file:%.ml=%.cmo): BFLAGS+=-I $(dir $(file))))
$(foreach file,$(LONELY_TESTS_ML_FILES),\
  $(eval $(file:%.ml=%.cmx): OFLAGS+=-I $(dir $(file))))
$(foreach file,$(LONELY_TESTS_ML_FILES),\
  $(eval $(file:%.ml=%.cmxs): OFLAGS+=-I $(dir $(file))))
.PRECIOUS: $(LONELY_TESTS_ML_FILES:%.ml=%.cmx) \
1435
1436
1437
           $(LONELY_TESTS_ML_FILES:%.ml=%.cmxs) \
           $(LONELY_TESTS_ML_FILES:%.ml=%.cmo) \
           $(LONELY_TESTS_ML_FILES:%.ml=%.cmi)
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452

bin/ocamldep_transitive_closure: devel_tools/ocamldep_transitive_closure.ml
	$(OCAMLOPT) -package ocamlgraph -package str -linkpkg -o $@ $<

tests/crowbar/.%.depend: tests/crowbar/%.ml
	$(OCAMLDEP) $(INCLUDES) $< > $@

tests/crowbar/%: tests/crowbar/%.ml tests/crowbar/.%.depend .depend \
                 bin/ocamldep_transitive_closure bin/toplevel.opt
	$(OCAMLOPT) $(OLINKFLAGS) -w -42 -package crowbar -o $@ \
        $(GEN_C_BINDINGS) \
        $$(bin/ocamldep_transitive_closure -root tests/crowbar/$*.cmx \
             -deps tests/crowbar/.$*.depend -deps .depend) \
        $<

1453
1454
1455
1456
tests/crowbar/full-link-%: tests/crowbar/%.ml lib/fc/frama-c.cmxa
	$(OCAMLOPT) $(OLINKFLAGS) -ccopt "-Llib/fc" -w -42 -package crowbar -o $@ \
	lib/fc/frama-c.cmxa $<

1457
1458
1459
1460
1461
crowbar-%: tests/crowbar/%
	$<

crowbar-afl-%: tests/crowbar/%
	$(MKDIR) tests/crowbar/output-$*
1462
	afl-fuzz $(AFL_OPTS) -i tests/crowbar/input -o tests/crowbar/output-$* $< @@
1463

1464
1465
1466
1467
1468
crowbar-afl-check-%: tests/crowbar/%
	$(foreach file,$(wildcard tests/crowbar/output-$*/crashes/id*), \
          $< $(file) >/dev/null 2>&1 || \
          echo "$(file) leads to a real test failure";)

1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
##############
# Emacs tags #
##############

.PHONY: tags
# otags gives a better tagging of ocaml files than etags
ifdef OTAGS
tags:
	$(OTAGS) -r src lib
vtags:
	$(OTAGS) -vi -r src lib
else
tags:
	find . -name "*.ml[ily]" -o -name "*.ml" | sort -r | xargs \
	etags "--regex=/[ \t]*let[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/[ \t]*let[ \t]+rec[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/[ \t]*and[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/[ \t]*type[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/[ \t]*exception[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/[ \t]*val[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/[ \t]*module[ \t]+\([^ \t]+\)/\1/"
endif

#################
# Documentation #
#################

.PHONY: doc doc-distrib

# private targets, useful for recompiling the doc without dependencies
# (too long!)
.PHONY: doc-kernel doc-index plugins-doc doc-update doc-tgz

DOC_DEPEND=$(MODULES_TODOC) byte $(DOC_PLUGIN)
ifneq ($(ENABLE_GUI),no)
DOC_DEPEND+=bin/viewer.byte$(EXE)
endif

$(DOC_DIR)/docgen.cmo: $(DOC_DIR)/docgen.ml
	$(PRINT_OCAMLC) $@
François Bobot's avatar
François Bobot committed
1509
	$(OCAMLC) -c -I +ocamldoc -I +compiler-libs -I $(CONFIG_DIR) $(DOC_DIR)/docgen.ml
1510
1511
1512

$(DOC_DIR)/docgen.cmxs: $(DOC_DIR)/docgen.ml
	$(PRINT_PACKING) $@
François Bobot's avatar
François Bobot committed
1513
	$(OCAMLOPT) -o $@ -shared -I +ocamldoc -I +compiler-libs -I $(CONFIG_DIR) \
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
	  $(DOC_DIR)/docgen.ml

clean-doc::
	$(PRINT_RM) "documentation generator"
	$(RM) $(DOC_DIR)/docgen.cm*

DOC_NOT_FOR_DISTRIB=yes
plugins-doc:
	$(QUIET_MAKE) \
	 $(if $(DOC_NOT_FOR_DISTRIB),$(PLUGIN_DOC_LIST),\
	   $(filter \
	     $(addsuffix _DOC,$(PLUGIN_DISTRIBUTED_NAME_LIST)),\
	     $(PLUGIN_DOC_LIST)))

.PHONY: server-doc-md server-doc-html server-doc

server-doc-md: byte
	$(PRINT) 'Generating Markdown server documentation'
	@rm -fr doc/server
	@mkdir -p doc/server
	./bin/frama-c.byte -server-doc doc/server

server-doc-html: server-doc-md
	$(PRINT) 'Generating HTML server documentation'
	@find doc/server -name "*.md" -print -exec pandoc \
			--standalone --toc --toc-depth=2 --to html \
			--template doc/pandoc/template.html \
			--metadata-file {}.json \
			--lua-filter doc/pandoc/href.lua \
			{} -o {}.html \;
	@cp -f doc/pandoc/style.css doc/server/
	$(PRINT) 'HTML server documentation ready:'
	$(PRINT) '  open doc/server/readme.md.html'

server-doc: server-doc-html

# to make the documentation for one plugin only,
# the name of the plugin should begin with a capital letter :
# Example for the pdg doc : make Pdg_DOC
# While working on the documentation of a plugin, it can also be useful
# to use : make -o doc/code/kernel-doc.ocamldoc Plugin_DOC
# to avoid redoing the global documentation each time.

STDLIB_FILES:=\
	array \
	buffer \
        bytes \
	char \
	format \
	hashtbl \
	int64 \
	list \
	map \
	marshal \
	obj \
        parsing \
	printf \
	queue \
	scanf \
	set \
	stack \
	string \
	sys \
1577
1578
	weak \
	ephemeron
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708

STDLIB_FILES:=$(patsubst %,$(OCAMLLIB)/%.mli,$(STDLIB_FILES))

.PHONY: doc-kernel
doc-kernel: $(DOC_DIR)/kernel-doc.ocamldoc

$(DOC_DIR)/kernel-doc.ocamldoc: $(DOC_DEPEND)
	$(PRINT_DOC) Kernel Documentation
	$(MKDIR) $(DOC_DIR)/html
	$(RM) $(DOC_DIR)/html/*.html
	$(OCAMLDOC) $(DOC_FLAGS) \
	  $(addprefix -passopt -stdlib ,$(STDLIB_FILES)) \
	  -t "Frama-C Kernel" \
	  -sort -css-style ../style.css \
	  -g $(DOC_PLUGIN) \
	  -d $(DOC_DIR)/html -dump $@ \
	  $(MODULES_TODOC); \
	  RES=$$?; \
	  if test $$RES -ne 0; then \
	    $(RM) $@; \
	    exit $$RES; \
	  fi

DYN_MLI_DIR := src/plugins/print_api

.PHONY: doc-dynamic
doc-dynamic: doc-kernel
	$(RM) $(DYN_MLI_DIR)/dynamic_plugins.mli
	./bin/frama-c.byte \
		-print_api $(call winpath,$(FRAMAC_ROOT_SRCDIR)/$(DYN_MLI_DIR))
	$(PRINT_DOC) Dynamically registered plugins Documentation
	$(MKDIR) $(DOC_DIR)/dynamic_plugins
	$(RM) $(DOC_DIR)/dynamic_plugins/*.html
	$(OCAMLDOC) $(DOC_FLAGS) -I $(FRAMAC_LIB) -I $(OCAMLLIB) \
	  -passopt -docpath $(DOC_DIR)/html \
	  -sort -css-style ../style.css \
	  -load $(DOC_DIR)/kernel-doc.ocamldoc \
	  -t " Dynamically registered plugins" \
	  -g $(DOC_PLUGIN) \
	  -d $(DOC_DIR)/dynamic_plugins \
	  $(DYN_MLI_DIR)/dynamic_plugins.mli
	$(ECHO) '<li><a href="dynamic_plugins/Dynamic_plugins.html">Dynamically registered plugins</a </li>' > $(DOC_DIR)/dynamic_plugins.toc

doc-index: doc-kernel doc-dynamic plugins-doc
	$(PRINT_MAKING) doc/code/index.html
	$(CAT)  $(DOC_DIR)/toc_head.htm $(DOC_DIR)/*.toc \
		$(DOC_DIR)/toc_tail.htm > $(DOC_DIR)/index.html

doc-update: doc-kernel doc-dynamic plugins-doc doc-index

doc:: doc-kernel doc-dynamic plugins-doc doc-index

doc-kernel doc-dynamic plugins-doc doc-index: $(DOC_DEPEND)

doc-tgz:
	$(PRINT_MAKING) frama-c-api.tar.gz
	cd $(DOC_DIR); \
	  $(TAR) zcf tmp.tgz index.html *.txt \
	   $(notdir $(wildcard $(DOC_DIR)/*.css $(DOC_DIR)/*.png \
			       $(DOC_DIR)/dynamic_plugins*)) \
	   html \
	   $(foreach p,$(PLUGIN_DISTRIBUTED_NAME_LIST),\
	     $(notdir $($(p)_DOC_DIR)))
	$(MKDIR) frama-c-api
	$(RM) -r frama-c-api/*
	cd frama-c-api; $(TAR) zxf ../$(DOC_DIR)/tmp.tgz
	$(TAR) zcf frama-c-api.tar.gz frama-c-api
	$(RM) -r frama-c-api $(DOC_DIR)/tmp.tgz

doc-distrib:
	$(QUIET_MAKE) clean-doc
	$(QUIET_MAKE) doc DOC_NOT_FOR_DISTRIB=
	$(QUIET_MAKE) doc-tgz

#find src -name "*.ml[i]" -o -name "*.ml" -maxdepth 3 | sort -r | xargs
dots: $(ALL_CMO)
	$(PRINT_DOC) callgraph
	$(OCAMLDOC) $(DOC_FLAGS) $(INCLUDES) -o doc/call_graph.dot \
	  -dot -dot-include-all -dot-reduce $(MODULES_TODOC)
	$(QUIET_MAKE) doc/call_graph.svg
	$(QUIET_MAKE) doc/call_graph.ps

# pandoc is required to regenerate the manpage
man/frama-c.1: man/frama-c.1.header man/frama-c.1.md
	$(PRINT) 'generating $@'
	$(RM) $@
	pandoc -s -t man -H $^ | tail -n +5 > man/frama-c.1
	$(CHMOD_RO) $@

# Checking consistency with the current implementation
######################################################

DOC_DEV_DIR = doc/developer
CHECK_API_DIR=$(DOC_DEV_DIR)/check_api

$(CHECK_API_DIR)/check_code.cmo: $(CHECK_API_DIR)/check_code.ml
	$(PRINT_OCAMLC) $@
	$(OCAMLC) -c -I +ocamldoc str.cma $(CHECK_API_DIR)/check_code.ml

$(CHECK_API_DIR)/check_code.cmxs: $(CHECK_API_DIR)/check_code.ml
	$(PRINT_PACKING) $@
	$(OCAMLOPT) -o $@ -shared -I +ocamldoc \
		str.cmxa $(CHECK_API_DIR)/check_code.ml

CHECK_CODE=$(CHECK_API_DIR)/check_code.cmxs

.PHONY: check-devguide
check-devguide: $(CHECK_CODE) $(DOC_DEPEND) $(DOC_DIR)/kernel-doc.ocamldoc
	$(PRINT) 'Checking     developer guide consistency'
	$(MKDIR) $(CHECK_API_DIR)/html
	$(OCAMLDOC) $(DOC_FLAGS) -I $(OCAMLLIB) \
	  -g $(CHECK_CODE) \
	  -passopt -docdevpath -passopt "`pwd`/$(CHECK_API_DIR)" \
	  -load $(DOC_DIR)/kernel-doc.ocamldoc \
	  -d $(CHECK_API_DIR)/html
	$(RM) -r  $(CHECK_API_DIR)/html
	$(MAKE) --silent -C $(CHECK_API_DIR) main.idx
	$(MAKE) --silent -C $(CHECK_API_DIR) >$(CHECK_API_DIR)/summary.txt
	$(ECHO) see all the information displayed here \
		in $(CHECK_API_DIR)/summary.txt
	$(RM) code_file
################################
# Code prettyfication and lint #
################################

# We're interested by any .ml[i]? file in src, except for scripts in test
# directories, and generated files (in particular lexers and parsers)
# Note: the find command below is *very* ugly, but it should be POSIX-compliant.

ALL_ML_FILES:=$(shell find src -name '*.ml' -print -o -name '*.mli' -print -o -path '*/tests' -prune '!' -name '*')
1709
ALL_ML_FILES+=ptests/ptests.ml
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
MANUAL_ML_FILES:=$(filter-out $(GENERATED) $(PLUGIN_GENERATED_LIST), $(ALL_ML_FILES))

# Allow control of files to be linted/fixed by external sources
# (e.g. pre-commit hook that will concentrate on files which have changed)

sinclude .Makefile.lint

HAS_GIT_FILE:=$(wildcard .git/HEAD)

ifeq ("$(HAS_GIT_FILE)","")
LINT_OTHER_SOURCES:=
else
LINT_OTHER_SOURCES:=\
  $(filter-out \
    $(shell git ls-tree --name-only HEAD src/plugins/*), \
    $(wildcard src/plugins/*))
endif

$(foreach dir,$(LINT_OTHER_SOURCES),$(eval sinclude $(dir)/.Makefile.lint))

ML_LINT_MISSING:=$(filter-out $(MANUAL_ML_FILES), $(ML_LINT_KO))

# By default, also checks files with unknown status:
# this requires new files to pass lint checker from the beginning

ML_LINT_CHECK?=$(filter-out $(ML_LINT_KO), $(MANUAL_ML_FILES))

# this NEWLINE variable containing a literal newline character is used to avoid
# the error "argument list too long", in some instances of "foreach".
# For details, see https://stackoverflow.com/questions/7039811
define NEWLINE


endef

# pre-requisite intentionally left blank: this target should only be used
# if the file is not present to generate it once and forall,
# and be edited manually afterwards
# double colon here tells make not to attempt updating the .Makefile.lint
# if it does not exist, but just to ignore it.
.Makefile.lint::
	echo "ML_LINT_KO:=" >> $@
	$(foreach file,$(sort $(MANUAL_ML_FILES)), \
            if ! $(MAKE) ML_LINT_CHECK=$(file) lint; \
            then echo "ML_LINT_KO+=$(file)" >> $@; fi;$(NEWLINE) )

$(foreach dir,$(LINT_OTHER_SOURCES),\
  $(eval $(dir)/.Makefile.lint:: ; \
     $(foreach file, $(sort $(filter $(dir)/%, $(MANUAL_ML_FILES))), \
            if ! $$(MAKE) ML_LINT_CHECK=$(file) lint; \
            then echo "ML_LINT_KO+=$(file)" >> $$@; fi; )))

.PHONY: stats-lint
stats-lint:
	echo \
         "scale = 2; bad = $(words $(ML_LINT_MISSING)); \
          all = $(words $(sort $(MANUAL_ML_FILES))); \
	  fail = $(words $(ML_LINT_KO)); \
          \"lint coverage: \"; \
          ((all - fail) * 100) / all; " | bc
	echo "number of files supposed to pass lint: $(words $(ML_LINT_CHECK))"
	echo "number of files supposed to fail lint: $(words $(ML_LINT_KO))"
ifneq ($(strip $(ML_LINT_MISSING)),)
	echo "number of files missing from src/ : $(words $(ML_LINT_MISSING))"
	$(foreach file, $(ML_LINT_MISSING), echo $(file);)
	exit 1
endif

INDENT_TARGET= $(patsubst %,%.indent,$(ML_LINT_CHECK))

LINT_TARGET= $(patsubst %,%.lint,$(ML_LINT_CHECK))

FIX_SYNTAX_TARGET=$(patsubst %,%.fix-syntax,$(ML_LINT_CHECK))

.PHONY: $(INDENT_TARGET) $(LINT_TARGET) $(FIX_SYNTAX_TARGET) \
        indent lint fix-syntax

indent: $(INDENT_TARGET)

lint: $(LINT_TARGET)

1791
1792
check-ocp-indent-version:
	if command -v ocp-indent >/dev/null; then \
1793
1794
1795
1796
1797
1798
		if [ -z "$(shell ocp-indent --version)" ]; then echo "warning: ocp-indent returned an empty string, assuming it is the correct version"; \
		else \
			$(eval ocp_version_major := $(shell ocp-indent --version | $(SED) -E "s/^([0-9]+)\.[0-9]+\..*/\1/")) \
			$(eval ocp_version_minor := $(shell ocp-indent --version | $(SED) -E "s/^[0-9]+\.([0-9]+)\..*/\1/")) \
			if [ "$(ocp_version_major)" -lt 1 -o "$(ocp_version_minor)" -lt 7 ]; then \
				echo "error: ocp-indent 1.7.0 required for linting (got $(ocp_version_major).$(ocp_version_minor))"; \
1799
			exit 1; \
1800
			fi; \
1801
1802
1803
1804
1805
		fi; \
	else \
		exit 1; \
	fi;

1806
1807
fix-syntax: $(FIX_SYNTAX_TARGET)

1808
$(INDENT_TARGET): %.indent: % check-ocp-indent-version
1809
1810
	ocp-indent -i $<

1811
$(LINT_TARGET): %.lint: % check-ocp-indent-version
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
	# See SO 1825552 on mixing grep and \t (and cry)
	# For OK_NL, we have three cases:
	# - for empty files, the computation boils down to 0 - 0 == 0
	# - for non-empty files with a proper \n at the end, to 1 - 1 == 0
	# - for empty files without \n, to 1 - 0 == 1 that will be catched
	OK_TAB=$$(grep -c -e "$$(printf '^ *\t')" $<) ; \
        OK_SPACE=$$(grep -c -e '[[:blank:]]$$' $<) ; \
        OK_NL=$$(($$(tail -c -1 $< | wc -c) - $$(tail -n -1 $< | wc -l))) ; \
        OK_EMPTY=$$(tail -n -1 $< | grep -c -e '^[[:blank:]]*$$') ; \
        ERROR=$$(($$OK_TAB + $$OK_SPACE + $$OK_NL + $$OK_EMPTY)) ; \
        if test $$ERROR -gt 0; then \
          echo "File $< does not pass syntactic checks:"; \
          echo "$$OK_TAB lines indented with tabulation instead of spaces"; \
          echo "$$OK_SPACE lines with spaces at end of line"; \
          test $$OK_NL -eq 0 || echo "No newline at end of file"; \
          test $$OK_EMPTY -eq 0 || echo "Empty line(s) at end of file"; \
          echo "Please run make ML_LINT_CHECK=$< fix-syntax"; \
          exit 1 ; \
        fi
	ocp-indent $< > $<.tmp;
	if cmp -s $< $<.tmp; \
        then rm -f $<.tmp; \
        else \
          echo "File $< is not indented correctly."; \
          echo "Please run make ML_LINT_CHECK=$< indent";\
          rm $<.tmp; \
          exit 1; \
        fi

$(FIX_SYNTAX_TARGET): %.fix-syntax: %
	$(ISED) -e 's/^ *\t\+/ /' $<
	$(ISED) -e 's/\(.*[^[:blank:]]\)[[:blank:]]\+$$/\1/' $<
	$(ISED) -e 's/^[ \t]\+$$//' $<
	if test \( $$(tail -n -1 $< | wc -l) -eq 0 \) -a \( $$(wc -c $< | cut -d " " -f 1) -gt 0 \) ; then \
          echo "" >> $<; \
        else \
          while tail -n -1 $< | grep -l -e '^[ \t]*$$'; do \
            head -n -1 $< > $<.tmp; \
            mv $<.tmp $<; \
          done; \
        fi

# Avoid a UTF-8 locale at all cost: in such setting, sed does not work
# reliably if you happen to have latin-1 encoding somewhere,
# which is still unfortunately the case in some dark corners of the platform
%.fix-syntax: LC_ALL = C

################
# Installation #
################

#       line below does not work if INCLUDES contains twice the same directory
#       Do not attempt to copy gui interfaces if gui is disabled
#Byte
ALL_BATCH_CMO_FIXED=$(filter-out src/kernel_internals/runtime/gui_init.cmo,$(CMO) $(STARTUP_CMO))
LIB_BYTE_TO_INSTALL=\
	$(MLI_ONLY:.mli=.cmi) \
	$(ALL_BATCH_CMO_FIXED:.cmo=.cmi) \
	$(ALL_BATCH_CMO_FIXED) \
	$(filter-out %.o,$(GEN_BYTE_LIBS:.cmo=.cmi)) \
	$(GEN_BYTE_LIBS)

#Byte GUI
ifneq ("$(ENABLE_GUI)","no")
LIB_BYTE_TO_INSTALL+=$(SINGLE_GUI_CMI) $(SINGLE_GUI_CMO)
endif

#Opt
ifeq ("$(OCAMLBEST)","opt")
ALL_BATCH_CMX_FIXED= $(filter-out src/kernel_internals/runtime/gui_init.cmx,\
	$(CMX) $(STARTUP_CMX))
LIB_OPT_TO_INSTALL +=\
	$(ALL_BATCH_CMX) \
	$(filter %.a,$(ALL_BATCH_CMX_FIXED:.cmxa=.a)) \
	$(filter %.o,$(ALL_BATCH_CMX_FIXED:.cmx=.o)) \
	$(filter-out %.o,$(GEN_OPT_LIBS)) \
	$(filter-out $(GEN_BYTE_LIBS),$(filter %.o,$(GEN_OPT_LIBS:.cmx=.o)))

#Opt GUI
ifneq ("$(ENABLE_GUI)","no")
LIB_OPT_TO_INSTALL += $(SINGLE_GUI_CMX) $(SINGLE_GUI_CMX:.cmx=.o)
endif

endif

clean-install:
	$(PRINT_RM) "Installation directory"
	$(RM) -r $(FRAMAC_LIBDIR)

1901
install-lib-byte: clean-install
1902
1903
	$(PRINT_INSTALL) kernel API
	$(MKDIR) $(FRAMAC_LIBDIR)
1904
	$(CP) $(LIB_BYTE_TO_INSTALL) $(FRAMAC_LIBDIR)
1905
	$(CP) $(addprefix lib/fc/,dllframa-c$(DLLEXT) libframa-c.a frama-c.cma META.frama-c) $(FRAMAC_LIBDIR)
1906
1907
1908
1909

install-lib-opt: install-lib-byte
	$(CP) $(LIB_OPT_TO_INSTALL) $(FRAMAC_LIBDIR)
	$(CP) $(addprefix lib/fc/,frama-c.a frama-c.cmxa) $(FRAMAC_LIBDIR)
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920

install-doc-code:
	$(PRINT_INSTALL) API documentation
	$(MKDIR) $(FRAMAC_DATADIR)/doc/code
	(cd doc ; tar cf - --exclude='.svn' --exclude='*.toc' \
			--exclude='*.htm' --exclude='*.txt' \
			--exclude='*.ml' \
			code \
		| (cd $(FRAMAC_DATADIR)/doc ; tar xf -))

.PHONY: install
1921
install:: install-lib-$(OCAMLBEST)
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
	$(PRINT_MAKING) destination directories
	$(MKDIR) $(BINDIR)
	$(MKDIR) $(MANDIR)/man1
	$(MKDIR) $(FRAMAC_PLUGINDIR)/top
	$(MKDIR) $(FRAMAC_PLUGINDIR)/gui
	$(MKDIR) $(FRAMAC_DATADIR)/theme/default
	$(MKDIR) $(FRAMAC_DATADIR)/theme/colorblind
	$(MKDIR) $(FRAMAC_DATADIR)/theme/flat
	$(MKDIR) $(FRAMAC_DATADIR)/libc/sys
	$(MKDIR) $(FRAMAC_DATADIR)/libc/netinet
	$(MKDIR) $(FRAMAC_DATADIR)/libc/net
	$(MKDIR) $(FRAMAC_DATADIR)/libc/arpa
	$(PRINT_INSTALL) shared files
	$(CP) \
	  $(wildcard share/*.c share/*.h) \
	  share/Makefile.dynamic share/Makefile.plugin.template \
	  share/Makefile.config share/Makefile.common share/Makefile.generic \
	  share/configure.ac share/autocomplete_frama-c share/_frama-c \
	  $(FRAMAC_DATADIR)
	$(MKDIR) $(FRAMAC_DATADIR)/analysis-scripts
1942
1943
1944
	$(CP) \
	  share/analysis-scripts/analysis.mk \
	  share/analysis-scripts/benchmark_database.py \
1945
	  share/analysis-scripts/cmd-dep.sh \
1946
	  share/analysis-scripts/concat-csv.sh \
1947
	  share/analysis-scripts/clone.sh \
1948
	  share/analysis-scripts/creduce.sh \
1949
	  share/analysis-scripts/epilogue.mk \
1950
	  share/analysis-scripts/fc_stubs.c \
1951
	  share/analysis-scripts/find_fun.py \
1952
	  share/analysis-scripts/flamegraph.pl \
1953
	  share/analysis-scripts/frama_c_results.py \
1954
	  share/analysis-scripts/function_finder.py \
1955
1956
	  share/analysis-scripts/git_utils.py \
	  share/analysis-scripts/list_files.py \
1957
	  share/analysis-scripts/make_template.py \
1958
	  share/analysis-scripts/make_wrapper.py \
1959
	  share/analysis-scripts/normalize_jcdb.py \
1960
	  share/analysis-scripts/parse-coverage.sh \
1961
	  share/analysis-scripts/prologue.mk \
1962
	  share/analysis-scripts/README.md \
1963
1964
	  share/analysis-scripts/results_display.py \
	  share/analysis-scripts/summary.py \
1965
1966
	  share/analysis-scripts/template.mk \
	  $(FRAMAC_DATADIR)/analysis-scripts
1967
1968
1969
1970
1971
1972
	$(MKDIR) $(FRAMAC_DATADIR)/compliance
	$(CP) share/compliance/c11_functions.json \
	  share/compliance/glibc_functions.json \
	  share/compliance/nonstandard_identifiers.json \
	  share/compliance/posix_identifiers.json \
	  $(FRAMAC_DATADIR)/compliance
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
	$(MKDIR) $(FRAMAC_DATADIR)/emacs
	$(CP) $(wildcard share/emacs/*.el) $(FRAMAC_DATADIR)/emacs
	$(CP) share/frama-c.rc $(ICONS) $(FRAMAC_DATADIR)
	$(CP) $(THEME_ICONS_DEFAULT) $(FRAMAC_DATADIR)/theme/default
	$(CP) $(THEME_ICONS_COLORBLIND) $(FRAMAC_DATADIR)/theme/colorblind
	$(CP) $(THEME_ICONS_FLAT) $(FRAMAC_DATADIR)/theme/flat
	if [ -d $(EMACS_DATADIR) ]; then \
	  $(CP) $(wildcard share/emacs/*.el) $(EMACS_DATADIR); \
	fi
	$(CP) share/Makefile.dynamic_config.external \
	      $(FRAMAC_DATADIR)/Makefile.dynamic_config
	$(PRINT_INSTALL) C standard library
	$(CP) $(wildcard share/libc/*.c share/libc/*.i share/libc/*.h) \
	      $(FRAMAC_DATADIR)/libc
	$(CP) share/libc/sys/*.[ch] $(FRAMAC_DATADIR)/libc/sys
	$(CP) share/libc/arpa/*.[ch] $(FRAMAC_DATADIR)/libc/arpa
	$(CP) share/libc/net/*.[ch] $(FRAMAC_DATADIR)/libc/net
	$(CP) share/libc/netinet/*.[ch] $(FRAMAC_DATADIR)/libc/netinet
	$(PRINT_INSTALL) binaries
	$(CP) bin/toplevel.$(OCAMLBEST) $(BINDIR)/frama-c$(EXE)
	$(CP) bin/toplevel.byte$(EXE) $(BINDIR)/frama-c.byte$(EXE)
	if [ -x bin/toplevel.top ] ; then \
	  $(CP) bin/toplevel.top $(BINDIR)/frama-c.toplevel$(EXE); \
	fi
	if [ -x bin/viewer.$(OCAMLBEST) ] ; then \
	  $(CP) bin/viewer.$(OCAMLBEST) $(BINDIR)/frama-c-gui$(EXE);\
	fi
	if [ -x bin/viewer.byte$(EXE) ] ; then \
	  $(CP) bin/viewer.byte$(EXE) $(BINDIR)/frama-c-gui.byte$(EXE); \
	fi
2003
2004
	$(CP) bin/ptests.$(OCAMLBEST)$(EXE) \
	      $(BINDIR)/ptests.$(OCAMLBEST)$(EXE)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017