Commit | Line | Data |
---|---|---|
34e49164 C |
1 | ############################################################################# |
2 | # Configuration section | |
3 | ############################################################################# | |
4 | -include ../Makefile.config | |
5 | ||
6 | ############################################################################## | |
7 | # Variables | |
8 | ############################################################################## | |
9 | TARGET=coccipython | |
10 | ||
b1b2de81 | 11 | SOURCES= pycocci_aux.ml pycocci.ml |
34e49164 C |
12 | |
13 | INCLUDEDIRS = ../commons ../commons/ocamlextra ../globals ../pycaml \ | |
14 | ../parsing_c ../parsing_cocci | |
15 | ||
16 | SYSLIBS = str.cma unix.cma | |
b1b2de81 | 17 | LIBS=../commons/commons.cma ../globals/globals.cma |
34e49164 C |
18 | |
19 | # ../ctl/ctl.cma \ | |
b1b2de81 C |
20 | # ../parsing_c/c_parser.cma ../parsing_cocci/cocci_parser.cma |
21 | #pycaml/pycaml.cma | |
34e49164 C |
22 | |
23 | ||
24 | ############################################################################## | |
25 | # Generic variables | |
26 | ############################################################################## | |
27 | ||
28 | INCLUDES=$(INCLUDEDIRS:%=-I %) $(INCLUDESEXTRA) | |
29 | ||
30 | ############################################################################## | |
31 | # Generic ocaml variables | |
32 | ############################################################################## | |
33 | ||
34 | # The Caml compilers. | |
35 | OCAMLCFLAGS ?= -g -dtypes | |
36 | OCAMLC =ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES) | |
37 | OCAMLOPT = ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES) | |
0708f913 | 38 | OCAMLDEP = ocamldep$(OPTBIN) $(INCLUDES) |
34e49164 C |
39 | |
40 | ||
41 | ############################################################################## | |
42 | # Top rules | |
43 | ############################################################################## | |
44 | ||
45 | EXEC=$(TARGET).byte | |
46 | LIB=$(TARGET).cma | |
47 | OPTLIB=$(LIB:.cma=.cmxa) | |
48 | ||
49 | CTLEXEC=$(CTLTARGET) | |
50 | ||
51 | OBJS = $(SOURCES:.ml=.cmo) | |
52 | OPTOBJS = $(OBJS:.cmo=.cmx) | |
53 | ||
54 | CTLOBJS = $(CTLSOURCES:.ml=.cmo) | |
55 | CTLOPTOBJS = $(CTLOBJS:.cmo=.cmx) | |
56 | ||
57 | ||
58 | #all: $(EXEC) $(LIB) | |
59 | all: $(LIB) | |
60 | ||
61 | all.opt: $(OPTLIB) | |
62 | ||
63 | ctl: $(CTLEXEC) | |
64 | ||
65 | ||
66 | $(LIB): $(OBJS) | |
67 | $(OCAMLC) -a -o $(LIB) $(OBJS) | |
68 | ||
69 | clean:: | |
70 | rm -f $(LIB) | |
71 | ||
72 | ||
b1b2de81 | 73 | $(OPTLIB): $(OPTOBJS) |
34e49164 C |
74 | $(OCAMLOPT) -a -o $(OPTLIB) $(OPTOBJS) |
75 | ||
76 | ||
77 | $(EXEC): $(OBJS) main.cmo $(LIBS) | |
78 | $(OCAMLC) -o $(EXEC) $(SYSLIBS) $(LIBS) $(OBJS) main.cmo | |
79 | ||
80 | $(CTLEXEC): $(CTLOBJS) $(LIBS) | |
81 | $(OCAMLC) -o $(CTLEXEC) $(SYSLIBS) $(LIBS) $(CTLOBJS) | |
82 | ||
83 | ||
84 | clean:: | |
b1b2de81 | 85 | rm -f $(OPTLIB) $(LIB:.cma=.a) |
34e49164 C |
86 | rm -f $(TARGET) rm -f $(TARGET).byte |
87 | rm -f $(CTLTARGET) | |
88 | ||
89 | ||
90 | #pycocci.ml: ../pycaml/pycaml.ml ../pycaml/pycaml_ml.c | |
91 | #pycocci_aux.ml: ../pycaml/pycaml.ml ../pycaml/pycaml_ml.c | |
b1b2de81 C |
92 | pycocci_aux.ml: |
93 | @echo "\n\n\t*** pycocci_aux.ml not found ! ***\n\n\tRun 'configure && make depend' first.\n\n" | |
34e49164 C |
94 | |
95 | rmlinks: | |
96 | rm -f pycocci.ml pycocci_aux.ml | |
97 | ||
98 | ############################################################################## | |
99 | # Generic ocaml rules | |
100 | ############################################################################## | |
101 | ||
102 | .SUFFIXES: | |
103 | .SUFFIXES: .ml .mli .cmo .cmi .cmx | |
104 | ||
105 | .ml.cmo: | |
106 | $(OCAMLC) -c $< | |
107 | ||
108 | .mli.cmi: | |
109 | $(OCAMLC) -c $< | |
110 | ||
111 | .ml.cmx: | |
112 | $(OCAMLOPT) -c $< | |
113 | ||
114 | ||
115 | # clean rule for others files | |
116 | clean:: | |
117 | rm -f *.cm[iox] *.o *.annot | |
b1b2de81 C |
118 | rm -f *~ .*~ #*# |
119 | ||
120 | distclean:: | |
121 | rm -f .depend | |
34e49164 C |
122 | |
123 | beforedepend: | |
124 | ||
125 | depend: beforedepend | |
126 | $(OCAMLDEP) *.mli *.ml > .depend | |
127 | ||
b1b2de81 | 128 | .depend: |
34e49164 C |
129 | $(OCAMLDEP) *.mli *.ml > .depend |
130 | ||
131 | -include .depend |