-# Copyright 2005-2008, Ecole des Mines de Nantes, University of Copenhagen
-# Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller
+# Copyright 2010, 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.
-#
+#
# Coccinelle is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, according to version 2 of the License.
-#
+#
# Coccinelle is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
-#
+#
# The authors reserve the right to distribute this or future versions of
# Coccinelle under other licenses.
+
#############################################################################
# Configuration section
#############################################################################
-include Makefile.config
+-include /etc/lsb-release
-VERSION=$(shell cat globals/config.ml |grep version |perl -p -e 's/.*"(.*)".*/$$1/;')
+VERSION=$(shell cat globals/config.ml.in |grep version |perl -p -e 's/.*"(.*)".*/$$1/;')
+CCVERSION=$(shell cat scripts/coccicheck/README |grep "Coccicheck version" |perl -p -e 's/.*version (.*)[ ]*/$$1/;')
+PKGVERSION=$(shell dpkg-parsechangelog -ldebian/changelog.$(DISTRIB_CODENAME) 2> /dev/null \
+ | sed -n 's/^Version: \(.*\)/\1/p' )
##############################################################################
# Variables
##############################################################################
TARGET=spatch
+PRJNAME=coccinelle
SRC=flag_cocci.ml cocci.ml testing.ml test.ml main.ml
-
ifeq ($(FEATURE_PYTHON),1)
-PYCMA=pycaml/pycaml.cma
-PYDIR=pycaml
-PYLIB=dllpycaml_stubs.so
-# the following is essential for Coccinelle to compile under gentoo (wierd)
-OPTLIBFLAGS=-cclib dllpycaml_stubs.so
+PYCMA=pycaml.cma
+# the following is essential for Coccinelle to compile under gentoo (weird)
+#OPTLIBFLAGS=-cclib dllpycaml_stubs.so
else
PYCMA=
-PYDIR=
-PYLIB=
+endif
OPTLIBFLAGS=
+
+ifeq ("$(SEXPDIR)","ocamlsexp")
+SEXPLIB=sexplib.cmo
+OPTSEXPLIB=sexplib.cmx
+else
+SEXPLIB=sexplib.cma
+OPTSEXPLIB=sexplib.cmxa
endif
+SEXPSYSCMA=bigarray.cma nums.cma
-SYSLIBS=str.cma unix.cma
-LIBS=commons/commons.cma globals/globals.cma\
+SYSLIBS=str.cma unix.cma $(SEXPSYSCMA) $(PYCMA) dynlink.cma # threads.cma
+LIBS=commons/commons.cma \
+ commons/commons_sexp.cma \
+ globals/globals.cma \
ctl/ctl.cma \
parsing_cocci/cocci_parser.cma parsing_c/parsing_c.cma \
engine/cocciengine.cma popl09/popl.cma \
- extra/extra.cma $(PYCMA) python/coccipython.cma
+ extra/extra.cma python/coccipython.cma ocaml/cocciocaml.cma
+
+# Should we use the local version of pycaml
+ifeq ("$(PYCAMLDIR)","pycaml")
+LOCALPYCAML=pycaml
+else
+LOCALPYCAML=
+endif
+
+# Should we use the local version of menhirLib
+ifeq ("$(MENHIRDIR)","menhirlib")
+LOCALMENHIR=menhirlib
+else
+LOCALMENHIR=
+endif
+
+# Should we use the local version of ocamlsexp
+ifeq ("$(SEXPDIR)","ocamlsexp")
+LOCALSEXP=ocamlsexp
+else
+LOCALSEXP=
+endif
+
+# used for depend: and a little for rec & rec.opt
+MAKESUBDIRS=$(LOCALPYCAML) $(LOCALSEXP) commons \
+ globals $(LOCALMENHIR) ctl parsing_cocci parsing_c \
+ engine popl09 extra python ocaml
+
+# used for clean:
+# It is like MAKESUBDIRS but also
+# force cleaning of local library copies
+CLEANSUBDIRS=pycaml ocamlsexp commons \
+ globals menhirlib ctl parsing_cocci parsing_c \
+ engine popl09 extra python ocaml
-MAKESUBDIRS=commons globals menhirlib $(PYDIR) ctl parsing_cocci parsing_c \
- engine popl09 extra python
-INCLUDEDIRS=commons commons/ocamlextra globals menhirlib $(PYDIR) ctl \
- parsing_cocci parsing_c engine popl09 extra python
+INCLUDEDIRSDEP=commons commons/ocamlextra $(LOCALSEXP) \
+ globals $(LOCALMENHIR) $(LOCALPYCAML) ctl \
+ parsing_cocci parsing_c engine popl09 extra python ocaml
+
+INCLUDEDIRS=$(INCLUDEDIRSDEP) $(SEXPDIR) $(MENHIRDIR) $(PYCAMLDIR)
##############################################################################
# Generic variables
# Generic ocaml variables
##############################################################################
-OCAMLCFLAGS= #-g -dtypes # -w A
+OCAMLCFLAGS=
# for profiling add -p -inline 0
# but 'make forprofiling' below does that for you.
# This flag is also used in subdirectories so don't change its name here.
+# To enable backtrace support for native code, you need to put -g in OPTFLAGS
+# to also link with -g, but even in 3.11 the backtrace support seems buggy so
+# not worth it.
OPTFLAGS=
-# the following is essential for Coccinelle to compile under gentoo
-# but is now defined above in this file
-#OPTLIBFLAGS=-cclib dllpycaml_stubs.so
-
-# the OPTBIN variable is here to allow to use ocamlc.opt instead of
-# ocaml, when it is available, which speeds up compilation. So
-# if you want the fast version of the ocaml chain tools, set this var
-# or setenv it to ".opt" in your startup script.
-OPTBIN= #.opt
OCAMLC=ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES)
-OCAMLOPT=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES)
+OCAMLOPT=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES)
OCAMLLEX=ocamllex #-ml # -ml for debugging lexer, but slightly slower
OCAMLYACC=ocamlyacc -v
-OCAMLDEP=ocamldep $(INCLUDES)
+OCAMLDEP=ocamldep $(INCLUDEDIRSDEP:%=-I %)
OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES)
# can also be set via 'make static'
##############################################################################
# Top rules
##############################################################################
-eclipse: depend all
-configure:
- ./configure
+.PHONY:: all all.opt byte opt top clean distclean configure
+.PHONY:: $(MAKESUBDIRS) $(MAKESUBDIRS:%=%.opt) subdirs subdirs.opt
+
+all: Makefile.config byte preinstall
+
+opt: all.opt
+all.opt: opt-compil preinstall
+
+world: preinstall
+ $(MAKE) byte
+ $(MAKE) opt-compil
+
+byte: .depend
+ $(MAKE) subdirs
+ $(MAKE) $(EXEC)
+
+opt-compil: .depend
+ $(MAKE) subdirs.opt
+ $(MAKE) $(EXEC).opt
+
+top: $(EXEC).top
-all: rec $(EXEC)
-opt: rec.opt $(EXEC).opt
-all.opt: opt
+subdirs:
+ +for D in $(MAKESUBDIRS); do $(MAKE) $$D || exit 1 ; done
+ $(MAKE) -C commons sexp OCAMLCFLAGS="$(OCAMLCFLAGS)"
+
+subdirs.opt:
+ +for D in $(MAKESUBDIRS); do $(MAKE) $$D.opt || exit 1 ; done
+ $(MAKE) -C commons sexp.opt OPTFLAGS="$(OPTFLAGS)"
+
+$(MAKESUBDIRS):
+ $(MAKE) -C $@ OCAMLCFLAGS="$(OCAMLCFLAGS)" all
+
+$(MAKESUBDIRS:%=%.opt):
+ $(MAKE) -C $(@:%.opt=%) OPTFLAGS="$(OPTFLAGS)" all.opt
+
+#dependencies:
+# commons:
+# globals:
+# menhirlib:
+# parsing_cocci: commons globals menhirlib
+# parsing_c:parsing_cocci
+# ctl:globals commons
+# engine: parsing_cocci parsing_c ctl
+# popl09:engine
+# extra: parsing_cocci parsing_c ctl
+# pycaml:
+# python:pycaml parsing_cocci parsing_c
-rec:
- set -e; for i in $(MAKESUBDIRS); \
- do $(MAKE) -C $$i OCAMLCFLAGS="$(OCAMLCFLAGS)" all; done
-rec.opt:
- set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i all.opt; done
clean::
- set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i clean; done
+ set -e; for i in $(CLEANSUBDIRS); do $(MAKE) -C $$i $@; done
+ $(MAKE) -C demos/spp $@
+
+$(LIBS): $(MAKESUBDIRS)
+$(LIBS:.cma=.cmxa): $(MAKESUBDIRS:%=%.opt)
+$(OBJS):$(LIBS)
+$(OPTOBJS):$(LIBS:.cma=.cmxa)
$(EXEC): $(LIBS) $(OBJS)
- $(OCAMLC) $(BYTECODE_STATIC) -o $@ $(SYSLIBS) $^
+ $(OCAMLC) $(BYTECODE_STATIC) -o $@ $(SYSLIBS) $(SEXPLIB) $^
-$(EXEC).opt: $(LIBS:.cma=.cmxa) $(OPTOBJS)
- $(OCAMLOPT) $(STATIC) -o $@ $(SYSLIBS:.cma=.cmxa) $(OPTLIBFLAGS) $^
+$(EXEC).opt: $(LIBS:.cma=.cmxa) $(OPTOBJS)
+ $(OCAMLOPT) $(STATIC) -o $@ $(SYSLIBS:.cma=.cmxa) $(OPTSEXPLIB) $(OPTLIBFLAGS) $^
-$(EXEC).top: $(LIBS) $(OBJS)
- $(OCAMLMKTOP) -custom -o $@ $(SYSLIBS) $^
+$(EXEC).top: $(LIBS) $(OBJS)
+ $(OCAMLMKTOP) -custom -o $@ $(SYSLIBS) $(SEXPLIB) $^
clean::
rm -f $(TARGET) $(TARGET).opt $(TARGET).top
+.PHONY:: tools configure
-clean::
- rm -f dllpycaml_stubs.so
-
+configure:
+ ./configure
-.PHONY: tools all configure
+Makefile.config:
+ @echo "Makefile.config is missing. Have you run ./configure?"
+ @exit 1
tools:
$(MAKE) -C tools
-clean::
- $(MAKE) -C tools clean
+clean::
+ if [ -d tools ] ; then $(MAKE) -C tools clean ; fi
static:
rm -f spatch.opt spatch
purebytecode:
rm -f spatch.opt spatch
$(MAKE) BYTECODE_STATIC="" spatch
+ perl -p -i -e 's/^#!.*/#!\/usr\/bin\/ocamlrun/' spatch
##############################################################################
-# Install
+# Build documentation
##############################################################################
+.PHONY:: docs
-# don't remove DESTDIR, it can be set by package build system like ebuild
-install: all
- mkdir -p $(DESTDIR)$(BINDIR)
- mkdir -p $(DESTDIR)$(LIBDIR)
- mkdir -p $(DESTDIR)$(SHAREDIR)
- cp spatch $(DESTDIR)$(BINDIR)
- cp -f dllpycaml_stubs.so $(DESTDIR)$(LIBDIR)
- cp standard.h $(DESTDIR)$(SHAREDIR)
- cp standard.iso $(DESTDIR)$(SHAREDIR)
- mkdir -p $(DESTDIR)$(SHAREDIR)/python
- cp -a python/coccilib $(DESTDIR)$(SHAREDIR)/python
- @echo ""
- @echo "You can also install spatch by copying the program spatch"
- @echo "(available in this directory) anywhere you want and"
- @echo "give it the right options to find its configuration files."
+docs:
+ make -C docs
-uninstall:
- rm -f $(DESTDIR)$(BINDIR)/spatch
- rm -f $(DESTDIR)$(LIBDIR)/dllpycaml_stubs.so
- rm -f $(DESTDIR)$(SHAREDIR)/standard.h
- rm -f $(DESTDIR)$(SHAREDIR)/standard.iso
- rm -rf $(DESTDIR)$(SHAREDIR)/python/coccilib
-
-
-
-version:
- @echo $(VERSION)
+clean::
+ make -C docs clean
+distclean::
+ make -C docs distclean
##############################################################################
-# Package rules
+# Pre-Install (customization of spatch frontend script)
##############################################################################
-PACKAGE=coccinelle-$(VERSION)
-
-BINSRC=spatch env.sh env.csh standard.h standard.iso \
- *.txt docs/* \
- demos/foo.* demos/simple.*
-# $(PYLIB) python/coccilib/ demos/printloc.*
-BINSRC2=$(BINSRC:%=$(PACKAGE)/%)
-
-TMP=/tmp
-OCAMLVERSION=$(shell ocaml -version |perl -p -e 's/.*version (.*)/$$1/;')
-
-# Procedure to do first time:
-# cd ~/release
-# cvs checkout coccinelle
-# cd coccinelle
-# cvs update -d -P
-# touch **/*
-# make licensify
-
-# Procedure to do each time:
-# cvs update
-# ./configure --without-python
-# make package
-# make website
-# Check also that run an ocaml in /usr/bin
-
-# To test you can try compile and run spatch from different instances
-# like my ~/coccinelle, ~/release/coccinelle, and the /tmp/coccinelle-0.X
-# downloaded from the website.
-
-# For 'make srctar' it must done from a clean
-# repo such as ~/release/coccinelle. It must also be a repo where
-# the scripts/licensify has been run at least once.
-# For the 'make bintar' I can do it from my original repo.
-
-
-package:
- make srctar
- make bintar
- make staticbintar
- make bytecodetar
-
-# I currently pre-generate the parser so the user does not have to
-# install menhir on his machine. I also do a few cleanups like 'rm todo_pos'.
-# You may have first to do a 'make licensify'.
-srctar:
- make clean
- cp -a . $(TMP)/$(PACKAGE)
- cd $(TMP)/$(PACKAGE); cd parsing_cocci/; make parser_cocci_menhir.ml
- cd $(TMP)/$(PACKAGE); rm todo_pos
- cd $(TMP); tar cvfz $(PACKAGE).tgz --exclude=CVS $(PACKAGE)
- rm -rf $(TMP)/$(PACKAGE)
-
-
-bintar: all
- rm -f $(TMP)/$(PACKAGE)
- ln -s `pwd` $(TMP)/$(PACKAGE)
- cd $(TMP); tar cvfz $(PACKAGE)-bin-x86.tgz --exclude=CVS $(BINSRC2)
- rm -f $(TMP)/$(PACKAGE)
-
-staticbintar: all.opt
- rm -f $(TMP)/$(PACKAGE)
- ln -s `pwd` $(TMP)/$(PACKAGE)
- make static
- cd $(TMP); tar cvfz $(PACKAGE)-bin-x86-static.tgz --exclude=CVS $(BINSRC2)
- rm -f $(TMP)/$(PACKAGE)
-
-# add ocaml version in name ?
-bytecodetar: all
- rm -f $(TMP)/$(PACKAGE)
- ln -s `pwd` $(TMP)/$(PACKAGE)
- make purebytecode
- cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz --exclude=CVS $(BINSRC2)
- rm -f $(TMP)/$(PACKAGE)
+preinstall: docs/spatch.1 scripts/spatch scripts/spatch.opt scripts/spatch.byte
+
+docs/spatch.1: Makefile.config
+ $(MAKE) -C docs spatch.1
+
+# user will use spatch to run spatch.opt (native)
+scripts/spatch: Makefile.config
+ cp scripts/spatch.sh scripts/spatch.tmp2
+ sed "s|SHAREDIR|$(SHAREDIR)|g" scripts/spatch.tmp2 > scripts/spatch.tmp
+ sed "s|LIBDIR|$(LIBDIR)|g" scripts/spatch.tmp > scripts/spatch
+ rm -f scripts/spatch.tmp2 scripts/spatch.tmp
+
+# user will use spatch to run spatch (bytecode)
+scripts/spatch.byte: Makefile.config
+ cp scripts/spatch.sh scripts/spatch.byte.tmp3
+ sed "s|\.opt||" scripts/spatch.byte.tmp3 > scripts/spatch.byte.tmp2
+ sed "s|SHAREDIR|$(SHAREDIR)|g" scripts/spatch.byte.tmp2 \
+ > scripts/spatch.byte.tmp
+ sed "s|LIBDIR|$(LIBDIR)|g" scripts/spatch.byte.tmp \
+ > scripts/spatch.byte
+ rm -f scripts/spatch.byte.tmp3 \
+ scripts/spatch.byte.tmp2 \
+ scripts/spatch.byte.tmp
+
+# user will use spatch.opt to run spatch.opt (native)
+scripts/spatch.opt: Makefile.config
+ cp scripts/spatch.sh scripts/spatch.opt.tmp2
+ sed "s|SHAREDIR|$(SHAREDIR)|g" scripts/spatch.opt.tmp2 \
+ > scripts/spatch.opt.tmp
+ sed "s|LIBDIR|$(LIBDIR)|g" scripts/spatch.opt.tmp \
+ > scripts/spatch.opt
+ rm -f scripts/spatch.opt.tmp scripts/spatch.opt.tmp2
clean::
- rm -f $(PACKAGE)
- rm -f $(PACKAGE)-bin-x86.tgz
- rm -f $(PACKAGE)-bin-x86-static.tgz
- rm -f $(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz
+ rm -f scripts/spatch scripts/spatch.byte scripts/spatch.opt
+##############################################################################
+# Install
+##############################################################################
+# don't remove DESTDIR, it can be set by package build system like ebuild
+# for staged installation.
+install-common:
+ mkdir -p $(DESTDIR)$(BINDIR)
+ mkdir -p $(DESTDIR)$(LIBDIR)
+ mkdir -p $(DESTDIR)$(SHAREDIR)/ocaml
+ mkdir -p $(DESTDIR)$(MANDIR)/man1
+ $(INSTALL_DATA) standard.h $(DESTDIR)$(SHAREDIR)
+ $(INSTALL_DATA) standard.iso $(DESTDIR)$(SHAREDIR)
+ $(INSTALL_DATA) ocaml/coccilib.cmi $(DESTDIR)$(SHAREDIR)/ocaml/
+ $(INSTALL_DATA) docs/spatch.1 $(DESTDIR)$(MANDIR)/man1/
+ @if [ $(FEATURE_PYTHON) -eq 1 ]; then $(MAKE) install-python; fi
+
+install-bash:
+ mkdir -p $(DESTDIR)$(BASH_COMPLETION_DIR)
+ $(INSTALL_DATA) scripts/spatch.bash_completion \
+ $(DESTDIR)$(BASH_COMPLETION_DIR)/spatch
+
+install-python:
+ mkdir -p $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui
+ $(INSTALL_DATA) python/coccilib/*.py \
+ $(DESTDIR)$(SHAREDIR)/python/coccilib
+ $(INSTALL_DATA) python/coccilib/coccigui/*.py \
+ $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui
+ $(INSTALL_DATA) python/coccilib/coccigui/pygui.glade \
+ $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui
+ $(INSTALL_DATA) python/coccilib/coccigui/pygui.gladep \
+ $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui
+ if [ -f pycaml/dllpycaml_stubs.so ]; then \
+ $(INSTALL_LIB) pycaml/dllpycaml_stubs.so $(DESTDIR)$(LIBDIR) ; fi
+
+install: install-common
+ @if test -x spatch -a ! -x spatch.opt ; then \
+ $(MAKE) install-byte;fi
+ @if test ! -x spatch -a -x spatch.opt ; then \
+ $(MAKE) install-def; $(MAKE) install-opt;fi
+ @if test -x spatch -a -x spatch.opt ; then \
+ $(MAKE) install-byte; $(MAKE) install-opt;fi
+ @if test ! -x spatch -a ! -x spatch.opt ; then \
+ echo "\n\n\t==> Run 'make', 'make opt', or both first. <==\n\n";fi
+ @echo ""
+ @echo "\tYou can also install spatch by copying the program spatch"
+ @echo "\t(available in this directory) anywhere you want and"
+ @echo "\tgive it the right options to find its configuration files."
+ @echo ""
-TOLICENSIFY=ctl engine parsing_cocci popl popl09 python
-licensify:
- ocaml tools/licensify.ml
- set -e; for i in $(TOLICENSIFY); do cd $$i; ocaml ../tools/licensify.ml; cd ..; done
+# user will use spatch to run spatch.opt (native)
+install-def:
+ $(INSTALL_PROGRAM) spatch.opt $(DESTDIR)$(SHAREDIR)
+ $(INSTALL_PROGRAM) scripts/spatch $(DESTDIR)$(BINDIR)/spatch
-# When checking out the source from diku sometimes I have some "X in the future"
-# error messages.
-fixdates:
- echo do 'touch **/*.*'
+# user will use spatch to run spatch (bytecode)
+install-byte:
+ $(INSTALL_PROGRAM) spatch $(DESTDIR)$(SHAREDIR)
+ $(INSTALL_PROGRAM) scripts/spatch.byte $(DESTDIR)$(BINDIR)/spatch
-#fixCVS:
-# cvs update -d -P
-# echo do 'rm -rf **/CVS'
+# user will use spatch.opt to run spatch.opt (native)
+install-opt:
+ $(INSTALL_PROGRAM) spatch.opt $(DESTDIR)$(SHAREDIR)
+ $(INSTALL_PROGRAM) scripts/spatch.opt $(DESTDIR)$(BINDIR)/spatch.opt
+
+uninstall:
+ rm -f $(DESTDIR)$(BINDIR)/spatch
+ rm -f $(DESTDIR)$(BINDIR)/spatch.opt
+ rm -f $(DESTDIR)$(LIBDIR)/dllpycaml_stubs.so
+ rm -f $(DESTDIR)$(SHAREDIR)/spatch
+ rm -f $(DESTDIR)$(SHAREDIR)/spatch.opt
+ rm -f $(DESTDIR)$(SHAREDIR)/standard.h
+ rm -f $(DESTDIR)$(SHAREDIR)/standard.iso
+ rm -f $(DESTDIR)$(SHAREDIR)/ocaml/coccilib.cmi
+ rm -f $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui/*
+ rm -f $(DESTDIR)$(SHAREDIR)/python/coccilib/*.py
+ rmdir --ignore-fail-on-non-empty -p \
+ $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui
+ rm -f $(DESTDIR)$(MANDIR)/man1/spatch.1
+
+uninstall-bash:
+ rm -f $(DESTDIR)$(BASH_COMPLETION_DIR)/spatch
+ rmdir --ignore-fail-on-non-empty -p \
+ $(DESTDIR)$(BASH_COMPLETION_DIR)
-ocamlversion:
- @echo $(OCAMLVERSION)
+version:
+ @echo "spatch $(VERSION)"
+ @echo "spatch $(PKGVERSION) ($(DISTRIB_ID))"
+ @echo "coccicheck $(CCVERSION)"
##############################################################################
-# Pad specific rules
+# Deb package (for Ubuntu) and release rules
##############################################################################
-#TOP=/home/pad/mobile/project-coccinelle
-WEBSITE=/home/pad/mobile/homepage/software/project-coccinelle
-
-website:
- cp $(TMP)/$(PACKAGE).tgz $(WEBSITE)
- cp $(TMP)/$(PACKAGE)-bin-x86.tgz $(WEBSITE)
- cp $(TMP)/$(PACKAGE)-bin-x86-static.tgz $(WEBSITE)
- cp $(TMP)/$(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz $(WEBSITE)
-
-
-#TXT=$(wildcard *.txt)
-syncwiki:
-# unison ~/public_html/wiki/wiki-LFS/data/pages/ docs/wiki/
-# set -e; for i in $(TXT); do unison $$i docs/wiki/$$i; done
-
-darcsweb:
-# @echo pull from ~/public_html/darcs/c-coccinelle and c-commons and lib-xxx
-
+include Makefile.release
##############################################################################
# Developer rules
##############################################################################
+-include Makefile.dev
+
test: $(TARGET)
./$(TARGET) -testall
-# -inline 0 to see all the functions in the profile.
-# Can also use the profile framework in commons/ and run your program
+# -inline 0 to see all the functions in the profile.
+# Can also use the profile framework in commons/ and run your program
# with -profile.
forprofiling:
$(MAKE) OPTFLAGS="-p -inline 0 " opt
clean::
- rm -f gmon.out
+ rm -f gmon.out
tags:
otags -no-mli-tags -r .
dependencygraph:
find -name "*.ml" |grep -v "scripts" | xargs ocamldep -I commons -I globals -I ctl -I parsing_cocci -I parsing_c -I engine -I popl09 -I extra > /tmp/dependfull.depend
- ocamldot -fullgraph /tmp/dependfull.depend > /tmp/dependfull.dot
+ ocamldot -lr /tmp/dependfull.depend > /tmp/dependfull.dot
dot -Tps /tmp/dependfull.dot > /tmp/dependfull.ps
+ ps2pdf /tmp/dependfull.ps /tmp/dependfull.pdf
##############################################################################
# Misc rules
##############################################################################
-# each member of the project can have its own test.ml. this file is
+# each member of the project can have its own test.ml. this file is
# not under CVS.
-test.ml:
+test.ml:
echo "let foo_ctl () = failwith \"there is no foo_ctl formula\"" \
> test.ml
.ml.cmx:
$(OCAMLOPT) -c $<
-.ml.mldepend:
+.ml.mldepend:
$(OCAMLC) -i $<
clean::
rm -f *.cm[iox] *.o *.annot
-
-clean::
rm -f *~ .*~ *.exe #*#
+distclean:: clean
+ set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i $@; done
+ rm -f .depend
+ rm -f Makefile.config
+ rm -f python/pycocci.ml
+ rm -f python/pycocci_aux.ml
+ rm -f globals/config.ml
+ rm -f TAGS
+ rm -f tests/SCORE_actual.sexp
+ rm -f tests/SCORE_best_of_both.sexp
+ find -name ".#*1.*" | xargs rm -f
+
beforedepend::
depend:: beforedepend
$(OCAMLDEP) *.mli *.ml > .depend
- set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i depend; done
+ set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i $@; done
+
+.depend::
+ @if [ ! -f .depend ] ; then $(MAKE) depend ; fi
-include .depend