Commit | Line | Data |
---|---|---|
feec80c3 C |
1 | ifneq ($(MAKECMDGOALS),distclean) |
2 | include ../Makefile.config | |
3 | endif | |
0708f913 | 4 | |
34e49164 C |
5 | TARGET=extra |
6 | ||
1be43e12 | 7 | SOURCES = classic_patch.ml kbuild.ml maintainers.ml |
34e49164 | 8 | |
b1b2de81 | 9 | SYSLIBS = str.cma unix.cma |
34e49164 | 10 | |
b1b2de81 | 11 | LIBS=../commons/commons.cma ../parsing_c/parsing_c.cma ../globals/globals.cma |
34e49164 C |
12 | INCLUDES= -I ../commons -I ../globals -I ../parsing_cocci -I ../parsing_c |
13 | ||
b1b2de81 | 14 | #for warning: -w A |
34e49164 | 15 | #for profiling: -p -inline 0 with OCAMLOPT |
755320b0 C |
16 | OCAMLCFLAGS ?= -g |
17 | OPTFLAGS ?= -g | |
d6ce1786 | 18 | |
755320b0 C |
19 | OCAMLC_CMD=$(OCAMLC) $(OCAMLCFLAGS) $(INCLUDES) |
20 | OCAMLOPT_CMD=$(OCAMLOPT) $(OPTFLAGS) $(INCLUDES) | |
feec80c3 C |
21 | OCAMLDEP_CMD=$(OCAMLDEP) $(INCLUDESDEP) |
22 | OCAMLMKTOP_CMD=$(OCAMLMKTOP) -g -custom $(INCLUDES) | |
34e49164 C |
23 | |
24 | OBJS = $(SOURCES:.ml=.cmo) | |
25 | OPTOBJS = $(SOURCES:.ml=.cmx) | |
26 | ||
abad11c5 | 27 | ifneq ($(FEATURE_OCAMLBUILD),yes) |
34e49164 C |
28 | all: $(TARGET).cma |
29 | ||
d6ce1786 C |
30 | all.opt: |
31 | @$(MAKE) $(TARGET).cmxa BUILD_OPT=yes | |
34e49164 C |
32 | |
33 | $(TARGET).byte: $(OBJS) $(LIBS) | |
feec80c3 | 34 | $(OCAMLC_CMD) -o $(TARGET).byte $(SYSLIBS) $(LIBS) $(OBJS) |
34e49164 C |
35 | |
36 | $(TARGET).opt: $(OPTOBJS) $(LIBS:.cma=.cmxa) | |
feec80c3 | 37 | $(OCAMLOPT_CMD) -o $(TARGET).opt $(SYSLIBS:.cma=.cmxa) $(LIBS:.cma=.cmxa) $(OPTOBJS) |
34e49164 C |
38 | |
39 | $(TARGET).cma: $(OBJS) | |
feec80c3 | 40 | $(OCAMLC_CMD) -a -o $(TARGET).cma $(OBJS) |
34e49164 C |
41 | |
42 | $(TARGET).cmxa: $(OPTOBJS) $(LIBS:.cma=.cmxa) | |
feec80c3 | 43 | $(OCAMLOPT_CMD) -a -o $(TARGET).cmxa $(OPTOBJS) |
34e49164 C |
44 | |
45 | $(TARGET).top: $(OBJS) $(LIBS) | |
feec80c3 | 46 | $(OCAMLMKTOP_CMD) -o $(TARGET).top $(SYSLIBS) $(LIBS) $(OBJS) |
34e49164 C |
47 | |
48 | clean:: | |
49 | rm -f $(TARGET).byte $(TARGET).opt rm -f $(TARGET).top | |
abad11c5 C |
50 | else |
51 | all: | |
52 | cd .. && $(OCAMLBUILD) extra/extra.cma | |
53 | ||
54 | all.opt: | |
55 | cd .. && $(OCAMLBUILD) extra/extra.cmxa | |
56 | ||
57 | clean:: | |
58 | cd .. && $(OCAMLBUILD) -clean | |
59 | endif | |
60 | ||
34e49164 | 61 | |
34e49164 C |
62 | .SUFFIXES: .ml .mli .cmo .cmi .cmx |
63 | ||
64 | .ml.cmo: | |
feec80c3 | 65 | $(OCAMLC_CMD) -c $< |
34e49164 | 66 | .mli.cmi: |
feec80c3 | 67 | $(OCAMLC_CMD) -c $< |
34e49164 | 68 | .ml.cmx: |
feec80c3 | 69 | $(OCAMLOPT_CMD) -c $< |
34e49164 | 70 | |
b1b2de81 | 71 | .ml.mldepend: |
feec80c3 | 72 | $(OCAMLC_CMD) -i $< |
34e49164 C |
73 | |
74 | clean:: | |
feec80c3 | 75 | rm -f .depend |
34e49164 | 76 | rm -f *.cm[ioxa] *.o *.a *.cmxa *.annot |
34e49164 C |
77 | rm -f *~ .*~ gmon.out #*# |
78 | ||
feec80c3 | 79 | distclean: clean |
34e49164 | 80 | |
feec80c3 C |
81 | .PHONY: depend |
82 | .depend depend: | |
83 | $(OCAMLDEP_CMD) *.mli *.ml > .depend | |
34e49164 | 84 | |
feec80c3 C |
85 | ifneq ($(MAKECMDGOALS),clean) |
86 | ifneq ($(MAKECMDGOALS),distclean) | |
abad11c5 | 87 | ifneq ($(FEATURE_OCAMLBUILD),yes) |
34e49164 | 88 | -include .depend |
feec80c3 C |
89 | endif |
90 | endif | |
abad11c5 | 91 | endif |
d6ce1786 C |
92 | |
93 | include ../Makefile.common |