Permalink
Browse files

Massive autotools refactoring & cleanup

Now, all makefile are generated by automake. This way, many things are more
configurable and maintainable.

Main (visible) changes:

 * Now, you can configure and compile Yaws outside the source directory. It is
   also possible to generate an archive for distribution, using the 'dist' target
   (from now, 'distcheck' target should always pass).

 * We track .erl dependencies using '-M*' flags of ERLC.

 * generated header 'yaws_configure.hrl' disappears. HAVE_SENDFILE,
   HAVE_ERLANG_SENDFILE and HAVE_CRYPTO_HASH macros are defined in ERLC flags.

 * yaws_generated:localinstall/0 function disappears (see comment about local
   install).

 * To create a windows installer, we just need to run the 'mkinstaller'
   target. Read win32/README.developer for details.

 * We use standard Erlang installation path for Yaws, relative to the erlang
   library directory (/usr/lib/erlang/lib). Now, '$(libdir)/yaws' is a link. We
   do the same for yapp application.

 * "local install" was removed. Now, to do a "developer install", we just need
   to set a prefix during the project configuration using --prefix option. So,
   you need to install yaws to test it.

 * DESTDIR variable is still supported.

 * scripts/make-release was rewritten to use 'dist' and 'mkinstaller' targets.

 * Installation of Yaws applications has slightly changed. Now they are
   installed in their own directory, in '$(localstatedir)/yaws'. So, chat
   application will be installed in '$(localstatedir)/yaws/chat', with 'www' and
   'ebin' subdirs.

Main targets (others than all/install/clean....):

  * all           : compile Yaws
  * debug         : compile Yaws with debug flags
  * clean         : remove files produced by all or debug target
  * install       : do a proper install of Yaws
  * doc or docs   : build the documentation
  * check or test : launch tests
  * cleantest     : remove files produced by check target
  * dialyzer      : run dialyzer on Yaws
  * mkinstaller   : build an installer for windows
  * cleaninstaller: remove files produced by mkinstaller target
  * apps          : compile Yaws applications (chat,mail,wiki,yapp)
  * cleanapps     : remove files produced by apps target
  * installapps   : install Yaws applications
  * fullinstall   : install + installapps
  * fullclean     : clean + cleantest + cleanapps + cleaninstaller

  To install an application, run: (cd application/{APP} && make install)

Of course, many things can be customized during configuration and Rebar still
works as expected. To do an install with (almost) the same tree than with
previous of Yaws, do:

  $> ./configure yawsdir=${prefix}/lib/yaws yappdir=${prefix}/lib/yapp \
        --sysconfdir=/etc --localstatedir=/var
  $> make install

Here is the default installation tree on my debian:

   usr
    ├── lib
    │   └── erlang
    │       └── lib
    │           ├── yapp-0.4.2
    │           │   ├── doc/
    │           │   ├── ebin/
    │           │   ├── examples/
    │           │   └── priv/docroot/
    │           └── yaws-1.98
    │               ├── ebin/
    │               ├── include/
    │               └── priv/
    │               ├── examples/
    │
    ├── local/bin/yaws
    │
    ├── local/etc/init.d/yaws
    ├── local/etc/yaws/
    ├── local/etc/mail/yaws-webmail.conf
    │
    ├── local/lib/pkgconfig/yaws.pc
    ├── local/lib/yapp -> /usr/lib/erlang/lib/yapp-0.4.2
    ├── local/lib/yaws -> /usr/lib/erlang/lib/yaws-1.98
    │
    ├── local/share/doc/yaws/yaws.pdf
    ├── local/share/man/{man1,man5}/
    │
    ├── local/var/log/yaws
    ├── local/var/run/yaws
    └── local/var/yaws
        ├── chat/{ebin,www}
        ├── mail/{ebin,www}
        ├── wiki/{ebin,www}
        └── www
  • Loading branch information...
