erlang: Eliminate "behaviour undefined" warnings
Build behaviour modules first and include the ebin directory in
the Erlang code path during the rest of the build.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@991002 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/erl/src/Makefile b/lib/erl/src/Makefile
index 980af81..78af14f 100644
--- a/lib/erl/src/Makefile
+++ b/lib/erl/src/Makefile
@@ -27,6 +27,7 @@
MODULES = $(shell find . -name \*.erl | sed 's:^\./::' | sed 's/\.erl//')
MODULES_STRING_LIST = $(shell find . -name \*.erl | sed 's:^\./:":' | sed 's/\.erl/",/')
+BEHAV_MODULES = $(shell find . -name \*.erl | xargs grep -l behaviour_info | sed 's:^\./::' | sed 's/\.erl//')
HRL_FILES=
INTERNAL_HRL_FILES= $(APP_NAME).hrl
@@ -43,7 +44,8 @@
APPUP_TARGET= $(EBIN)/$(APPUP_FILE)
BEAMS= $(MODULES:%=$(EBIN)/%.$(EMULATOR))
-TARGET_FILES= $(BEAMS) $(APP_TARGET) $(APPUP_TARGET)
+BEHAV_BEAMS= $(BEHAV_MODULES:%=$(EBIN)/%.$(EMULATOR))
+TARGET_FILES= $(BEHAV_BEAMS) $(BEAMS) $(APP_TARGET) $(APPUP_TARGET)
WEB_TARGET=/var/yaws/www/$(APP_NAME)
@@ -53,7 +55,8 @@
ERL_FLAGS +=
ERL_INCLUDE = -I../include -I../../fslib/include -I../../system_status/include
-ERL_COMPILE_FLAGS += $(ERL_INCLUDE)
+ERL_BEHAV_PATH = -pz ../ebin
+ERL_COMPILE_FLAGS += $(ERL_INCLUDE) $(ERL_BEHAV_PATH)
# ----------------------------------------------------
# Targets