Hi Axel, Valery et al,
[This mail is not as long as it seems :-)]
On Wed, 13 Feb 2002 13:33:28 -0600
"Axel Naumann" <a.naumann@worldnet.att.net> wrote
concerning "RE: [ROOT] Wanted: "build" subdirectory on AFS":
> Dear Valeri & rootdev,
>
> I completely agree, I was asking for a standardized root Makefile
> for a looong time now - and just wrote my own (yes, not difficult,
> but I think too much to ask for the regular user). It's part of the
> next Fermilab release of root, and we will see if users will pick it
> up.
On Un*x, there's actually some `standard' Makefile for client code.
If you look at the man(1) page of root-config(1), then you'll get some
doc on how to make a client build system that uses Autotools.
Suppose we have a source tree like
somepackage/ -+- lib1/ ----+- Class1.h
| |
| +- Class1.cxx
|
+- lib2/ ----+- Class2.h
| |
| +- Class2.cxx
|
+- prog/ ----+- main.cxx
|
+- scripts/ -+- LoadLib1.C
|
+- LoadLib2.C
* Put in your somepackage/configure.in file stuff like
dnl Put some file in your build tree in the argument
AC_INIT(lib1/Class1.cxx)
dnl Put the name of the package, and version number of package
AM_INIT_AUTOMAKE(somepackage, 1.0)
dnl Check for C and C++ compiler
AC_PROG_CC
AC_PROG_CXX
dnl Check for libtool
AM_PROG_LIBTOOL
dnl Check for ROOT
ROOT_PATH
dnl Output Makefiles - put all Makefiles here
AC_OUTPUT([Makefile
lib1/Makefile
lib2/Makefile
prog/Makefile
scripts/Makefile], [])
* Put in your somepackage/Makefile.am
AUTOMAKE_OPTIONS = foreign
SUBDIRS = lib1 lib2 prog scripts
* Put in somepackage/lib1/Makefile.am
ROOTCINT = @ROOTCINT@
ROOTLDFLAGS = -L@ROOTLIBDIR@
ROOTCPPFLAGS = -I@ROOTINCDIR@
ROOTLIBS = @ROOTLIBS@
ROOTCFLAGS = @ROOTCFLAGS@
AM_CPPFLAGS = $(ROOTCPPFLAGS)
AM_LDFLAGS = $(ROOTLDFLAGS)
pkglib_LTLIBRARIES = libLib1.la
pkginclude_HEADERS = Class.h
libLib1_la_SOURCES = Class1.cxx Class1Dict.cxx
libLib1_la_LDFLAGS = -version-info 1:0
CLEANFILES = *Cint.cxx *Cint.h *~ core
%Cint.cxx %Cint.h:%.h %LinkDef.h
$(ROOTCINT) -f $*Cint.cxx -c $(INCLUDES) $(AM_CPPFLAGS) $<+
* Put something similar to the above in lib2/Makefile.am
* Put in somepackage/prog
ROOTCINT = @ROOTCINT@
ROOTLDFLAGS = -L@ROOTLIBDIR@
ROOTCPPFLAGS = -I@ROOTINCDIR@
ROOTLIBS = @ROOTLIBS@
ROOTCFLAGS = @ROOTCFLAGS@
AM_CPPFLAGS = $(ROOTCPPFLAGS)
AM_LDFLAGS = $(ROOTLDFLAGS) -R @ROOTLIBDIR@
bin_PROGRAMS = prog
prog_SOURCES = main.cxx
prog_LDADD = $(ROOTLIBS) \
$(top_srcdir)/lib1/libLib1.la \
$(top_srcdir)/lib2/libLib2.la
CLEANFILES = *~ core
* Put in somepackage/scripts/Makefile.am
pkgscriptdir = $(pkgdatadir)/scripts
pkgscript_DATA = LoadLib1.C LoadLib2.C
* Make sure that root.m4 (from root/build/misc/root.m4) is somewhere
where aclocal looks for it (usually /usr/share/aclocal), or
alternatively copy it to somepackage/acinclude.m4
If you installed the RPMs or DEBs [1], then root.m4 is installed in
/usr/share/aclocal, and you needn't do anything.
* Make the build system
aclocal
automake -a
autoconf
* You now have a complete build system that you can ship.
* To make a distribution (gzipped tar-ball), simply do
./configure
make dist
* To build and install everything, do
./configure
make install
You may need to pass options to configure e.g.,
./configure --prefix=${HOME} --with-rootsys=/usr/local/root
The later is only needed if you haven't set ROOTSYS environment
variable, or root-config isn't in your PATH environment variable.
If you have GCC installed, but rather want to use another compiler,
then you can override GCC (which Autotools prefer) like
CC=mycc CXX=myc++ ./configure
The installation will be as follows (prefix=/usr/local per default)
<prefix> -+- bin/ -+- prog
|
+- lib/ -+- somepackage/ -+- libLib1.so.1.0
| |
| +- libLib1.so.1 -> libLib1.so.1.0
| |
| +- libLib1.so -> libLib1.so.1
| |
| +- libLib1.la
| |
| +- libLib2.so.1.0
| |
| +- libLib2.so.1 -> libLib2.so.1.0
| |
| +- libLib2.so -> libLib2.so.1
| |
| +- libLib2.la
|
+- include/ -+- somepackage/ -+- Class1.h
| |
| +- Class2.h
|
+- share/ -+- somepackage/ -+- scripts/ -+- LoadLib1.C
|
+- LoadLib2.C
See also my (old) mail [2] to roottalk, though it's technically
outdated, there's a bit more explanations on the stuff.
> Still, it would be nice to have a Makefile.arch separated from
> root/test/Makefile, i.e. just the arch dependent compiler & linker
> switches without any rules, and a Makefile.config that just contains
> the ARCH, THREADS NOEXCEPTION settings used to build root. This
> would allow other makefiles to simply include all root build
> specific settings.
Perhaps this should be a part of root-config?
I do not recommend copying the ROOT buildsystem - it's far to complex
for most client code. The reason for the complexity is basically that
some platforms have `odd' native buildsystems, or none what so ever.
If your only supporting your client code on Un*x that has the GNU
development tools (Autotools basically, and possibly GCC), then use
Autotools. If you need to support your code on Windoze, write a
specialised build stuff for that platform only (I suggest a MSVC
project discription). I have no idea if Autotools are avaliable on
MacOSX, but it seems to me that it should (after all, MacOSX is really
Un*x :-).
> All that can go into test/, no need for an AFS only build subdir.
> Re-inventing the wheel is a bad thing, but only allowing certain
> user groups to use the wheel is not much better, esp for free
> software.
The stuff is really already there (well most of it), so there's really
no need to `reinvent the wheel' as you say. Also, one should keep in
mind, as you rightly point out, that AFS is not avaliable to all ROOT
users, and personally, I think AFS is too much overhead. I personally
prefer to install ROOT into /usr (using the DEBs ofcourse :-) so that
I don't have to care about NFS load, environment variables, and other
stuff that may make things slower or complicated - but that's just
me.
Yours,
Christian Holm Christensen -------------------------------------------
Address: Sankt Hansgade 23, 1. th. Phone: (+45) 35 35 96 91
DK-2200 Copenhagen N Cell: (+45) 28 82 16 23
Denmark Office: (+45) 353 25 305
Email: cholm@nbi.dk Web: www.nbi.dk/~cholm
[1] http://cholm.home.cern.ch/cholm/root#rpm
[2] http://root.cern.ch/root/roottalk/roottalk01/1108.html
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:41 MET