Skip to content

Commit

Permalink
Fixed 'make install' target
Browse files Browse the repository at this point in the history
  • Loading branch information
saleyn committed May 29, 2010
1 parent ae90817 commit 0ea2ead
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 19 deletions.
10 changes: 9 additions & 1 deletion c_src/Makefile.in
Expand Up @@ -5,7 +5,9 @@ debug=@DEBUG@
package=@PACKAGE@
version=@PACKAGE_VERSION@
MKDIR_P=@MKDIR_P@
INSTALL=@INSTALL@
INST_DIR=../priv
DIST_DIR=@PACKAGE_INSTALL_DIR@/$(notdir $(INST_DIR))

zmq_drv_so_CXXFLAGS=-Wall $(if $(debug),-DZMQDRV_DEBUG) $(CXXFLAGS)
zmq_drv_so_LDFLAGS=-shared -fPIC $(LDFLAGS) -lpthread
Expand All @@ -19,7 +21,13 @@ $(INST_DIR)/zmq_drv.so: zmq_drv.cpp
$(CXX) -o $@ $< ${zmq_drv_so_CXXFLAGS} ${zmq_drv_so_LDFLAGS}

clean:
rm -rf zmq_drv.o ../priv/zmq_drv.so
rm -rf zmq_drv.o $(INST_DIR)/zmq_drv.so

distclean: clean
rm Makefile

install:
$(MKDIR_P) $(DIST_DIR) $(dir $(DIST_DIR))c_src
$(INSTALL) zmq_drv.{h,cpp} $(dir $(DIST_DIR))c_src/
$(INSTALL) $(INST_DIR)/zmq_drv.so $(DIST_DIR)/
$(INSTALL) $(INST_DIR)/zmq_drv.so $(DIST_DIR)/
20 changes: 10 additions & 10 deletions configure.ac
Expand Up @@ -68,16 +68,13 @@ ERLANG_CHECK_RELEASE
AC_ERLANG_SUBST_ERTS_VER

dnl Determine directories for installation.
dnl if test "x${prefix}" = "x"; then
if test "x${prefix}" = "xNONE"; then
dnl Inside Erlang lib directory.
dnl ERLANG_INSTALL_LIB_DIR="${ERLANG_LIB_DIR}"
dnl else
AC_SUBST([PACKAGE_INSTALL_DIR], [${ERLANG_ERTS_DIR%/*}/lib/${PACKAGE}-${VERSION}])
else
dnl Under $prefix
dnl ERLANG_INSTALL_LIB_DIR="${prefix}"
dnl fi

dnl AC_ERLANG_SUBST_INSTALL_LIB_DIR
dnl AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR([zmq], ${PACKAGE_VERSION})
AC_SUBST([PACKAGE_INSTALL_DIR], [${prefix}/${PACKAGE}-${VERSION}])
fi

AC_CHECK_HEADER([${ERLANG_DRV_INCLUDE}/erl_driver.h], [], [
AC_MSG_ERROR([Could not find the 'erl_driver.h' header.
Expand Down Expand Up @@ -159,15 +156,18 @@ dnl ------------------------------------------------------------------
AC_MSG_NOTICE([Erlang environment])

dnl Check for erl_interface (used by port drivers).
AC_CONFIG_FILES([Makefile c_src/Makefile src/Makefile src/zmq.app])
AC_CONFIG_FILES([Makefile c_src/Makefile src/Makefile
ebin/zmq.app:src/zmq.app.in])
AC_OUTPUT

dnl --------------------------------------------------
dnl Configuration report
dnl --------------------------------------------------

echo
AC_MSG_NOTICE([ == ${PACKAGE} ${PACKAGE_VERSION} ==])
AC_MSG_NOTICE([ == Package: ${PACKAGE}-${VERSION} ==])
echo
AC_MSG_NOTICE([ Install dir: ${PACKAGE_INSTALL_DIR}])
echo
AC_MSG_NOTICE([ C++ compiler: ${CXX}])
AC_MSG_NOTICE([ Erlang compiler: ${ERLC}])
Expand Down
22 changes: 14 additions & 8 deletions src/Makefile.in
@@ -1,36 +1,42 @@
ERL=@ERL@
ERLC=@ERLC@
DEBUG=@DEBUG@
MKDIR_P=@MKDIR_P@
INSTALL=@INSTALL@
DIST_DIR=@PACKAGE_INSTALL_DIR@
VSN=@PACKAGE_VERSION@
ERL_FLAGS=@ERL_FLAGS@ -I../include
ERL_SOURCES=$(wildcard *.erl)
EBIN_DIR=../ebin
DOC_DIR=../doc
ERL_OBJECTS=$(ERL_SOURCES:%.erl=$(EBIN_DIR)/%.beam)
DOC_FILES=$(DOC_DIR)/zmq.html
DOC_FILES=$(addprefix $(DOC_DIR)/,index.html modules-frame.html \
overview-summary.html stylesheet.css zmq.html)

all: $(ERL_OBJECTS) $(EBIN_DIR) $(EBIN_DIR)/zmq.app
all: $(ERL_OBJECTS)

$(EBIN_DIR)/%.beam: %.erl
erlc $(ERL_FLAGS) -o ../ebin $<

$(EBIN_DIR)/zmq.app: zmq.app.in
@[ -f $(subst .in,,$<) ] || (echo "Rerun configure script!" && exit 1)
mv -f $(subst .in,,$<) $@

clean:
rm -f $(ERL_OBJECTS)
rm -fr $(DOC_DIR)

distclean: clean
rm -f $(EBIN_DIR)/zmq.app

docs: $(DOC_DIR) $(DOC_FILES)

$(EBIN_DIR) $(DOC_DIR):
mkdir $@
$(MKDIR_P) $@

$(DOC_DIR)/zmq.html: zmq.erl overview.edoc
erl -noshell -run edoc_run application "'zmq'" '"."' \
'[{dir, "$(DOC_DIR)"}, {def, [{version, "$(VSN)"}]}]' -run init stop

install:
@[ -d $(DOC_DIR) ] || (echo "Error: run 'make docs' first!" && exit 1)
$(MKDIR_P) $(DIST_DIR)/src $(DIST_DIR)/ebin $(DIST_DIR)/doc
$(INSTALL) ../src/*.erl $(DIST_DIR)/src/
$(INSTALL) ../ebin/*.{beam,app} $(DIST_DIR)/ebin/
$(INSTALL) ../doc/*.{css,html,png} $(DIST_DIR)/doc
$(INSTALL) ../{README,LICENSE} $(DIST_DIR)

0 comments on commit 0ea2ead

Please sign in to comment.