Skip to content
This repository has been archived by the owner on Jun 4, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
* configure: new option --nocmt
  • Loading branch information
pad committed Mar 4, 2014
1 parent b0ad789 commit 07114ba
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 10 deletions.
15 changes: 9 additions & 6 deletions Makefile
Expand Up @@ -85,10 +85,15 @@ BYTECODEDIRS=lang_bytecode/parsing lang_bytecode/analyze
BYTECODECMAS=lang_bytecode/parsing/lib.cma lang_bytecode/analyze/lib.cma
endif

# should be FEATURE_CMT
ifeq ($(FEATURE_CMT), 1)
OCAMLCOMPILERDIR=$(shell ocamlc -where)/compiler-libs
OCAMLCOMPILERCMA=ocamlcommon.cma

CMTDIRS=lang_cmt/parsing lang_cmt/analyze
CMTCMAS=lang_cmt/parsing/lib.cma lang_cmt/analyze/lib.cma

endif

#------------------------------------------------------------------------------
# Main variables
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -145,8 +150,7 @@ LIBS= commons/lib.cma \
lang_ml/parsing/lib.cma \
lang_ml/analyze/visual/lib.cma \
lang_ml/analyze/lib.cma \
lang_cmt/parsing/lib.cma \
lang_cmt/analyze/lib.cma \
$(CMTCMAS) \
lang_nw/parsing/lib.cma \
lang_nw/analyze/lib.cma \
lang_lisp/parsing/lib.cma \
Expand Down Expand Up @@ -205,8 +209,7 @@ MAKESUBDIRS=commons \
matcher \
lang_ml/parsing \
lang_ml/analyze \
lang_cmt/parsing \
lang_cmt/analyze \
$(CMTDIRS) \
lang_nw/parsing \
lang_nw/analyze \
lang_lisp/parsing \
Expand Down Expand Up @@ -256,7 +259,7 @@ INCLUDEDIRS=$(MAKESUBDIRS) \
$(GTKINCLUDE) $(CAIROINCLUDE) \
$(OCAMLCOMPILERDIR)

PP=-pp "cpp -DFEATURE_BYTECODE=$(FEATURE_BYTECODE)"
PP=-pp "cpp -DFEATURE_BYTECODE=$(FEATURE_BYTECODE) -DFEATURE_CMT=$(FEATURE_CMT)"

##############################################################################
# Generic
Expand Down
6 changes: 5 additions & 1 deletion configure
Expand Up @@ -43,6 +43,7 @@ my $prefix="/usr/local";

my $visual=1; # cairo/gtk, for codemap, codegraph
my $bytecode=1;
my $cmt=1;
my $facebook=0;

my $man = 0;
Expand All @@ -56,6 +57,7 @@ GetOptions (
"prefix=s" => \$prefix,
"visual!" => \$visual,
"bytecode!" => \$bytecode,
"cmt!" => \$cmt,
"facebook" => sub {
$facebook = 1;
$visual = 0;
Expand Down Expand Up @@ -255,7 +257,7 @@ if($visual) {

pr2 "";
pr2 "$project target prefix: $prefix (you can use --prefix to override it)";
pr2 "Generating Makefile.config (VISUAL=$visual, BYTECODE=$bytecode) (see also configure --help)";
pr2 "Generating Makefile.config (VISUAL=$visual, BYTECODE=$bytecode, CMT=$cmt) (see also configure --help)";
open(CONFIG, ">Makefile.config");
print CONFIG "# autogenerated by configure
Expand All @@ -276,6 +278,7 @@ FEATURE_VISUAL=$visual
FEATURE_FACEBOOK=$facebook
FEATURE_BYTECODE=$bytecode
FEATURE_CMT=$cmt
OPTBIN=$opt
OCAMLCFLAGS_EXTRA=$ocamlc_flags
Expand Down Expand Up @@ -341,6 +344,7 @@ Options are:
--prefix
--[no]visual
--[no]bytecode
--[no]cmt
--with-all
--facebook
Expand Down
2 changes: 1 addition & 1 deletion copyright.txt
@@ -1,6 +1,6 @@
pfff - Yoann Padioleau

Copyright (C) 2009, 2010, 2011, 2012, 2013 Facebook
Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Facebook

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License (LGPL)
Expand Down
3 changes: 2 additions & 1 deletion main_codegraph.ml
Expand Up @@ -283,12 +283,13 @@ let build_graph_code lang xs =
try (
match lang with
| "ml" -> Graph_code_ml.build ~verbose:!verbose root files, empty

#if FEATURE_CMT
| "cmt" ->
let ml_files = Find_source.files_of_root ~lang:"ml" root in
let cmt_files = files in
Graph_code_cmt.build ~verbose:!verbose ~root ~cmt_files ~ml_files,
empty
#endif

| "php" ->
(* todo: better factorize *)
Expand Down
6 changes: 5 additions & 1 deletion main_codequery.ml
Expand Up @@ -94,12 +94,15 @@ let build_prolog_db lang root =

let g =
match lang with

#if FEATURE_CMT
| "cmt" ->
let ml_files = Find_source.files_of_root ~lang:"ml" root in
let cmt_files = files in
Graph_code_cmt.build ~verbose:!verbose ~root ~cmt_files ~ml_files
#if FEATURE_BYTECODE
#endif

#if FEATURE_BYTECODE
| "bytecode" ->
let graph_code_java =
(* Some (Graph_code_java.build ~verbose:!verbose ~only_defs:true
Expand All @@ -110,6 +113,7 @@ let build_prolog_db lang root =
Graph_code_bytecode.build ~verbose:!verbose ~graph_code_java
root files
#endif

| "clang2" -> Graph_code_clang.build ~verbose:!verbose root files
| _ -> raise Impossible
in
Expand Down
2 changes: 2 additions & 0 deletions main_stags.ml
Expand Up @@ -89,10 +89,12 @@ let rec defs_of_files_or_dirs lang xs =
let only_defs = true in
let g =
match lang with
#if FEATURE_CMT
| "cmt" ->
let cmt_files = files in
let ml_files = Find_source.files_of_root ~lang:"ml" root in
Graph_code_cmt.build ~verbose ~root ~cmt_files ~ml_files
#endif
| "java" -> Graph_code_java.build ~verbose ~only_defs root files
| "php2" -> Graph_code_php.build ~verbose ~only_defs root files+>fst
| _ -> raise Impossible
Expand Down

0 comments on commit 07114ba

Please sign in to comment.