1 parent c266017 commit cba96bca06184a1237aab7dfa15571ce8055c171 @capflam capflam committed Jun 10, 2014
Showing 336 changed files with 4,007 additions and 8,360 deletions.
View
@@ -1,46 +1,78 @@
+*.Pbeam
*.beam
*.o
+*.lo
+*.la
*.so
*.access
*.dat
+*.exe
autom4te.cache
+libtool
auth.log
report.log
+ac-aux/
+aclocal.m4
+autom4te.cache/
+m4/libtool.m4
+m4/lt*.m4
+config.h*
+config.log*
+config.status*
configure
+Makefile
+Makefile.in
+.deps
+c_src/.libs
+c_src/epam
erl_crash.dump
yaws.pc
yaws.plt
-bin/yaws
-config.log
-config.status
-ebin/yaws.app
-include.mk
-priv/epam
-scripts/yaws.conf
src/mime_types.erl
-src/yaws_configure.hrl
src/yaws_generated.erl
src/yaws_charset.hrl
src/yaws_appdeps.hrl
-src/yaws.app.src
+ebin/yaws.app
+ebin/yaws.appup
+priv/epam
test/ibrowse
test/ibrowse.tar.gz
-test/support/include.mk
-test/support/include.sh
-test/t1/localhost:8000/
-test/t[1-9]/logs/
-test/t[1-9]/yaws.conf
-test/t1[0-1]/logs/
-test/t1[0-1]/yaws.conf
-test/t2/embedded_listen:8000.auth
-test/t4/www2/8388608.bin
-test/t11/src/srcdir_test.hrl
-test/eunit/localhost:8000.auth
+test/*/*.auth
+test/*/*.access
+test/*/*.log
+test/*/logs/
+test/*/docroot-test
+test/*/*.conf
+test/t1/yaws.conf.orig
+test/t4/docroot-test1
+test/t4/docroot-test2
+test/t11/include
www/yaws.pdf
www/yaws.ps
-www/*.txt
-www/*.txt.*
-www/test.php
+doc/a.pdf
+doc/b.pdf
+doc/layout.pdf
+doc/yaws.aux
+doc/yaws.dvi
+doc/yaws.log
+doc/yaws.out
+doc/yaws.pdf
+doc/yaws.ps
+doc/yaws.toc
+doc/yaws_head.pdf
+man/*.pdf
+scripts/make-release
+win32/build.xml
+dialyzer_warnings
+rel/yaws
+deps
+etc/
+var/
+bin/
+yaws_logs/
+.eunit/*
+.rebar/*
+yaws-*.tar.gz
applications/yapp/doc/edoc-info
applications/yapp/doc/erlang.png
applications/yapp/doc/index.html
@@ -62,22 +94,3 @@ applications/wiki/scripts/addFile
applications/wiki/scripts/getPassword
applications/wiki/scripts/importFiles
applications/wiki/scripts/updateWiki
-doc/a.pdf
-doc/b.pdf
-doc/layout.pdf
-doc/yaws.aux
-doc/yaws.dvi
-doc/yaws.log
-doc/yaws.out
-doc/yaws.pdf
-doc/yaws.ps
-doc/yaws.toc
-doc/yaws_head.pdf
-ebin/yaws.appup
-etc
-yaws_logs
-rel/yaws
-dialyzer_warnings
-deps/*
-.eunit/*
-.rebar/*
View
@@ -1,99 +0,0 @@
-
-SUBDIRS = c_src src man www/shoppingcart www/code doc scripts \
- examples/src
-include ./include.mk
-include ./vsn.mk
-
-PKGCONFIG_FILES = yaws.pc
-
-all debug clean:
- @set -e ; \
- for d in $(SUBDIRS) ; do \
- if [ -f $$d/Makefile ]; \
- then ( cd $$d && $(MAKE) $@ ) || exit 1 ; \
- fi ; \
- done
- rm -rf yaws-${YAWS_VSN}.script yaws-${YAWS_VSN}.boot
- rm -rf yaws-${YAWS_VSN}.rel yaws-${YAWS_VSN}.tar.gz
-
-cleantests:
- cd test && $(MAKE) clean
-
-clean: cleantests
-
-install: all
- set -e ; \
- for d in $(SUBDIRS) ; do \
- if [ -f $$d/Makefile ]; \
- then ( cd $$d && $(MAKE) $@ ) || exit 1 ; \
- fi ; \
- done
- $(INSTALL) -d $(DESTDIR)$(LIBDIR)/pkgconfig
- $(INSTALL) -m 644 $(PKGCONFIG_FILES) $(DESTDIR)$(LIBDIR)/pkgconfig
- @echo "-------------------------------"
- @echo
- @echo "** etc files went into ${ETCDIR}"
- @echo "** executables went into ${prefix}/bin"
- @echo "** library files went into ${LIBDIR}/yaws"
- @echo "** var files went into ${VARDIR}"
- @echo "** default docroot went into ${VARDIR}/yaws/www"
- @echo
- @echo "--------------------------------"
-
-
-docs:
- ( cd doc && $(MAKE) docs )
-
-conf_clean:
- -rm include.mk config.cache config.status config.log yaws.pc \
- test/support/include.mk test/support/include.sh 2> /dev/null
-
-local_install: all
- (cd scripts && $(MAKE) local_install)
-
-
-# Target for folks that want to build a proper OTP release
-# to be used with regular OTP release management.
-release: vsn.mk include.mk yaws.rel.src all
- sed -e "s/%YAWS_VSN%/${YAWS_VSN}/g" \
- -e "s/%ERTS_VSN%/${ERTS_VSN}/" \
- -e "s/%KERNEL_VSN%/${KERNEL_VSN}/" \
- -e "s/%STDLIB_VSN%/${STDLIB_VSN}/" \
- -e "s/%SASL_VSN%/${SASL_VSN}/" \
- -e "s/%MNESIA_VSN%/${MNESIA_VSN}/" \
- < yaws.rel.src > yaws-${YAWS_VSN}.rel
- erlc -pa ./ebin yaws-${YAWS_VSN}.rel
- erl -pa ./ebin -noinput -run systools make_tar yaws-${YAWS_VSN} \
- -s erlang halt
- @echo "-------------------------------"
- @echo
- @echo "Best to rerun this in an Erlang shell to pick up include directory:"
- @echo
- @echo "$$ erl -pa ./ebin"
- @echo "1> systools:make_tar(\"yaws-${YAWS_VSN}\", [{dirs,[include,examples,src]}])."
- @echo
- @echo "--------------------------------"
-
-touch:
- find . -name '*' -print | xargs touch -m
- find . -name '*.erl' -print | xargs touch -m
-
-yaws.plt:
- dialyzer --build_plt -r ebin --output_plt yaws.plt \
- -r $(ERLDIR)/lib/sasl-$(SASL_VSN) \
- -r $(ERLDIR)/lib/kernel-$(KERNEL_VSN) \
- -r $(ERLDIR)/lib/stdlib-$(STDLIB_VSN) \
- -r $(ERLDIR)/lib/erts-$(ERTS_VSN)
-
-# Not debug compiled, let's just ignore it
-# -r $(ERLDIR)/lib/ssl-$(SSL_VSN)
-
-dialyzer: yaws.plt
- -dialyzer -q --plt yaws.plt -r ebin > dialyzer_warnings
- @if diff -U0 known_dialyzer_warnings dialyzer_warnings ; then \
- echo dialyzer check passed ; exit 0 ; \
- else exit 1 ; fi
-
-.PHONY: test
-test: all
- cd test && $(MAKE) all setup test
Oops, something went wrong.

0 comments on commit cba96bc

Please sign in to comment.