THRIFT-646. erl: Erlang library is missing install target
This patch adds a new install target to the erlang makefile. It also converts the Makefile to Makefile.am
Patch: Anthony Molinaro
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@940326 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/configure.ac b/configure.ac
index 205cd13..cc71f53 100644
--- a/configure.ac
+++ b/configure.ac
@@ -259,6 +259,7 @@
lib/cpp/thrift-nb.pc
lib/cpp/thrift-z.pc
lib/csharp/Makefile
+ lib/erl/Makefile
lib/java/Makefile
lib/perl/Makefile
lib/perl/test/Makefile
diff --git a/lib/erl/Makefile b/lib/erl/Makefile
deleted file mode 100644
index 77fe8b6..0000000
--- a/lib/erl/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-MODULES = \
- src
-
-all clean docs:
- for dir in $(MODULES); do \
- (cd $$dir; ${MAKE} $@); \
- done
-
-install: all
- echo 'No install target, sorry.'
-
-check: all
-
-distclean: clean
-
-# Hack to make "make dist" work.
-# This should not work, but it appears to.
-distdir:
diff --git a/lib/erl/Makefile.am b/lib/erl/Makefile.am
new file mode 100644
index 0000000..ee8fbff
--- /dev/null
+++ b/lib/erl/Makefile.am
@@ -0,0 +1,57 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# directory where erlang library code should live
+ERL_LIB_ROOT_DIR=$(shell erl -eval 'io:format("~s~n", [code:lib_dir()])' -s init stop -noshell)
+
+MODULES = \
+ src
+
+all clean docs:
+ for dir in $(MODULES); do \
+ (cd $$dir; ${MAKE} $@); \
+ done
+
+ERLLIBDIR=$(DESTDIR)$(ERL_LIB_ROOT_DIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+
+install: all
+ mkdir -p $(ERLLIBDIR) ; \
+ mkdir -p $(ERLLIBDIR)/ebin ; \
+ mkdir -p $(ERLLIBDIR)/include ; \
+ mkdir -p $(ERLLIBDIR)/src ; \
+ for i in ebin/*.app* ; do $(INSTALL) $$i $(ERLLIBDIR)/$$i ; done ; \
+ for i in ebin/*.beam ; do $(INSTALL) $$i $(ERLLIBDIR)/$$i ; done ; \
+ for i in include/*.hrl ; do $(INSTALL) $$i $(ERLLIBDIR)/$$i ; done ; \
+ for i in src/*.erl ; do $(INSTALL) $$i $(ERLLIBDIR)/$$i ; done
+
+uninstall:
+ rm -rf $(ERLLIBDIR)
+
+check: all
+
+distclean: clean
+
+# Hack to make "make dist" work.
+# This should not work, but it appears to.
+distdir:
+
+MAINTAINERCLEANFILES = Makefile.in
+
+maintainer-clean:
+ test ! -d ebin || rm -rf ebin