Coccinelle release 1.0.0-rc13
[bpt/coccinelle.git] / globals / Makefile
index 71c6583..af2432f 100644 (file)
 # Coccinelle under other licenses.
 
 
-
--include ../Makefile.config
+ifneq ($(MAKECMDGOALS),distclean)
+include ../Makefile.config
+endif
 
 ##############################################################################
 # Variables
 ##############################################################################
 TARGET=globals
 
-SRC= flag.ml config.ml iteration.ml $(REGEXP_FILE) regexp.ml
+OCAMLCFLAGS ?= -g -dtypes
+OPTFLAGS ?= -g
+
+SRC=config.ml flag.ml iteration.ml $(REGEXP_FILE) regexp.ml
 
 LIBS=
-INCLUDEDIRS= ../commons  $(PCREDIR)
+INCLUDEDIRS= ../commons $(PCREDIR)
 
 ##############################################################################
 # Generic variables
 ##############################################################################
 
 INCLUDES=$(INCLUDEDIRS:%=-I %)
-
-OCAMLCFLAGS ?= -g -dtypes
-OCAMLC =ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES)
-OCAMLOPT = ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES)
-OCAMLDEP = ocamldep$(OPTBIN) $(INCLUDES)
-OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES)
+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)
@@ -55,13 +57,14 @@ OPTOBJS= $(SRC:.ml=.cmx)
 ##############################################################################
 all: $(TARGET).cma
 
-all.opt: $(TARGET).cmxa
+all.opt:
+       @$(MAKE) $(TARGET).cmxa BUILD_OPT=yes
 
 $(TARGET).cma: $(LIBS) $(OBJS)
-       $(OCAMLC) -a -o $(TARGET).cma $(OBJS)
+       $(OCAMLC_CMD) -a -o $(TARGET).cma $(OBJS)
 
 $(TARGET).cmxa: $(LIBS:.cma=.cmxa) $(OPTOBJS)
-       $(OCAMLOPT) -a -o $(TARGET).cmxa $(OPTOBJS)
+       $(OCAMLOPT_CMD) -a -o $(TARGET).cmxa $(OPTOBJS)
 
 ##############################################################################
 # Developer rules
@@ -69,29 +72,30 @@ $(TARGET).cmxa: $(LIBS:.cma=.cmxa) $(OPTOBJS)
 .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