浏览代码

erlang: fix Makefile problem

Read from Erlang shell include and library path.
Seudin Kasumovic 10 年之前
父节点
当前提交
01f4a230dc
共有 1 个文件被更改,包括 10 次插入2 次删除
  1. 10 2
      modules/erlang/Makefile

+ 10 - 2
modules/erlang/Makefile

@@ -5,12 +5,20 @@ include ../../Makefile.defs
 auto_gen=
 auto_gen=
 NAME=erlang.so
 NAME=erlang.so
 
 
-LIBS=-L$(LOCALBASE)/lib/erlang/usr/lib -lei -lpthread
+ERLANG=$(shell which erl)
+
+ifneq ($(ERLANG),)
+ERLANG_LIBDIR=$(shell $(ERLANG) -noshell -eval 'io:format("~n~s/lib~n", [[code:lib_dir("erl_interface")]]).' -s erlang halt | tail -n 1)
+ERLANG_INCDIR=$(shell $(ERLANG) -noshell -eval 'io:format("~n~s/include~n", [[code:lib_dir("erl_interface")]]).' -s erlang halt | tail -n 1)
+else
+$(error Not found Erlang)
+endif
+LIBS=-L$(ERLANG_LIBDIR) -lei -lpthread
 
 
 SERLIBPATH=../../lib
 SERLIBPATH=../../lib
 SER_LIBS+=$(SERLIBPATH)/kcore/kcore
 SER_LIBS+=$(SERLIBPATH)/kcore/kcore
 
 
-DEFS+=-I/usr/local/lib/erlang/usr/include
+DEFS+=-I$(ERLANG_INCDIR)
 DEFS+=-DKAMAILIO_MOD_INTERFACE -D_REENTRANT
 DEFS+=-DKAMAILIO_MOD_INTERFACE -D_REENTRANT