-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile.in
65 lines (49 loc) · 1.71 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
# Global
ARCH=x86_64
CSRC=csrc
ESRC=src
EBIN=ebin
INCLUDE_DIR=include
OBJ_DIR=obj.$(ARCH)
# llvm Variables
LLVM_CONFIG=@llvm_config_var@
LLVM_CFLAGS=-g3 -Wall -fPIC -I`$(LLVM_CONFIG) --includedir` -DNDEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D SIZEOF_LONG_LONG=8 -fno-common
LLVM_LDFLAGS=`$(LLVM_CONFIG) --ldflags` `$(LLVM_CONFIG) --libdir`/libLTO.a `$(LLVM_CONFIG) --libs`
# Erlang Variables
ERL_TOP=@ERLANG_ROOT_DIR@
ERL=$(ERL_TOP)/bin/erl
ERLC=$(ERL_TOP)/bin/erlc
BEAM_FILES=$(patsubst $(ESRC)/%.erl,$(EBIN)/%.beam,$(wildcard $(ESRC)/*.erl))
HRL_FILES=$(wildcard $(ESRC)/*.hrl) $(wildcard $(INCLUDE_DIR)/*.hrl)
# CPP Variables
CC=@CC@
LINKER=@LINKER@
CFLAGS=@CFLAGS@
CFLAGS+=$(LLVM_CFLAGS)
CFLAGS+=-I @ERTS_DIR@/include/
LDFLAGS=@LDFLAGS@
LDFLAGS+=$(LLVM_LDFLAGS)
LIBS=@LIBS@
OBJ_FILES=$(patsubst $(CSRC)/%.c, $(OBJ_DIR)/%.o, $(wildcard $(CSRC)/*.c))
H_FILES=$(wildcard $(CSRC)/*.h)
all: compile
compile: compile_erl priv/$(ARCH)/llevm.so
@erl -noshell -pa ../llevm/ebin -eval "code:load_file(llevm)." -s init stop
compile_erl: $(EBIN) $(BEAM_FILES)
cp $(ESRC)/llevm.app.src $(EBIN)/llevm.app
$(EBIN)/%.beam: $(ESRC)/%.erl $(HRL_FILES)
$(ERLC) -I$(INCLUDE_DIR) -o $(EBIN) $<
$(OBJ_DIR)/%.o: $(CSRC)/%.c $(H_FILES) $(OBJ_DIR)
$(CC) -c $(CFLAGS) -o $@ $<
priv/$(ARCH)/llevm.so: $(OBJ_FILES) priv/$(ARCH)
$(LINKER) $(OBJ_FILES) $(LIBS) $(LDFLAGS) -o $@
priv/$(ARCH) $(OBJ_DIR) $(EBIN) $(INCLUDE_DIR) logs:
@mkdir -p $@
clean:
rm -rf $(OBJ_DIR) priv $(EBIN)
very_clean: clean
rm -rf config.status autom4te.cache Makefile config.log api_gen/llvm_xml/
shell:
erl -pa ebin
test: compile logs
ct_run -noshell -pa ../llevm/ebin -logdir logs -suite tests/kaleidoscope_SUITE.erl -suite tests/erlang_SUITE.erl