This repository has been archived by the owner on Jun 4, 2019. It is now read-only.
/
Makefile
172 lines (127 loc) · 4.66 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
# This file is intentionnaly not using ../Makefile.common.
# This is to show how to build a simple Makefile from scratch
# to people who wants to use pfff in their own application.
##############################################################################
# Simple compilation
##############################################################################
# This is intentionnaly not using OCAMLC, SYSLIBS and so on to show a simple
# way to compile a pfff "script"
simple_refactoring: simple_refactoring.ml
ocamlc -g -o simple_refactoring \
-I ../commons -I ../lang_php/parsing -I ../h_program-lang \
str.cma unix.cma nums.cma bigarray.cma \
../commons/commons.cma ../h_program-lang/lib.cma \
../lang_php/parsing/lib.cma \
simple_refactoring.ml
clean::
rm simple_refactoring
check_is_static_literal: check_is_static_literal.cmo
ocamlc -g -o $@ \
-I ../commons -I ../lang_php/parsing -I ../h_program-lang \
str.cma unix.cma nums.cma bigarray.cma \
../commons/commons.cma ../h_program-lang/lib.cma \
../lang_php/parsing/lib.cma \
$^
clean::
rm check_is_static_literal
##############################################################################
# Variables
##############################################################################
# Now we switch to a more traditional Makefile
include ../Makefile.config
ifeq ($(FEATURE_BDB),1)
ANALYZECMA=../external/ocamlpcre/lib/pcre.cma \
../external/ocamlbdb/bdb.cma ../commons/commons_bdb.cma \
../lang_php/analyze/lib.cma \
ANALUZEINCLUDES= \
../external/ocamlbdb/ \
../external/ocamlpcre/lib \
../h_program-lang \
../lang_php/analyze
endif
LIBS= ../commons/commons.cma \
../h_version-control/lib.cma \
../h_program-lang/lib.cma \
../lang_php/parsing/lib.cma \
$(ANALYZECMA)
INCLUDEDIRS=../commons ../commons/lib-sexp ../commons/lib-json \
../lang_php/parsing $(ANALUZEINCLUDES)
SYSLIBS= str.cma unix.cma nums.cma bigarray.cma
# If you want to embed pfff in your own application, uncomment the following
# instead of the previous settings
#MAKESUBDIRS=commons parsing_php
#LIBS=commons/commons.cma parsing_php/parsing_php.cma
#INCLUDEDIRS=commons/ parsing_php/
#rec::
# set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i all || exit 1; done
#clean::
# set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i clean || exit 1; done
##############################################################################
# Generic variables
##############################################################################
INCLUDES=$(INCLUDEDIRS:%=-I %)
OBJS= $(SRC:.ml=.cmo)
OPTOBJS= $(SRC:.ml=.cmx)
#dont use -custom, it makes the bytecode unportable.
OCAMLCFLAGS=-g -dtypes # -w A
# This flag is also used in subdirectories so don't change its name here.
OPTFLAGS=
OCAMLC=ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES) -thread
OCAMLOPT=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES) -thread
OCAMLLEX=ocamllex #-ml # -ml for debugging lexer, but slightly slower
OCAMLYACC=ocamlyacc -v
OCAMLDEP=ocamldep $(INCLUDES)
OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES) -thread
##############################################################################
# Top rules
##############################################################################
# some of the ml files are generated from the literate document in parsing_php/
# so dont forget to do a 'make sync' in parsing_php/ before doing make
# in this directory.
PROGS=php_transducer.byte \
show_function_calls1.byte show_function_calls2.byte show_function_calls3.byte \
justin.byte bjacobs.byte
# simple_zero_to_null.byte count_elseifs.byte
#ifeq ($(FEATURE_BDB),1)
#PROGS+=kaplan.byte
#endif
all: rec $(PROGS)
opt: $(PROGS:.byte=.opt)
all.opt: opt
rec::
.SUFFIXES: .byte .opt
%.byte: %.cmo
$(OCAMLC) -o $@ $(SYSLIBS) $(LIBS) $^
%.opt: %.cmx
$(OCAMLOPT) -o $@ $(SYSLIBS:.cma=.cmxa) $(LIBS:.cma=.cmxa) $^
clean::
rm -f *.opt *.byte
##############################################################################
# Developer rules
##############################################################################
tags:
otags -no-mli-tags -r .
clean::
rm -f TAGS
##############################################################################
# Generic ocaml rules
##############################################################################
.SUFFIXES: .ml .mli .cmo .cmi .cmx
.ml.cmo:
$(OCAMLC) -c $<
.mli.cmi:
$(OCAMLC) -c $<
.ml.cmx:
$(OCAMLOPT) -c $<
.ml.mldepend:
$(OCAMLC) -i $<
clean::
rm -f *.cm[iox] *.o *.annot
clean::
rm -f *~ .*~ *.exe #*#
distclean::
rm -f .depend
beforedepend::
depend:: beforedepend
$(OCAMLDEP) *.mli *.ml > .depend
-include .depend