# The Makefile

A quick overview of the debian-cd Makefile: what it does, and how.

## Variable setup and checking

Simple sanity checking that all the needed variables from CONF.sh are present and correct, and also set up some more internal variables:

- `BUILD_DATE` - simply, the date and time of the build
- `ARCHES_NOSRC` - the list of arches specified, minus source
- `SOURCEONLY` - set only if we're building source and no binaries
- `INC_SOURCE` - set if we're building source at all
- lots of variables pointing to the helper scripts
- `BDIR` - the working dir for temporary files
- `ADIR` - an alias for APTTMP, as set in CONF.sh
- `DB_DIR` - points to a debootstrap temp dir under BDIR
- `PATH` - we add the debootstrap /usr/sbin dir to the path
- `LATEST_DB` - the full path to the most recent version of debootstrap in the archive

  ### `default:`

  There is not a sensible default action for the Makefile (e.g. make all), so simply print a message and return.

  ### `ok:`

  Simple sanity checking.

  ### `$(MIRROR)/doc:`, `$(MIRROR)/tools:` and `need-complete-mirror`

  Ensure that we have all the needed pieces of the archive.

  ## General initialisation and cleanup

  ### `init:`

  Depends on a group of trivial small rules - make the temp dirs as necesssary, and extract the latest debootstrap deb from LATEST_DB above.

  ### `clean: and dir-clean:`

  Clean up build tress.

  ### `realclean: and distclean:`

  Delete all temporary state.

  ## Package lists and apt setup

  ### `$(CODENAME)_status:`

  Use the (maybe provided) default starting package list for $(CODENAME). If that doesn't exist, fall back to "make status".

  ### `status:` and `$(ADIR)/status:`

  Create an initial list of the packages desired.

  First, for BC and NETINST (aka INSTALLER_CD=1 or INSTALLER_CD=2), simply create an empty list. For other CDs, grab the list of Required/Important/Standard/Base packages from the Packages file.

  Secondly, create/update the temporary apt db using `apt-selection`.

  Finally, use `apt-selection` to check the consistency of the standard system in terms of dependencies. If needed, run `make correctstatus` to add/remove packages.

  ### `correctstatus:`

  Add/remove packages as needed to fix up the dependencies.

  ### `apt-update:`

  After setting up the default list of packages, run `apt-selection update` for each of the arches, so we're ready to ask apt to do real work for us.

  ### `deletelist:`

  Simple list cleanup

  ### `packagelists:`

  Helper for dependencies

  ### `$(BDIR)/rawlist:`

  Using debootstrap and the task file specified, generate a "raw" (i.e. not cleanly formatted) list of the packages desired.

  ### `genlist:`, `$(BDIR)/list`

  Clean up the rawlist files ready for use.

  ## Tree and image building

  ### `image-trees:`

  Does a lot of work, via three scripts:

  - Sort the output from genlist into dependency order using `list2cds` for each arch in turn, outputting to $(BDIR)/packages.$ARCH.
  - Merge the output of those separate package lists (if necessary), outputting to $(BDIR)/packages using `merge_package_lists`.
  - Now we have a sorted list of (potentially multi-arch) packages ready to start using. Make the temporary trees using that list - call `make_disc_trees.pl`

  ### `images:`

  Using the trees from `image-trees:`, convert those trees into CD/DVD ISO/jigdo files as required.

  ### `image:` and `check-number-given:`

  If you're short on space, will allow you to create images one ISO at a time - specify `CD=n` on the make command line to just make CD number n.

  ### `imagesums:`

  Use the `imagesums` script to generate md5sums for the output images.

  ## Misc targets

  ### `update-popcon`

  Update the sorting order for packages using usage stats from popcon.debian.org.

  ### `official_images:`

  Simple wrapper that depends on all the needed bits in the right order.

  (c) Steve McIntyre <steve@einval.com>, December 2006. GPL v2
  Prev - Running
  Next - The helper scripts, where most of the work happens