Commit | Line | Data |
---|---|---|
174d1640 C |
1 | ############################################################################## |
2 | # Variables | |
3 | ############################################################################## | |
4 | #TARGET=cocciocaml | |
5 | -include ../Makefile.config | |
6 | ||
7 | TARGET=cocciocaml | |
8 | ||
9 | SRC=coccilib.ml ocamlcocci_aux.ml prepare_ocamlcocci.ml run_ocamlcocci.ml | |
10 | ||
11 | #LIBS=../commons/commons.cma ../parsing_c/parsing_c.cma | |
12 | #INCLUDES= -I ../commons -I ../parsing_c | |
13 | INCLUDES = -I ../commons -I ../commons/ocamlextra -I ../globals \ | |
14 | -I ../parsing_cocci -I ../parsing_c | |
15 | LIBS=../commons/commons.cma ../globals/globals.cma \ | |
16 | ../parsing_c/parsing_c.cma ../parsing_cocci/cocci_parser.cma | |
17 | ||
18 | SYSLIBS= str.cma unix.cma | |
19 | ||
20 | ############################################################################## | |
21 | # Generic variables | |
22 | ############################################################################## | |
23 | ||
24 | #for warning: -w A | |
25 | #for profiling: -p -inline 0 with OCAMLOPT | |
26 | OCAMLCFLAGS ?= -g -dtypes | |
27 | ||
28 | OCAMLC=ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES) | |
29 | OCAMLOPT=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES) | |
30 | OCAMLLEX=ocamllex$(OPTBIN) #-ml | |
31 | OCAMLYACC=ocamlyacc -v | |
32 | OCAMLDEP=ocamldep$(OPTBIN) $(INCLUDES) | |
33 | OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES) | |
34 | ||
35 | ||
36 | OBJS = $(SRC:.ml=.cmo) | |
37 | OPTOBJS = $(SRC:.ml=.cmx) | |
38 | ||
39 | ||
40 | ############################################################################## | |
41 | # Top rules | |
42 | ############################################################################## | |
43 | all: $(TARGET).cma | |
44 | all.opt: $(TARGET).cmxa | |
45 | ||
46 | $(TARGET).cma: $(OBJS) | |
47 | $(OCAMLC) -a -o $(TARGET).cma $(OBJS) | |
48 | ||
49 | $(TARGET).cmxa: $(OPTOBJS) $(LIBS:.cma=.cmxa) | |
50 | $(OCAMLOPT) -a -o $(TARGET).cmxa $(OPTOBJS) | |
51 | ||
52 | $(TARGET).top: $(OBJS) $(LIBS) | |
53 | $(OCAMLMKTOP) -o $(TARGET).top $(SYSLIBS) $(LIBS) $(OBJS) | |
54 | ||
55 | clean:: | |
56 | rm -f $(TARGET).top | |
57 | ||
58 | ||
59 | ||
60 | ############################################################################## | |
61 | # Pad's rules | |
62 | ############################################################################## | |
63 | ||
64 | ############################################################################## | |
65 | # Generic rules | |
66 | ############################################################################## | |
67 | ||
68 | .SUFFIXES: .ml .mli .cmo .cmi .cmx | |
69 | ||
70 | .ml.cmo: | |
71 | $(OCAMLC) -c $< | |
72 | .mli.cmi: | |
73 | $(OCAMLC) -c $< | |
74 | .ml.cmx: | |
75 | $(OCAMLOPT) -c $< | |
76 | ||
77 | .ml.mldepend: | |
78 | $(OCAMLC) -i $< | |
79 | ||
80 | clean:: | |
81 | rm -f *.cm[ioxa] *.o *.a *.cmxa *.annot | |
82 | rm -f *~ .*~ gmon.out #*# | |
83 | ||
84 | distclean:: | |
85 | rm -f .depend | |
86 | ||
87 | beforedepend:: | |
88 | ||
89 | depend:: beforedepend | |
90 | $(OCAMLDEP) *.mli *.ml > .depend | |
91 | ||
92 | -include .depend |