-
Notifications
You must be signed in to change notification settings - Fork 233
/
.common.mk
63 lines (54 loc) · 2.02 KB
/
.common.mk
1
2
3
4
5
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
55
56
57
58
59
60
61
62
63
# This makefile is included from several other makefiles in the tree.
# It enables configurably 'silent' rules, that do not
# print output unless V=1 is set. When writing a rule, you can do as
# follows (taken from src/Makefile.boot):
#
# ocaml-output/%.ml:
# $(call msg, "EXTRACT", $(notdir $@))
# $(Q)$(BENCHMARK_PRE) $(FSTAR_C) $(SIL) $(notdir $(subst .checked.lax,,$<)) \
# --codegen OCaml \
# --extract_module $(basename $(notdir $(subst .checked.lax,,$<)))
#
# This unconditionally prints a message like '[EXTRACT FStar_Syntax_Subst.ml]'
# (`notdir` is used to omit the directory of the target) and then
# proceeds to execute the F* invocation silently (since $(Q) expands to
# "@"). However, calling the same rule with `make V=1` will still print
# the message and then print the F* invocation before executing.
#
# Besides that, when not using V=1, F* receives the --silent flag to
# reduce non-critical output.
# It also defines some other utilities for resource monitoring and
# paths manipulation for cygwin
Q?=@
SIL?=--silent
RUNLIM=
ifneq ($(V),)
Q=
SIL=
endif
define NO_RUNLIM_ERR
runlim not found:
To use RESOURCEMONITOR=1, the `runlim` tool must be installed and in your $$PATH.
It must also be a recent version supporting the `-p` option.
You can get it from: [https://github.com/arminbiere/runlim]
endef
define msg =
@printf " %-8s %s\n" $(1) $(2)
endef
# Passing RESOURCEMONITOR=1 will create .runlim files through the source tree with
# information about the time and space taken by each F* invocation.
ifneq ($(RESOURCEMONITOR),)
ifeq ($(shell which runlim),)
_ := $(error $(NO_RUNLIM_ERR)))
endif
ifneq ($(MONID),)
MONPREFIX=$(MONID).
endif
RUNLIM=runlim -p -o $@.$(MONPREFIX)runlim
endif
# Can be called as $(call maybe_cygwin_path,...)
# where ... is the argument
maybe_cygwin_path=$(if $(findstring $(OS),Windows_NT),$(shell cygpath -m $(1)),$(1))
# Ensure that any failing rule will not create its target file.
# In other words, make `make` less insane.
.DELETE_ON_ERROR: