| 1 | # Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen |
| 2 | # Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller |
| 3 | # This file is part of Coccinelle. |
| 4 | # |
| 5 | # Coccinelle is free software: you can redistribute it and/or modify |
| 6 | # it under the terms of the GNU General Public License as published by |
| 7 | # the Free Software Foundation, according to version 2 of the License. |
| 8 | # |
| 9 | # Coccinelle is distributed in the hope that it will be useful, |
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | # GNU General Public License for more details. |
| 13 | # |
| 14 | # You should have received a copy of the GNU General Public License |
| 15 | # along with Coccinelle. If not, see <http://www.gnu.org/licenses/>. |
| 16 | # |
| 17 | # The authors reserve the right to distribute this or future versions of |
| 18 | # Coccinelle under other licenses. |
| 19 | |
| 20 | |
| 21 | ############################################################################## |
| 22 | # Variables |
| 23 | ############################################################################## |
| 24 | #TARGET=matcher |
| 25 | TARGET=cocciengine |
| 26 | CTLTARGET=engine |
| 27 | |
| 28 | SRC= flag_matcher.ml lib_engine.ml pretty_print_engine.ml \ |
| 29 | check_exhaustive_pattern.ml \ |
| 30 | check_reachability.ml \ |
| 31 | c_vs_c.ml isomorphisms_c_c.ml \ |
| 32 | cocci_vs_c.ml pattern_c.ml sgrep.ml transformation_c.ml \ |
| 33 | asttomember.ml asttoctl2.ml ctltotex.ml \ |
| 34 | postprocess_transinfo.ml ctlcocci_integration.ml lib_matcher_c.ml |
| 35 | |
| 36 | #c_vs_c.ml |
| 37 | #SRC= flag_matcher.ml \ |
| 38 | # c_vs_c.ml cocci_vs_c.ml \ |
| 39 | # lib_engine.ml \ |
| 40 | # pattern_c.ml transformation_c.ml |
| 41 | |
| 42 | #LIBS=../commons/commons.cma ../parsing_c/parsing_c.cma |
| 43 | #INCLUDES= -I ../commons -I ../parsing_c |
| 44 | INCLUDES = -I ../commons -I ../commons/ocamlextra -I ../globals \ |
| 45 | -I ../ctl -I ../parsing_cocci -I ../parsing_c |
| 46 | LIBS=../commons/commons.cma ../globals/globals.cma \ |
| 47 | ../ctl/ctl.cma ../parsing_c/parsing_c.cma ../parsing_cocci/cocci_parser.cma |
| 48 | |
| 49 | SYSLIBS= str.cma unix.cma |
| 50 | |
| 51 | |
| 52 | # just to test asttoctl |
| 53 | # CTLSOURCES = lib_engine.ml pretty_print_engine.ml asttoctl.ml ctltotex.ml \ |
| 54 | # main.ml |
| 55 | |
| 56 | ############################################################################## |
| 57 | # Generic variables |
| 58 | ############################################################################## |
| 59 | |
| 60 | #for warning: -w A |
| 61 | #for profiling: -p -inline 0 with OCAMLOPT |
| 62 | OCAMLCFLAGS ?= -g -dtypes |
| 63 | |
| 64 | OCAMLC=ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES) |
| 65 | OCAMLOPT=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES) |
| 66 | OCAMLLEX=ocamllex$(OPTBIN) #-ml |
| 67 | OCAMLYACC=ocamlyacc -v |
| 68 | OCAMLDEP=ocamldep$(OPTBIN) #$(INCLUDES) |
| 69 | OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES) |
| 70 | |
| 71 | |
| 72 | OBJS = $(SRC:.ml=.cmo) |
| 73 | OPTOBJS = $(SRC:.ml=.cmx) |
| 74 | |
| 75 | |
| 76 | ############################################################################## |
| 77 | # Top rules |
| 78 | ############################################################################## |
| 79 | all: $(TARGET).cma |
| 80 | all.opt: $(TARGET).cmxa |
| 81 | |
| 82 | $(TARGET).cma: $(OBJS) |
| 83 | $(OCAMLC) -a -o $(TARGET).cma $(OBJS) |
| 84 | |
| 85 | $(TARGET).cmxa: $(OPTOBJS) $(LIBS:.cma=.cmxa) |
| 86 | $(OCAMLOPT) -a -o $(TARGET).cmxa $(OPTOBJS) |
| 87 | |
| 88 | $(TARGET).top: $(OBJS) $(LIBS) |
| 89 | $(OCAMLMKTOP) -o $(TARGET).top $(SYSLIBS) $(LIBS) $(OBJS) |
| 90 | |
| 91 | clean:: |
| 92 | rm -f $(TARGET).top |
| 93 | |
| 94 | |
| 95 | |
| 96 | ############################################################################## |
| 97 | # Pad's rules |
| 98 | ############################################################################## |
| 99 | |
| 100 | ############################################################################## |
| 101 | # Generic rules |
| 102 | ############################################################################## |
| 103 | |
| 104 | .SUFFIXES: .ml .mli .cmo .cmi .cmx |
| 105 | |
| 106 | .ml.cmo: |
| 107 | $(OCAMLC) -c $< |
| 108 | .mli.cmi: |
| 109 | $(OCAMLC) -c $< |
| 110 | .ml.cmx: |
| 111 | $(OCAMLOPT) -c $< |
| 112 | |
| 113 | .ml.mldepend: |
| 114 | $(OCAMLC) -i $< |
| 115 | |
| 116 | clean:: |
| 117 | rm -f *.cm[ioxa] *.o *.a *.cmxa *.annot |
| 118 | clean:: |
| 119 | rm -f *~ .*~ gmon.out #*# |
| 120 | |
| 121 | beforedepend:: |
| 122 | |
| 123 | depend:: beforedepend |
| 124 | $(OCAMLDEP) *.mli *.ml > .depend |
| 125 | |
| 126 | -include .depend |