forked from facebookarchive/pfff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
747 lines (611 loc) · 20.9 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
#############################################################################
# Configuration section
#############################################################################
-include Makefile.config
##############################################################################
# Variables
##############################################################################
TOP=$(shell pwd)
SRC=main.ml
TARGET=pfff
#------------------------------------------------------------------------------
# Program related variables
#------------------------------------------------------------------------------
PROGS=pfff \
sgrep spatch \
stags \
codequery \
scheck \
pfff_test
ifeq ($(FEATURE_VISUAL), 1)
PROGS+=codemap
PROGS+=codegraph
endif
# note that without bdb, pfff_db will be incomplete regarding PHP
PROGS+=pfff_db
#todo: to remove
PROGS+=ppp
ifeq ($(FEATURE_BDB), 1)
PROGS+=pfff_db_heavy
endif
OPTPROGS= $(PROGS:=.opt)
#------------------------------------------------------------------------------
#package dependencies
#------------------------------------------------------------------------------
#format: XXXDIR, XXXCMD, XXXCMDOPT, XXXINCLUDE (if different XXXDIR), XXXCMA
#template:
# ifeq ($(FEATURE_XXX), 1)
# XXXDIR=xxx
# XXXCMD= $(MAKE) -C xxx && $(MAKE) xxx -C commons
# XXXCMDOPT= $(MAKE) -C xxx && $(MAKE) xxx.opt -C commons
# XXXCMA=xxx/xxx.cma commons/commons_xxx.cma
# XXXSYSCMA=xxx.cma
# XXXINCLUDE=xxx
# else
# XXXCMD=
# XXXCMDOPT=
# endif
# cf also below the target for pfff_browser
ifeq ($(FEATURE_GUI),1)
GUIDIR=external/ocamlgtk
GUICMD= $(MAKE) all -C $(GUIDIR) && $(MAKE) gui -C commons
GUICMDOPT= $(MAKE) opt -C $(GUIDIR) && $(MAKE) gui.opt -C commons;
GTKINCLUDE=external/ocamlgtk/src
endif
# cf also below for target pfff_visual
ifeq ($(FEATURE_VISUAL),1)
CAIRODIR=external/ocamlcairo
CAIROINCLUDE=external/ocamlcairo/src
endif
ifeq ($(FEATURE_PCRE), 1)
REGEXPDIR=external/ocamlpcre
REGEXPCMD= $(MAKE) -C $(REGEXPDIR) && $(MAKE) regexp -C commons
REGEXPCMDOPT= $(MAKE) -C $(REGEXPDIR) && $(MAKE) regexp.opt -C commons
REGEXPCMA=external/ocamlpcre/lib/pcre.cma commons/commons_regexp.cma
PCREINCLUDE=external/ocamlpcre/lib
else
endif
# cf also below for target pfff_db_heavy
ifeq ($(FEATURE_BDB), 1)
BDBDIR=external/ocamlbdb
BDBCMD= $(MAKE) all -C $(BDBDIR) && $(MAKE) bdb -C commons
BDBCMDOPT= $(MAKE) all.opt -C $(BDBDIR) && $(MAKE) bdb.opt -C commons
BDBCMA=external/ocamlbdb/bdb.cma commons/commons_bdb.cma
BDBSYSCMA=
else
endif
#todo: remove?
ifeq ($(FEATURE_MPI),1)
MPIDIR=external/ocamlmpi
MPICMD= $(MAKE) all -C $(MPIDIR) && $(MAKE) distribution -C commons
MPICMDOPT= $(MAKE) all.opt -C $(MPIDIR) && $(MAKE) distribution.opt -C commons
MPICMA=external/ocamlmpi/mpi.cma commons/commons_mpi.cma
endif
#todo: remove?
ifeq ($(FEATURE_BACKTRACE), 1)
BTCMD= $(MAKE) backtrace -C commons
BTCMDOPT= $(MAKE) backtrace.opt -C commons
BTCMA=commons/commons_backtrace.cma
else
endif
#------------------------------------------------------------------------------
# should be FEATURE_OCAMLGRAPH, or should give dependencies between features
GRAPHCMA=external/ocamlgraph/ocamlgraph.cma commons/commons_graph.cma
GRAPHDIR=external/ocamlgraph
GRAPHCMD= $(MAKE) all -C $(GRAPHDIR) && $(MAKE) graph -C commons
GRAPHCMDOPT= $(MAKE) all.opt -C $(GRAPHDIR) && $(MAKE) graph.opt -C commons
# for the moment it's used only by facebook/ code so could move in
# facebook/external/
THRIFTDIR=external/ocamlthrift
# could be under some ifeq($(FEATURE_WEB))
OCAMLNETDIR=external/ocamlnet
OCAMLNETINCLUDE=external/ocamlnet/netsys external/ocamlnet/netstring
OCAMLNETCMA= \
external/ocamlnet/netsys/netsys_oothr.cma \
external/ocamlnet/netsys/netsys.cma \
external/ocamlnet/netstring/netstring.cma
# external/ocamlnet/netstring/netaccel.cma \
ZIPDIR=external/ocamlzip
ZIPCMA=external/ocamlzip/zip.cma
EXTLIBDIR=external/extlib
EXTLIBCMA=external/extlib/extLib.cma
PTDIR=external/ptrees
PTCMA=external/ptrees/ptrees.cma
JAVALIBDIR=external/javalib/src
JAVALIBCMA=external/javalib/src/lib.cma
#todo: remove
#PHYLOMELDIR=external/phylomel/src
#PHYLOMELINCLUDE=external/phylomel/src
#PHYLOMELCMA=external/phylomel/src/lib.cma
ifeq ($(FEATURE_GRAPHICS), 1)
#GRAPHICSCMXA=graphics.cmxa
endif
ifeq ($(FEATURE_VISUAL),1)
VISUALDIRS=code_map code_graph
endif
OCAMLCOMPILERDIR=$(shell ocamlc -where)/compiler-libs
OCAMLCOMPILERCMA=ocamlcommon.cma
#------------------------------------------------------------------------------
# Main variables
#------------------------------------------------------------------------------
SYSLIBS=nums.cma bigarray.cma str.cma unix.cma
SYSLIBS+=$(OCAMLCOMPILERCMA)
# used for sgrep and other small utilities which I dont want to depend
# on too much things
BASICLIBS=commons/lib.cma \
globals/lib.cma \
h_files-format/lib.cma \
h_program-lang/lib.cma \
matcher/lib.cma \
lang_ml/parsing/lib.cma \
lang_nw/parsing/lib.cma \
lang_php/parsing/lib.cma \
lang_php/matcher/lib.cma \
lang_cpp/parsing/lib.cma \
lang_c/parsing/lib.cma \
lang_objc/parsing/lib.cma \
lang_clang/parsing/lib.cma \
lang_java/parsing/lib.cma \
lang_python/parsing/lib.cma \
lang_csharp/parsing/lib.cma \
lang_opa/parsing/lib.cma \
lang_erlang/parsing/lib.cma \
lang_html/parsing/lib.cma \
lang_js/parsing/lib.cma \
lang_css/parsing/lib.cma \
lang_web/parsing/lib.cma \
lang_text/lib.cma \
BASICSYSLIBS=nums.cma bigarray.cma str.cma unix.cma
LIBS= commons/lib.cma \
$(BTCMA) \
$(BDBCMA) \
$(REGEXPCMA) \
$(MPICMA) \
$(OCAMLNETCMA) \
$(GRAPHCMA) $(PHYLOMELCMA) \
$(EXTLIBCMA) $(PTCMA) $(ZIPCMA) \
$(JAVALIBCMA) \
commons/commons_features.cma \
h_version-control/lib.cma \
h_visualization/lib.cma \
h_files-format/lib.cma \
h_program-lang/lib.cma \
h_program-visual/lib.cma \
globals/lib.cma \
matcher/lib.cma \
lang_ml/parsing/lib.cma \
lang_ml/analyze/visual/lib.cma \
lang_ml/analyze/lib.cma \
lang_nw/parsing/lib.cma \
lang_nw/analyze/lib.cma \
lang_lisp/parsing/lib.cma \
lang_lisp/analyze/lib.cma \
lang_haskell/parsing/lib.cma \
lang_haskell/analyze/lib.cma \
lang_php/parsing/lib.cma \
lang_php/analyze/foundation/lib.cma \
lang_php/analyze/tools/lib.cma \
lang_php/analyze/checker/lib.cma \
lang_php/matcher/lib.cma \
lang_php/analyze/database/lib.cma \
lang_php/analyze/static_analysis/lib.cma \
lang_php/analyze/dynamic_analysis/lib.cma \
lang_php/analyze/qa_test/lib.cma \
lang_php/analyze/visual/lib.cma \
lang_php/analyze/lib.cma \
lang_php/pretty/lib.cma \
lang_sql/parsing/lib.cma \
lang_js/parsing/lib.cma \
lang_js/analyze/lib.cma \
lang_cpp/parsing/lib.cma \
lang_cpp/analyze/lib.cma \
lang_c/parsing/lib.cma \
lang_c/analyze/lib.cma \
lang_objc/parsing/lib.cma \
lang_objc/analyze/lib.cma \
lang_clang/parsing/lib.cma \
lang_clang/analyze/lib.cma \
lang_java/parsing/lib.cma \
lang_java/analyze/lib.cma \
lang_bytecode/parsing/lib.cma \
lang_bytecode/analyze/lib.cma \
lang_python/parsing/lib.cma \
lang_python/analyze/lib.cma \
lang_csharp/parsing/lib.cma \
lang_csharp/analyze/lib.cma \
lang_opa/parsing/lib.cma \
lang_opa/analyze/lib.cma \
lang_erlang/parsing/lib.cma \
lang_erlang/analyze/lib.cma \
lang_text/lib.cma \
lang_html/parsing/lib.cma \
lang_html/analyze/lib.cma \
lang_css/parsing/lib.cma \
lang_web/parsing/lib.cma \
MAKESUBDIRS=commons \
$(BDBDIR) $(REGEXPDIR) $(MPIDIR) \
$(GRAPHDIR) $(PHYLOMELDIR) \
$(THRIFTDIR) \
$(OCAMLNETDIR) \
$(GUIDIR) $(CAIRODIR) \
$(ZIPDIR) $(EXTLIBDIR) $(PTDIR) $(JAVALIBDIR) \
h_version-control \
h_visualization \
h_files-format \
h_program-lang \
h_program-visual \
globals \
matcher \
lang_ml/parsing \
lang_ml/analyze \
lang_nw/parsing \
lang_nw/analyze \
lang_lisp/parsing \
lang_lisp/analyze \
lang_haskell/parsing \
lang_haskell/analyze \
lang_php/parsing \
lang_php/matcher \
lang_php/pretty \
lang_sql/parsing \
lang_js/parsing \
lang_js/analyze \
lang_cpp/parsing \
lang_cpp/analyze \
lang_c/parsing \
lang_c/analyze \
lang_objc/parsing \
lang_objc/analyze \
lang_clang/parsing \
lang_clang/analyze \
lang_java/parsing \
lang_java/analyze \
lang_bytecode/parsing \
lang_bytecode/analyze \
lang_python/parsing \
lang_python/analyze \
lang_csharp/parsing \
lang_csharp/analyze \
lang_opa/parsing \
lang_opa/analyze \
lang_erlang/parsing \
lang_erlang/analyze \
lang_php/analyze \
lang_php/analyze/foundation \
lang_php/analyze/checker \
lang_php/analyze/database \
lang_php/analyze/tools \
lang_php/analyze/qa_test \
lang_php/analyze/dynamic_analysis \
lang_php/analyze/static_analysis \
lang_html/parsing \
lang_html/analyze \
lang_css/parsing \
lang_web/parsing \
lang_text \
$(VISUALDIRS)
INCLUDEDIRS=$(MAKESUBDIRS) \
commons/ocamlextra commons/ocollection \
commons/lib-json commons/lib-xml commons/lib-sexp \
$(GTKINCLUDE) $(CAIROINCLUDE) $(PCREINCLUDE) $(OCAMLNETINCLUDE) \
$(PHYLOMELINCLUDE) \
$(EXTLIBDIR) $(PTDIR) $(ZIPDIR) $(JAVALIBDIR) \
$(OCAMLCOMPILERDIR)
##############################################################################
# Generic
##############################################################################
-include $(TOP)/Makefile.common
##############################################################################
# Top rules
##############################################################################
.PHONY:: all all.opt opt top clean distclean
#note: old: was before all: rec $(EXEC) ... but can not do that cos make -j20
#could try to compile $(EXEC) before rec. So here force sequentiality.
all:: Makefile.config
$(MAKE) rec
$(MAKE) $(PROGS)
opt:
$(MAKE) rec.opt
$(MAKE) $(OPTPROGS)
all.opt: opt
top: $(TARGET).top
rec:
$(MAKE) -C commons
$(BTCMD)
$(BDBCMD)
$(REGEXPCMD)
$(MPICMD)
$(GRAPHCMD)
$(GUICMD)
$(MAKE) features -C commons
set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i all || exit 1; done
rec.opt:
$(MAKE) all.opt -C commons
$(BTCMDOPT)
$(BDBCMDOPT)
$(REGEXPCMDOPT)
$(MPICMDOPT)
$(GRAPHCMDOPT)
$(GUICMDOPT)
$(MAKE) features.opt -C commons
set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i all.opt || exit 1; done
$(TARGET): $(LIBS) $(OBJS)
$(OCAMLC) $(BYTECODE_STATIC) -o $@ $(SYSLIBS) $^
$(TARGET).opt: $(LIBS:.cma=.cmxa) $(OPTOBJS)
$(OCAMLOPT) $(STATIC) -o $@ $(SYSLIBS:.cma=.cmxa) $^
$(TARGET).top: $(LIBS) $(OBJS)
$(OCAMLMKTOP) -o $@ $(SYSLIBS) threads.cma $^
clean::
rm -f $(TARGET)
clean::
rm -f $(TARGET).top
clean::
set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i clean; done
clean::
rm -f *.opt
depend::
set -e; for i in $(MAKESUBDIRS); do echo $$i; $(MAKE) -C $$i depend; done
Makefile.config:
@echo "Makefile.config is missing. Have you run ./configure?"
@exit 1
distclean:: clean
set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i $@; done
rm -f .depend
rm -f Makefile.config
rm -f globals/config_pfff.ml
rm -f TAGS
# find -name ".#*1.*" | xargs rm -f
# add -custom so dont need add e.g. ocamlbdb/ in LD_LIBRARY_PATH
CUSTOM=-custom
static:
rm -f $(EXEC).opt $(EXEC)
$(MAKE) STATIC="-ccopt -static" $(EXEC).opt
cp $(EXEC).opt $(EXEC)
purebytecode:
rm -f $(EXEC).opt $(EXEC)
$(MAKE) BYTECODE_STATIC="" $(EXEC)
#------------------------------------------------------------------------------
# stags targets (was pfff_tags)
#------------------------------------------------------------------------------
stags: $(LIBS) main_stags.cmo
$(OCAMLC) $(CUSTOM) -o $@ $(SYSLIBS) $^
stags.opt: $(LIBS:.cma=.cmxa) main_stags.cmx
$(OCAMLOPT) $(STATIC) -o $@ $(SYSLIBS:.cma=.cmxa) $^
clean::
rm -f stags
#------------------------------------------------------------------------------
# sgrep/spatch targets
#------------------------------------------------------------------------------
sgrep: $(LIBS) main_sgrep.cmo
$(OCAMLC) $(CUSTOM) -o $@ $(SYSLIBS) $(REGEXPCMA) $^
sgrep.opt: $(BASICLIBS:.cma=.cmxa) main_sgrep.cmx
$(OCAMLOPT) $(STATIC) -o $@ $(BASICSYSLIBS:.cma=.cmxa) \
$(REGEXPCMA:.cma=.cmxa) $^
clean::
rm -f sgrep
spatch: $(LIBS) main_spatch.cmo
$(OCAMLC) $(CUSTOM) -o $@ $(SYSLIBS) $^
spatch.opt: $(LIBS:.cma=.cmxa) main_spatch.cmx
$(OCAMLOPT) $(STATIC) -o $@ $(SYSLIBS:.cma=.cmxa) $^
clean::
rm -f spatch
#------------------------------------------------------------------------------
# scheck targets
#------------------------------------------------------------------------------
scheck: $(LIBS) main_scheck.cmo
$(OCAMLC) $(CUSTOM) -o $@ $(SYSLIBS) $^
scheck.opt: $(LIBS:.cma=.cmxa) main_scheck.cmx
$(OCAMLOPT) $(STATIC) -o $@ $(SYSLIBS:.cma=.cmxa) $^
clean::
rm -f scheck
#------------------------------------------------------------------------------
# codequery targets
#------------------------------------------------------------------------------
codequery: $(LIBS) main_codequery.cmo
$(OCAMLC) $(CUSTOM) -o $@ $(SYSLIBS) $^
codequery.opt: $(LIBS:.cma=.cmxa) $(LIBS2:.cma=.cmxa) $(OBJS2:.cmo=.cmx) main_codequery.cmx
$(OCAMLOPT) $(STATIC) -o $@ $(SYSLIBS:.cma=.cmxa) $^
clean::
rm -f codequery
#------------------------------------------------------------------------------
# OBSOLETE: ppp targets (obsolete now that have closures in hphp)
#------------------------------------------------------------------------------
ppp: $(LIBS) main_ppp.cmo
$(OCAMLC) $(CUSTOM) -o $@ $(SYSLIBS) $^
ppp.opt: $(LIBS:.cma=.cmxa) main_ppp.cmx
$(OCAMLOPT) $(STATIC) -o $@ $(SYSLIBS:.cma=.cmxa) $^
clean::
rm -f ppp
#------------------------------------------------------------------------------
# pfff_db targets
#------------------------------------------------------------------------------
pfff_db: $(LIBS) main_db.cmo
$(OCAMLC) $(CUSTOM) -o $@ $(SYSLIBS) $^
pfff_db.opt: $(LIBS:.cma=.cmxa) $(LIBS2:.cma=.cmxa) $(OBJS2:.cmo=.cmx) main_db.cmx
$(OCAMLOPT) $(STATIC) -o $@ $(SYSLIBS:.cma=.cmxa) $^
clean::
rm -f pfff_db
#------------------------------------------------------------------------------
# pfff_db_heavy targets
#------------------------------------------------------------------------------
pfff_db_heavy: $(LIBS) main_db_heavy.cmo
$(OCAMLC) $(CUSTOM) -o $@ $(SYSLIBS) $^
pfff_db_heavy.opt: $(LIBS:.cma=.cmxa) $(LIBS2:.cma=.cmxa) $(OBJS2:.cmo=.cmx) main_db_heavy.cmx
$(OCAMLOPT) $(STATIC) -o $@ $(SYSLIBS:.cma=.cmxa) $^
clean::
rm -f pfff_db_heavy
#------------------------------------------------------------------------------
# codemap target (was pfff_visual)
#------------------------------------------------------------------------------
SYSLIBS3= \
external/ocamlgtk/src/lablgtk.cma \
external/ocamlcairo/src/cairo.cma \
external/ocamlcairo/src/cairo_lablgtk.cma \
OBJS3=code_map/lib.cma
GTKLOOP=gtkThread.cmo gtkInit.cmo
codemap: $(LIBS) commons/commons_gui.cma $(OBJS3) main_codemap.cmo
$(OCAMLC) -thread $(CUSTOM) -o $@ $(SYSLIBS) threads.cma $(SYSLIBS3) $(GTKLOOP) $^
codemap.opt: $(LIBS:.cma=.cmxa) commons/commons_gui.cmxa $(OBJS3:.cma=.cmxa) main_codemap.cmx
$(OCAMLOPT) -thread $(STATIC) -o $@ $(SYSLIBS:.cma=.cmxa) threads.cmxa $(SYSLIBS3:.cma=.cmxa) $(GTKLOOP:.cmo=.cmx) $^
clean::
rm -f codemap
#------------------------------------------------------------------------------
# codegraph (was pm_depend)
#------------------------------------------------------------------------------
#SYSLIBS_PM= external/phylomel/src/lib.cma
OBJS4=code_graph/lib.cma
codegraph: $(LIBS) commons/commons_gui.cma $(OBJS4) main_codegraph.cmo
$(OCAMLC) -thread $(CUSTOM) -o $@ $(SYSLIBS) threads.cma $(SYSLIBS3) $(GTKLOOP) $^
codegraph.opt: $(LIBS:.cma=.cmxa) commons/commons_gui.cmxa $(OBJS4:.cma=.cmxa) main_codegraph.cmx
$(OCAMLOPT) -thread $(STATIC) -o $@ $(SYSLIBS:.cma=.cmxa) threads.cmxa $(SYSLIBS3:.cma=.cmxa) $(GTKLOOP:.cmo=.cmx) $^
clean::
rm -f codegraph
#------------------------------------------------------------------------------
# pfff_misc targets
#------------------------------------------------------------------------------
pfff_misc: $(LIBS) main_misc.cmo
$(OCAMLC) $(CUSTOM) -o $@ $(SYSLIBS) $(SYSLIBS4) $^
pfff_misc.opt: $(LIBS:.cma=.cmxa) main_misc.cmx
$(OCAMLOPT) $(STATIC) -o $@ $(SYSLIBS:.cma=.cmxa) $(SYSLIBS4:.cma=.cmxa) $^
clean::
rm -f pfff_misc
#------------------------------------------------------------------------------
# pfff_test targets
#------------------------------------------------------------------------------
pfff_test: $(LIBS) main_test.cmo
$(OCAMLC) $(CUSTOM) -o $@ $(SYSLIBS) $^
pfff_test.opt: $(LIBS:.cma=.cmxa) main_test.cmx
$(OCAMLOPT) $(STATIC) -o $@ $(SYSLIBS:.cma=.cmxa) $^
clean::
rm -f pfff_test
##############################################################################
# Build documentation
##############################################################################
.PHONY:: docs
##############################################################################
# Install
##############################################################################
VERSION=$(shell cat globals/config_pfff.ml.in |grep version |perl -p -e 's/.*"(.*)".*/$$1/;')
# note: don't remove DESTDIR, it can be set by package build system like ebuild
install: all
mkdir -p $(DESTDIR)$(BINDIR)
mkdir -p $(DESTDIR)$(SHAREDIR)
cp -a $(PROGS) $(BINDIR)
cp -a data $(DESTDIR)$(SHAREDIR)
@echo ""
@echo "You can also install pfff by copying the programs"
@echo "available in this directory anywhere you want and"
@echo "give it the right options to find its configuration files."
uninstall:
rm -rf $(DESTDIR)$(SHAREDIR)/data
version:
@echo $(VERSION)
##############################################################################
# Package rules
##############################################################################
PACKAGE=$(TARGET)-$(VERSION)
TMP=/tmp
package:
make srctar
srctar:
make clean
cp -a . $(TMP)/$(PACKAGE)
cd $(TMP); tar cvfz $(PACKAGE).tgz --exclude=CVS --exclude=_darcs $(PACKAGE)
rm -rf $(TMP)/$(PACKAGE)
##############################################################################
# Website rules
##############################################################################
WEBSITE=/home/pad/mobile/homepage/software/project-pfff
gen-html:
emacs -l ~/.emacs --eval "(progn (htmlize-many-files '(\"changes.txt\")) (kill-emacs))"
website:
cp $(TMP)/$(PACKAGE).tgz $(WEBSITE)
# make gen-html
# cp changes.txt.html $(WEBSITE)/changes-$(VERSION).html
##############################################################################
# Developer rules
##############################################################################
.PHONY:: tags graph prolog db layers visual tests test
tags:
./stags.opt -lang cmt .
graph:
./codegraph.opt -lang cmt -build .
prolog:
./codequery.opt -lang cmt -build .
mv facts.pl facts_pl
db:
./pfff_db -verbose -lang ml -o DB_LIGHT.marshall .
layers:
./pfff_db_heavy -gen_age_layer /home/pad/local/pfff-for-layers \
layer_age.marshall
./pfff_db_heavy -gen_age_layer /home/pad/local/pfff-for-layers \
layer_age.json
visual:
./codemap -no_legend -profile -ss 2 \
-with_info DB_LIGHT.marshall -with_layers . -filter pfff .
tests:
$(MAKE) rec && $(MAKE) pfff_test
./pfff_test -verbose all
test:
make tests
push:
git push origin master
pull:
git pull
cd facebook; git pull
fbpull:
proxycmd.sh git pull
cd facebook; git pull
fbpush:
proxycmd.sh git push
cd facebook; git push
fb:
$(MAKE)
$(MAKE) -C facebook
fb.opt:
$(MAKE) opt
$(MAKE) opt -C facebook
fbdepend:
$(MAKE) depend
$(MAKE) depend -C facebook
visual2:
./codemap -no_legend -profile -ss 2 \
-with_info DB_LIGHT.marshall -with_layers . .
visualhead:
./codemap -ss 1 -ft 0.5 -commitid HEAD
graph2:
./codegraph.opt -lang ml -build .
#refactoring:
# git grep -l Source_high | xargs perl -p -i -e 's/Source_highlight/Highlight_code/g'
# TODO: replace with graphviz plugin to codegraph
DSRC=$(SRC)
DIRS= $(filter-out commons external/ocamlgtk/src external/ocamlpcre external/ocamlcairo external/ocamlgraph facebook, $(MAKESUBDIRS))
#DIRS=lang_php/parsing
DSRC+=$(DIRS:=/*.ml)
DSRC+=$(wildcard main_*.ml)
#PP1=-pp camlp4o
DOTCOLORS=green,darkgoldenrod2,cyan,red,magenta,yellow,burlywood1,aquamarine,purple,lightpink,salmon,mediumturquoise,black,slategray3
archi:
ocamldoc $(PP1) -I +threads $(INCLUDES) $(DSRC) \
-dot -dot-reduce -dot-colors $(DOTCOLORS)
dot -Tps ocamldoc.out > dot.ps
mv dot.ps Fig_graph_ml.ps
ps2pdf Fig_graph_ml.ps
rm -f Fig_graph_ml.ps
##############################################################################
# Pad specific rules
##############################################################################
DARCSFORESTS=commons commons/lib-sexp \
ocamltarzan ocamltarzan/lib-sexp \
h_version-control h_program-lang \
lang_php/parsing \
lang_php/analyze \
gui \
facebook
update_darcs:
darcs pull
set -e; for i in $(DARCSFORESTS); do cd $$i; darcs pull; cd ..; done
diff_darcs:
@echo "----- REPO:" top "----------------------"
darcs diff -u
set -e; for i in $(DARCSFORESTS); do cd $$i; echo "----- REPO:" $$i "-----------------"; darcs diff -u; cd $(TOP); done