28 Top-level Makefile

 28.1 Necessary Programs
 28.2 Files and Directories
 28.3 The Default Target
 28.4 The Top-Level Targets
 28.5 The Interactive Loop
 28.6 Installation and Uninstallation
 28.7 Generation and Inclusion of Makefile.def
 28.8 Generation and Inclusion of Makefile.inc
 28.9 Documentation
 28.10 Local Customization
 28.11 Cleaning up
 28.12 Upgrading ALLPROSE
 28.13 Producing an ALLPROSE Release Distribution
 28.14 Producing a Release Distribution of the Project Files
 28.15 Debugging the ALLPROSE Building Process

This is the top-level Makefile and should be present in any distribution of ALLPROSE. If it is not present, then one can generate it from Makefile.nw by calling

notangle -t8 Makefile.nw > Makefile

The definitions of ALLPROSELIBPROJECTNAME, ALLPROSELIBPREFIX, and ALLPROSELIBRARYNAME are only used by ALLPROSE to hardlink to a sample library project that comes with ALLPROSE. These are the default values for PROJECTNAME, LIBPREFIX, and LIBRARYNAME in Makefile.def.nw.

However, the variables ALLPROSEMAJORVERSION, ALLPROSEMINORVERSION, and ALLPROSEPATCHVERSION refers to the version of ALLPROSE.

The basic structure of the complete Makefile.nw is as follows.

346* 21+   327  422
#------------------------------------------------------------------
#---
#--- ALLPROSE
#--- Copyright (C) Ralf Hemmecke (ralf@hemmecke.de)
#--- http://www.hemmecke.de/aldor
#---
#------------------------------------------------------------------

THISDIR=.
export PROJECTROOT=$(CURDIR)

export ALLPROSELIBPROJECTNAME=MyAlps
export ALLPROSELIBPREFIX=my
export ALLPROSELIBRARYNAME=myalps
export ALLPROSEMAJORVERSION=0
export ALLPROSEMINORVERSION=2
export ALLPROSEPATCHVERSION=6

all: alldefault

necessary programs 348
list of files and directories 351a
Generate and include Makefile.def 358
Generate and include Makefile.inc 359
the default target: alldefault 352
testing the library 353
installing and uninstalling the library 357a
documentation 360
local documentation customization 388
cleanup 400
upgrading ALLPROSE 403
make ALLPROSE distribution file 408
make project distribution file 418

Defines:
all, used in chunks 131, 352, 353, 357a, 374, 375, 377, 451b, 456, 457, 459, 486, 540, and 553.
ALLPROSELIBPREFIX, used in chunk 124.
ALLPROSELIBPROJECTNAME, used in chunks 124, 362, and 415a.
ALLPROSELIBRARYNAME, used in chunks 124, 362, 403, 436, 532a, and 535.
ALLPROSEMAJORVERSION, used in chunks 124 and 362.
ALLPROSEMINORVERSION, used in chunks 124 and 362.
ALLPROSEPATCHVERSION, used in chunks 124 and 362.
PROJECTROOT, used in chunks 356, 362, 373a, 423b, 431, 435, 439, 451, 456, 457, 462, 464a, 466, 499, 504, 510, 544–47, and 553.
THISDIR, used in chunks 435, 456–58, and 539.

Uses alldefault 352.

We build every generated file below the current directory and never touch any directory outside this tree.

Note that the variable CURDIR is GNU specific and refers to the absolute path of the current directory, so one must use the GNU version of MAKE.

We define above the variable THISDIR in every subdirectory. THISDIR is the current directory relative to PROJECTROOT.

Convention 20 We assume that every Makefile in any subdirectory defines the variable THISDIR and includes the files Makefile.def.nw and Makefile.inc.nw.