Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

74 lines (56 sloc) 2.022 kb
# 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) --libs` #-lEnhancedDisassembly -lLTO
# 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@/
LDFLAGS=@LDFLAGS@
LDFLAGS+=$(LLVM_LDFLAGS)
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) $(LDFLAGS) -o $@
priv/$(ARCH) $(OBJ_DIR) $(EBIN) $(INCLUDE_DIR) logs:
@mkdir -p $@
clean:
rm -rf $(OBJ_DIR) priv $(EBIN) api_gen/llvm_xml api_gen/*.beam
very_clean: clean
rm -rf config.status autom4te.cache Makefile config.log
copy:
cp src/llevm.erl ~/Downloads/nif/llevm/
cp include/llevm.hrl ~/Downloads/nif/llevm/
cp csrc/llevm.c ~/Downloads/nif/llevm/
copy_test:
cp src/llevm.erl ~/Downloads/nif/llevm_test/
cp include/llevm.hrl ~/Downloads/nif/llevm_test/
cp csrc/llevm.c ~/Downloads/nif/llevm_test/
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
Jump to Line
Something went wrong with that request. Please try again.