-
Notifications
You must be signed in to change notification settings - Fork 45
/
Makefile.in
260 lines (192 loc) · 8.34 KB
/
Makefile.in
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
APPNAME = wrangler
include vsn.mk
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
LIB_DIR = @ERLANG_INSTALL_LIB_DIR@/$(APPNAME)-$(VERSION)
ERL = "@ERL@"
ERLC = "@ERLC@"
DOC_OPTS={def,{version,\"$(VERSION)\"}}
########################################
## Main part
YRL = src/wrangler_parse.yrl
YRL_ERL = $(patsubst src/%.yrl,src/%.erl, $(YRL)))
FIRST_ERL = src/wrangler_expand_rule.erl \
src/wrangler_scan.erl src/wrangler_epp_dodger.erl \
src/wrangler_syntax.erl src/wrangler_syntax_lib.erl \
src/wrangler_misc.erl src/api_ast_traverse.erl src/api_refac.erl
FIRST_SRC= $(FIRST_YRL) $(FIRST_ERL)
BUILD_FIRST = $(patsubst src/%.yrl,ebin/%.beam, $(YRL)) \
$(patsubst src/%.erl,ebin/%.beam, $(FIRST_ERL))
ERL_SRC = $(wildcard src/*.erl)
ERL_BEH_EXTRACTION_SRC = $(wildcard src/behaviour_extraction/*.erl)
ERL_GEN_REFACS_SRC = $(wildcard src/gen_refacs/*.erl)
ERL_GEN_REFACS_2_SRC = $(wildcard src/gen_refacs_2/*.erl)
ERL_MY_GEN_REFACS_SRC= $(wildcard src/my_gen_refacs/*.erl)
ERL_GEN_COMP_SRC = $(wildcard src/gen_composite_refacs/*.erl)
ERL_MY_GEN_COMP_SRC = $(wildcard src/my_gen_composite_refacs/*.erl)
ERL_WLS_SRC = $(wildcard src/wls/*.erl)
ERL_EVAL_SRC = $(wildcard src/symbolic_evaluation/evaluator/*.erl)
ERL_CORE_SRC = $(wildcard src/symbolic_evaluation/core/*.erl)
ERL_REFAC_SRC = $(wildcard src/symbolic_evaluation/refactorings/*.erl)
ERL_UTILS_SRC = $(wildcard src/symbolic_evaluation/utils/*.erl)
ERL_DEF_SRC = $(wildcard src/symbolic_evaluation/tests/definitions/*.erl)
LAST_SRC = $(filter-out $(FIRST_SRC), $(ERL_SRC)) $(ERL_GEN_REFACS_SRC) \
$(ERL_MY_GEN_REFACS_SRC) $(ERL_GEN_COMP_SRC) $(ERL_MY_GEN_COMP_SRC) \
$(ERL_EVAL_SRC) $(ERL_CORE_SRC) $(ERL_REFAC_SRC) \
$(ERL_UTILS_SRC) $(ERL_BEH_EXTRACTION_SRC) \
$(ERL_DEF_SRC) $(ERL_GEN_REFACS_2_SRC) $(ERL_WLS_SRC)
ERL_LAST = $(patsubst src/%.erl,ebin/%.beam,$(ERL_SRC)) \
$(patsubst src/behaviour_extraction/%.erl, ebin/%.beam, $(ERL_BEH_EXTRACTION_SRC)) \
$(patsubst src/gen_refacs/%.erl, ebin/%.beam, $(ERL_GEN_REFACS_SRC)) \
$(patsubst src/gen_refacs_2/%.erl, ebin/%.beam, $(ERL_GEN_REFACS_2_SRC)) \
$(patsubst src/my_gen_refacs/%.erl, ebin/%.beam, \
$(ERL_MY_GEN_REFACS_SRC)) \
$(patsubst src/gen_composite_refacs/%.erl, ebin/%.beam, \
$(ERL_GEN_COMP_SRC)) \
$(patsubst src/wls/%.erl, ebin/%.beam, \
$(ERL_WLS_SRC)) \
$(patsubst src/my_gen_composite_refacs/%.erl, ebin/%.beam, \
$(ERL_MY_GEN_COMP_SRC)) \
$(patsubst src/symbolic_evaluation/evaluator/%.erl, ebin/%.beam, \
$(ERL_EVAL_SRC)) \
$(patsubst src/symbolic_evaluation/core/%.erl, ebin/%.beam, \
$(ERL_CORE_SRC)) \
$(patsubst src/symbolic_evaluation/refactorings/%.erl, ebin/%.beam, \
$(ERL_REFAC_SRC)) \
$(patsubst src/symbolic_evaluation/utils/%.erl, ebin/%.beam, \
$(ERL_UTILS_SRC)) \
$(patsubst src/symbolic_evaluation/tests/definitions/%.erl, ebin/%.beam, \
$(ERL_DEF_SRC))
ERL_OBJ = $(BUILD_FIRST) $(ERL_LAST)
.PHONY: default all conf erl c elisp
default: conf erl c elisp
all: default docs
CONF_SRC = Makefile.in c_src/suffixtree/Makefile.in \
c_src/gsuffixtree/Makefile.in
CONF_OBJ = $(patsubst %.in,%,$(CONF_SRC))
ELISP_SRC = elisp/wrangler.el.src
ELISP_OBJ = $(patsubst elisp/%.src, elisp/%, $(ELISP_SRC))
conf: $(CONF_OBJ)
erl: $(ERL_OBJ)
c:
@cd ./c_src; make; cd ../..
elisp: $(ELISP_OBJ)
########################################
## Rules
$(CONF_OBJ): configure $(CONF_SRC)
./configure
.SUFFIXES: .erl .yrl
## Erlang
## Parallel dependencies
src/api_refac.erl: ebin/wrangler_expand_rule.beam ebin/wrangler_syntax.beam
$(FIRST_ERL): ebin/wrangler_parse.beam
$(LAST_SRC): $(BUILD_FIRST)
$(ERL_GEN_REFACS_SRC) $(ERL_MY_GEN_REFACS_SRC) $(ERL_GEN_REFACS_2_SRC): ebin/gen_refac.beam
src/refac_batch_rename_fun.erl $(ERL_GEN_COMP_SRC) \
$(ERL_MY_GEN_COMP_SRC): ebin/gen_composite_refac.beam
##
ebin/%.beam: src/%.erl
$(ERLC) -pa ebin -I include -W -o ebin +debug_info $<
ebin/%.beam: src/behaviour_extraction/%.erl
$(ERLC) -pa ebin -I include -W -o ebin +debug_info $<
ebin/%.beam: src/gen_refacs/%.erl
$(ERLC) -pa ebin -I include -W -o ebin +debug_info $<
ebin/%.beam: src/gen_refacs_2/%.erl
$(ERLC) -pa ebin -I include -W -o ebin +debug_info $<
ebin/%.beam: src/my_gen_refacs/%.erl
$(ERLC) -pa ebin -I include -W -o ebin +debug_info $<
ebin/%.beam: src/wls/%.erl
$(ERLC) -pa ebin -I include -W -o ebin +debug_info $<
ebin/%.beam: src/gen_composite_refacs/%.erl
$(ERLC) -pa ebin -I include -W -o ebin +debug_info $<
ebin/%.beam: src/my_gen_composite_refacs/%.erl
$(ERLC) -pa ebin -I include -W -o ebin +debug_info $<
ebin/%.beam: src/symbolic_evaluation/evaluator/%.erl
$(ERLC) -pa ebin -I include -W -o ebin +debug_info $<
ebin/%.beam: src/symbolic_evaluation/core/%.erl
$(ERLC) -pa ebin -I include -W -o ebin +debug_info $<
ebin/%.beam: src/symbolic_evaluation/refactorings/%.erl
$(ERLC) -pa ebin -I include -W -o ebin +debug_info $<
ebin/%.beam: src/symbolic_evaluation/utils/%.erl
$(ERLC) -pa ebin -I include -W -o ebin +debug_info $<
ebin/%.beam: src/symbolic_evaluation/tests/definitions/%.erl
$(ERLC) -pa ebin -I include -W -o ebin +debug_info $<
ebin/%.beam: include/wrangler.hrl include/wrangler_internal.hrl
src/%.erl: src/%.yrl
$(ERLC) -o src $<
$(ELISP_OBJ): $(ELISP_SRC)
cp $(ELISP_SRC) $(ELISP_OBJ);
escript ebin/dynamic_menu_items >>$(ELISP_OBJ)
########################################
clean:
@cd ./c_src; make clean; cd ../..
@-rm -f ${ERL_OBJ} src/wrangler_parse.erl
@-rm -f $(ELISP_OBJ)
@-rm -f priv/suffixtree priv/gsuffixtree
@-rm -f doc/*.html doc/edoc-info doc/erlang.png doc/stylesheet.css
@-rm -f doc/*/*.html doc/*/edoc-info doc/*/erlang.png doc/*/stylesheet.css
@-rm -f doc/*/*/*.html doc/*/*/edoc-info doc/*/*/erlang.png doc/*/*/stylesheet.css
@-rm -f doc/*.erl
distclean: clean
@-rm -f $(CONF_OBJ)
@-rm -f config.* configure.scan
@-rm -rf autom4te.cache
install: default
@echo "* Installing Emacs Lisp Library"
install -m 775 -d $(DESTDIR)$(LIB_DIR)/elisp
install -m 775 elisp/*.el $(DESTDIR)$(LIB_DIR)/elisp
@echo
@echo "* Installing Erlang Library"
install -m 775 -d $(DESTDIR)$(LIB_DIR)/ebin
install -m 775 ebin/*.beam $(DESTDIR)$(LIB_DIR)/ebin
install -m 775 ebin/*.app $(DESTDIR)$(LIB_DIR)/ebin
install -m 775 -d $(DESTDIR)$(LIB_DIR)/src
install -m 775 src/*/*.erl $(DESTDIR)$(LIB_DIR)/src
install -m 775 -d $(DESTDIR)$(LIB_DIR)/include
install -m 775 include/*.hrl $(DESTDIR)$(LIB_DIR)/include
install -m 775 -d $(DESTDIR)$(LIB_DIR)/priv
install -m 775 priv/suffixtree* $(DESTDIR)$(LIB_DIR)/priv
install -m 755 priv/gsuffixtree* $(DESTDIR)$(LIB_DIR)/priv
install -m 775 priv/side_effect_plt $(DESTDIR)$(LIB_DIR)/priv
install -m 775 priv/dialyzer_plt $(DESTDIR)$(LIB_DIR)/priv
@echo
@echo "*** Successfully installed. See README for usage instructions."
@echo
wc:
@echo "* Emacs Lisp"
@wc -l */*.el | sort -nr
@echo "* Erlang"
@wc -l */*.erl | sort -nr
@echo "* C"
@wc -l */*.c | sort -nr
EXAMPLE_CODE = inspec_examples.erl \
gen_refacs/refac_apply_to_remote_call.erl \
gen_refacs/refac_remove_an_argument.erl \
gen_refacs/refac_remove_an_import_attribute.erl \
gen_refacs/refac_add_an_import_attribute.erl \
gen_refacs/refac_specialise_a_function.erl \
gen_refacs/refac_swap_function_arguments.erl \
gen_composite_refacs/refac_batch_clone_elimination.erl \
gen_composite_refacs/refac_batch_prefix_module.erl \
gen_composite_refacs/refac_func_to_behav_instance.erl \
gen_composite_refacs/refac_expr_to_behav_instance.erl \
gen_composite_refacs/refac_unfold_behav_instance.erl \
refac_batch_rename_fun.erl regexp_re.erl keysearch_keyfind.erl
docs-se-%: doc/symbolic_evaluation/%/overview.edoc
$(ERL) -noshell -eval \
"edoc:application($*, \"src/symbolic_evaluation/$*\", [$(DOC_OPTS), {dir, \"doc/symbolic_evaluation/$*\"}, {overview, \"$<\"}, no_subpackages])" \
-s init stop
(cd src ; cp $(EXAMPLE_CODE) ../doc/)
docs-be: doc/behaviour_extraction/overview.edoc
$(ERL) -noshell -eval \
"edoc:application(behaviour_extraction, \"src/behaviour_extraction\", [$(DOC_OPTS), {dir, \"doc/behaviour_extraction\"}, {overview, \"$<\"}, no_subpackages])" \
-s init stop
(cd src ; cp $(EXAMPLE_CODE) ../doc/)
docs: docs-se-core docs-se-evaluator docs-se-refactorings docs-be
$(ERL) -noshell -eval \
"edoc:application($(APPNAME), \".\", [$(DOC_OPTS), no_subpackages])" \
-s init stop
(cd src ; cp $(EXAMPLE_CODE) ../doc/)
privdocs:
$(MAKE) DOC_OPTS='$(DOC_OPTS)',private docs