Changes between Version 1 and Version 2 of pm-base-make


Ignore:
Timestamp:
Jun 1, 2006 7:13:03 PM (14 years ago)
Author:
andreasw
Comment:

copied to correct page

Legend:

Unmodified
Added
Removed
Modified
  • pm-base-make

    v1 v2  
    11= The Package Base Directory Makefile.am File =
    22
     3A typical COIN package base directory {{{Makefile.am}}} file looks like this example taken from Clp:
     4
     5{{{
     6# Copyright (C) 2006 International Business Machines and others.
     7# All Rights Reserved.
     8# This file is distributed under the Common Public License.
     9
     10## $Id: Makefile.am 788 2006-06-01 18:57:08Z andreasw $
     11
     12# Author:  Andreas Waechter           IBM    2006-04-13
     13
     14AUTOMAKE_OPTIONS = foreign
     15
     16EXTRA_DIST = doxydoc/doxygen.conf
     17
     18########################################################################
     19#                          Subdirectories                              #
     20########################################################################
     21
     22# subdirs is set by configure as the list of all subdirectories to recurse
     23# into
     24SUBDIRS = $(subdirs)
     25
     26########################################################################
     27#                           Extra Targets                              #
     28########################################################################
     29
     30test: all
     31        cd Clp; make test
     32
     33unitTest: test
     34
     35tests:
     36        for dir in $(subdirs); do \
     37          if test -r $$dir/test/Makefile; then \
     38            (cd $$dir; make test) \
     39          fi; \
     40        done
     41
     42unitTests: tests
     43
     44doxydoc:
     45        cd $(srcdir); doxygen doxydoc/doxygen.conf
     46
     47.PHONY: test unitTest tests unitTests doxydoc
     48
     49########################################################################
     50#                         Maintainer Stuff                             #
     51########################################################################
     52
     53# Files that are generated and should be cleaned with make distclean
     54DISTCLEANFILES =
     55
     56include BuildTools/Makemain.inc
     57}}}
     58
     59 * One should always start with a copyright note and author information, and include the {{{svn:keyword}}} "{{{$Id}}}"
     60
     61 * The '''AUTOMAKE_OPTIONS''' variable is a special variable that indicates certain options for the {{{automake}}} run.  The '''foreign''' option doesn't require the strict conformance with GNU guidelines.
     62
     63 * The '''EXTRA_DIST''' variable is set to every file that should be included in a {{{make dist}}} generated tarball.  One only needs to list non-source files, and non-autotools related files.  In the above example, this is only the configuration file for doxygen.
     64
     65 * The {{{Makefile.am}}} in a package base directory needs to be told into which subdirectories to recurse.  This is done with the '''SUBDIRS''' variable.  The Autoconf output variable is already automatically set to the correct value by {{{configure}}}, based on the results of the {{{AC_COIN_MAIN_SUBDIRS}}} macro tests.
     66
     67 * In the next section we can define '''extra Makefile targets'''.  As you can see, the '''test''' (and '''unitTest''') first make sure that everything is compiled (the target {{{all}}} is the automatically generated target for compilation of everything).  Then it changes into the packages project directory and runs the {{{test}}} target there.  It is also nice to provide a '''tests''' (and '''unitTests''') target, which runs the {{{test}}} targets in every project subdirectory that seems to have a {{{test}}} subdirectory with a Makefile.
     68
     69 * For C++ packages, we usually also provide a target '''doxydoc''', which runs the {{{doxygen}}} program for all source code found in subdirectories.  Note the "'''cd $(srcdir)'''" here.  In case of a VPATH compilation, the Makefile generated from this {{{Makefile.am}}} file is not run in the directory where {{{doxygen}}} should be run.  The Autoconf output variable '''srcdir''' is set to the directory which contains the source code (such as the {{{Makefile.am}}} file) corresponding to the VPATH directory.
     70
     71 * Finally, we '''include the BuildTools include Makefile.am'''.  This makes sure that additional maintainer-specific targets are defined (such as an automatic update of the {{{svn:externals}}} property when the {{{Externals}}} file has been changed).