Welcome to KUSP Utility Makefile’s documentation!

Contents:

The KUSP Utility Makefile was created in order to automate many of the repetitious tasks that we do in order to build, install, and test the KUSP software package. This has been expanded several times, so it contains many targets that all perform small useful tasks. The small tasks are used by chaining them together in order to carry out a complex task in one line of code, rather than having to type every step at the command line.

The Makefile is named kusp.mk and can be found at <kusp-root>/kusp.mk. You can run the Makefile by:

bash> make -f kusp.mk [targets]

Notes

  1. This Makefile produces an error file for each target, ~/tmp/kusp_mk_<name-of-target>.out, to help localize errors – rather than having one large file to look through. If there is a make error, take note of the step on which make failed take a look at the error output.
  2. This was originally created for my own personal use to make my life easier. There were a few requests for me to add this to the code repository. After adding the Makefile to the repository came a few requests for documentation, so here it is.
  3. Feel free to append and improve any of the existing code, If you do please let everyone know via the kusp email list. I use this Makefile on a day to day basis, so for my own sanity make sure that if you make too many drastic-backwards-incompatible changes make an extra saved copy of the original.
  4. As of the time of writing this documentation, the kusp.mk file should only be executed within the <kusp-root> directory. There are many locations that use this as a reference directory, and most of the steps will fail if this is not taken into account.

Failure has its problems, but success has problems as well. The problems of success are often preferable to those of failure, but they are, nonetheless, problems.

-Douglas Niehaus

Global Makefile Variables

  • CLEAN_PREFIX:

    The directory to use as the root install prefix when executing the do_uninstall script (by running the *

  • KUSP_VERSION =0.9

  • RPM_RELEASE =5

  • STEP_NUMBER =1

Targets

build-all:

Depends On: kusp-build, kusp-install

Builds and installs the KUSP source to the directory defined by the bash environmental variable $KUSPINSTALL. Make sure to have the $KUSPINSTALL variable defined in your .bashrc or on the command line when executing this target.

rebuild-all:

Depends On: kusp-rebuild, kusp-install

First this target removes the old build directory, then it builds and installs the KUSP source to the directory defined by the bash environmental variable $KUSPINSTALL. Make sure to have the $KUSPINSTALL variable defined in your .bashrc or on the command line when executing this target.

Since CMake has a propensity to cache information that can make rebuilding from a bigger change easier, since this will destroy all of the old CMake cache files (as well as the other compiled source files).

check-build-dir:

Checks to see if a build directory has been created under whichever directory is the root of your KUSP install. If the directory does not exist, then it creates a build directory to use.

kusp-rebuild:

Depends On: check-build-dir, dist-clean

First this target removes the old build directory, creates a new <kusp-root>/build directory, and then it builds the KUSP source.

Since CMake has a propensity to cache information that can make rebuilding from a bigger change easier, since this will destroy all of

kusp-build:

Depends On: check-build-dir

Configures (using CMake) and builds the kusp source in the <kusp-root>/build directory.

kusp-install:

Installs the built KUSP source into the directory defined by the bash environmental variable $KUSPINSTALL. Make sure to have

build-examples (Not currently functioning):

Should build the examples, I don’t think that it does currently.

clean:

Fixme.D: This should also have check-build-dir as a prerequisite target.

Performs a make clean on the <kusp-root>/build directory. This removes all of the built source file but does not remove the hazardous CMake cache files.

dist-clean:

Depends On: check-build-dir

Check to make sure that the build directory exists, then removes ALL contents of the <kusp-root>/build directory.

uninstall:

Executes an uninstall using the do_uninstall script.

svn-update:

Simply runs:

bash> svn up

on the <kusp-root> directory. This target is useful for automation through chaining of the Makefile targets. An example is how it is used by the rpm target in order to get the most current source before creating an RPM of the source code.

tarball:

FIXME.D: Would be more robust/flexible to split this into two targets.
a tarball and move targets? Or perhaps an extra tarball-for-rpm target.

FIXME.D: This also could have another Makefile variable ‘SOURCE DIRECTORY PATH’ to tarball.

Creates a tarball of the source code and moves it to ~/rmpbuild/sources.

Note: This only works if the name of the <kusp-root> directory is kusp. For me this means I keep another ‘vanilla’ kusp directory checked out of the code repository with the name of kusp, in my ~/tmp directory.

For Example:

bash> mkdir ~/tmp
bash> cd ~/tmp
bash> svn co https://subversion.ittc.ku.edu/svn/libertos/kusp/trunk kusp

Remember this target is a dependent target of the rpm step, so it is important if you are using this target or a target that uses it as a dependent then you will have to follow some sort of steps to not check out the kusp/trunk as something other than ‘kusp’ if you want to tar the source with this command or if you want to build an rpm.

exec-rpmbuild:

Runs the rpmbuild program:

bash> cd <kusp-root>/rpms
bash> rpmbuild -ba -vv kusp.spec

rpmbuild arguments

  • ba (Build All): Build both a binary rpm and a source rpm.
  • -vv (Very Verbose): Explicitly state what is being done at each step, including an enormous amount of debug information.
  • kusp.spec: The name of the KUSP RPM specification file. This file can be found at <kusp-root>/rpms/kusp.spec.

FIXME.D: Link rpm_and_rpmbuild documentation to this page.

rpm:

Depends on: svn-update, tarball, exec-rpmbuild

Creates the KUSP rpm by updating to the latest code from the subversion repository, tarballing the source, moving the previously created tarball to the ~/rpmbuild/SOURCES directory, and executing the rpmbuild program to build the RPM from the KUSP source tarball using the procedure defined in the kusp.spec file.

The resultant binary RPM can be found at ~/rpmbuild/RPMS/<name-of-arch>/kusp-<version>-<release>.<distro>.<architecture>.rpm.

Example of the path to the a created RPM:

~/rpmbuild/RPMS/i586/kusp.0.9-5.fc11.i586.rpm

remove-rpm:

Attempts to find an previously install KUSP RPM. If found, it removes the RPM.

Note: This step requires you to enter your sudo password.

install-rpm:

Note: Only for Fedora 11.

Installs the KUSP RPM ~/rpmbuild/RPMS/i586/kusp-$(KUSP_VERSION)-$(RPM_RELEASE).fc11.i586.rpm.

auto-rpm-install:

Depends On: remove-rpm rpm, install-rpm

Builds a new KUSP RPM, uninstalls any previously created RPM (as a safety check), and then installs the newly created RPM.