THRIFT-646. erl: Erlang library is missing install target
authorBryan Duxbury <bryanduxbury@apache.org>
Sun, 2 May 2010 22:54:22 +0000 (22:54 +0000)
committerBryan Duxbury <bryanduxbury@apache.org>
Sun, 2 May 2010 22:54:22 +0000 (22:54 +0000)
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

configure.ac
lib/erl/Makefile.am [moved from lib/erl/Makefile with 57% similarity]

index 205cd13..cc71f53 100644 (file)
@@ -259,6 +259,7 @@ AC_CONFIG_FILES([
   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
similarity index 57%
rename from lib/erl/Makefile
rename to lib/erl/Makefile.am
index 77fe8b6..ee8fbff 100644 (file)
@@ -17,6 +17,9 @@
 # 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
 
@@ -25,8 +28,20 @@ all clean docs:
                (cd $$dir; ${MAKE} $@); \
        done
 
+ERLLIBDIR=$(DESTDIR)$(ERL_LIB_ROOT_DIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+
 install: all
-       echo 'No install target, sorry.'
+       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
 
@@ -35,3 +50,8 @@ 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