X-Git-Url: http://git.hcoop.net/bpt/coccinelle.git/blobdiff_plain/ae4735db5e7e9386036cf7b496ebdc994514dc53..d6ce1786f27a05efa53cabeca92fc8e744a4b239:/globals/Makefile diff --git a/globals/Makefile b/globals/Makefile index b38a110..af2432f 100644 --- a/globals/Makefile +++ b/globals/Makefile @@ -1,4 +1,8 @@ -# Copyright 2005-2010, Ecole des Mines de Nantes, University of Copenhagen +# Copyright 2012, INRIA +# Julia Lawall, Gilles Muller +# Copyright 2010-2011, INRIA, University of Copenhagen +# Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix +# Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen # Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix # This file is part of Coccinelle. # @@ -18,46 +22,49 @@ # Coccinelle under other licenses. - --include ../Makefile.config +ifneq ($(MAKECMDGOALS),distclean) +include ../Makefile.config +endif ############################################################################## # Variables ############################################################################## TARGET=globals -SRC= flag.ml config.ml +OCAMLCFLAGS ?= -g -dtypes +OPTFLAGS ?= -g + +SRC=config.ml flag.ml iteration.ml $(REGEXP_FILE) regexp.ml LIBS= -INCLUDES= +INCLUDEDIRS= ../commons $(PCREDIR) ############################################################################## # Generic variables ############################################################################## -OCAMLCFLAGS ?= -g -dtypes -OCAMLC =ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES) -OCAMLOPT = ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES) -OCAMLDEP = ocamldep$(OPTBIN) $(INCLUDES) -OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES) + +INCLUDES=$(INCLUDEDIRS:%=-I %) +OCAMLC_CMD=$(OCAMLC) -thread $(OCAMLCFLAGS) $(INCLUDES) +OCAMLOPT_CMD=$(OCAMLOPT) -thread $(OPTFLAGS) $(INCLUDES) +OCAMLDEP_CMD=$(OCAMLDEP) $(INCLUDES) +OCAMLMKTOP_CMD=$(OCAMLMKTOP) -g -custom $(INCLUDES) OBJS= $(SRC:.ml=.cmo) OPTOBJS= $(SRC:.ml=.cmx) - ############################################################################## # Top rules ############################################################################## all: $(TARGET).cma -all.opt: $(TARGET).cmxa - -$(TARGET).cma: $(OBJS) $(LIBS) - $(OCAMLC) -a -o $(TARGET).cma $(OBJS) - -$(TARGET).cmxa: $(OPTOBJS) $(LIBS:.cma=.cmxa) - $(OCAMLOPT) -a -o $(TARGET).cmxa $(OPTOBJS) +all.opt: + @$(MAKE) $(TARGET).cmxa BUILD_OPT=yes +$(TARGET).cma: $(LIBS) $(OBJS) + $(OCAMLC_CMD) -a -o $(TARGET).cma $(OBJS) +$(TARGET).cmxa: $(LIBS:.cma=.cmxa) $(OPTOBJS) + $(OCAMLOPT_CMD) -a -o $(TARGET).cmxa $(OPTOBJS) ############################################################################## # Developer rules @@ -65,29 +72,30 @@ $(TARGET).cmxa: $(OPTOBJS) $(LIBS:.cma=.cmxa) .SUFFIXES: .ml .mli .cmo .cmi .cmx .ml.cmo: - $(OCAMLC) -c $< + $(OCAMLC_CMD) -c $< .mli.cmi: - $(OCAMLC) -c $< + $(OCAMLC_CMD) -c $< .ml.cmx: - $(OCAMLOPT) -c $< + $(OCAMLOPT_CMD) -c $< .ml.mldepend: - $(OCAMLC) -i $< + $(OCAMLC_CMD) -i $< -clean:: +clean: rm -f *.cm[ioxa] *.o *.a *.cmxa *.annot rm -f *~ .*~ gmon.out #*# - -distclean:: rm -f .depend -beforedepend:: +distclean: clean -depend:: beforedepend - $(OCAMLDEP) *.mli *.ml > .depend +.PHONEY: depend +.depend depend: + $(OCAMLDEP_CMD) *.mli *.ml > .depend +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(MAKECMDGOALS),distclean) -include .depend +endif +endif - - - +include ../Makefile.common