Debian Codegraph @

share/Makefile.generic

raw
1 ##########################################################################
2 # #
3 # This file is part of Frama-C. #
4 # #
5 # Copyright (C) 2007-2022 #
6 # CEA (Commissariat à l'énergie atomique et aux énergies #
7 # alternatives) #
8 # #
9 # you can redistribute it and/or modify it under the terms of the GNU #
10 # Lesser General Public License as published by the Free Software #
11 # Foundation, version 2.1. #
12 # #
13 # It is distributed in the hope that it will be useful, #
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
16 # GNU Lesser General Public License for more details. #
17 # #
18 # See the GNU Lesser General Public License version 2.1 #
19 # for more details (enclosed in the file licenses/LGPLv2.1). #
20 # #
21 ##########################################################################
22
23 .DEFAULT_GOAL=all
24
25 ifndef SUFFIXES_ARE_SET
26
27 SUFFIXES_ARE_SET:=true
28
29 # The former .SUFFIXES delete all predefined implicit rules
30 # The latter .SUFFIXES defines our suffix list
31 # See GNU Make manual, section 10.7
32 # This way of declaring implicit rules is deprecated,
33 # but that is the only way for removing **all** predefined implicit rules
34 # The only other way is to remove each predefined implicit rule, one by one.
35 .SUFFIXES:
36 .SUFFIXES: .c .o .mli .ml .cmi .cmo .cmx .mll .mly .tex .dvi .ps .html .cmxs \
37 .png .svg .ps
38
39 ifdef DOT
40 %.png: %.dot
41 $(PRINT_DOT) $@
42 $(DOT) -Tpng -o $@ $<
43
44 %.svg: %.dot
45 $(PRINT_DOT) $@
46 $(ISED) -e "s/\(digraph .*\)/\1 node [href=\"\\\\N.html\"];/" $<
47 $(DOT) -Tsvg -o $@ $<
48
49 %.ps: %.dot
50 $(PRINT_DOT) $@
51 $(DOT) -Tps -o $@ $<
52 %.pdf: %.dot
53 $(PRINT_DOT) $@
54 $(DOT) -Tpdf -o $@ $<
55
56 else
57 %.png: %.dot
58 @$(ECHO) "dot missing: generation of $@ skipped."
59 %.svg: %.dot
60 @$(ECHO) "dot missing: generation of $@ skipped."
61 %.ps: %.dot
62 @$(ECHO) "dot missing: generation of $@ skipped."
63 endif
64
65 # the two rules below are used for .cmi. The first one will be preferred
66 # by make when a .mli exists (see GNU Make manual 10.5.4), the second is a
67 # fallback for mli-less (boo) source files.
68
69 %.cmi: %.mli
70 $(PRINT_OCAMLC) $@
71 $(OCAMLC) -c $(BFLAGS) $<
72
73 %.cmi: %.cmo
74 $(TOUCH) $@
75
76 %.cmo: %.ml
77 $(PRINT_OCAMLC) $@
78 $(OCAMLC) -c $(BFLAGS) $<
79
80 %.inferred.mli: %.ml
81 $(PRINT_INFERRING) $@
82 $(OCAMLC) -i $(BFLAGS) $< > $@
83
84 # Using the technique of intf-suffix given by Alain Frisch in
85 # http://caml.inria.fr/mantis/view.php?id=4991
86 # forces ocamlopt to not create a new cmi.
87 %.cmx: %.ml %.cmi
88 $(PRINT_OCAMLOPT) $@
89 $(OCAMLOPT) -intf-suffix .cmi -c $(OFLAGS) $<
90
91 # So we can define specific variables that are not inherited
92 # Cf. GNU Make manual, Section 6.12 Pattern-specific Variable Values
93 %.cmx: OFLAGS:=$(OFLAGS)
94
95 # .o are generated together with .cmx, but %.o %.cmx: %.ml only confuses
96 # make when computing dependencies...
97 %.o: %.cmx
98 $(TOUCH) $@
99
100 %.cmxs: %.cmx
101 $(PRINT_PACKING) $@
102 $(OCAMLOPT) -shared -o $@ $(OFLAGS) $<
103
104 .mll.ml:
105 $(PRINT_OCAMLLEX) $@
106 $(RM) $@
107 $(OCAMLLEX) $<
108 $(CHMOD_RO) $@
109
110 %.mli %.ml: %.mly
111 $(PRINT_OCAMLYACC) $@
112 $(RM) $(<:.mly=.ml) $(<:.mly=.mli)
113 $(OCAMLYACC) -v $<
114 $(CHMOD_RO) $(<:.mly=.ml) $(<:.mly=.mli)
115
116 .tex.dvi:
117 $(PRINT_LATEX) $@
118 latex $< && latex $<
119
120 .dvi.ps:
121 $(PRINT_DVIPS) $@
122 dvips $< -o $@
123
124 .tex.html:
125 $(PRINT_HEVEA) $@
126 hevea $<
127
128 .c.o:
129 $(PRINT_OCAMLC) $@
130 $(OCAMLC) $(BFLAGS) -ccopt "-o $@" $<
131
132 endif
133
134
135 ##########################################################################
136 # Local Variables:
137 # mode: makefile
138 # End: