USAGE.md 3.5 KB

Configuring the most important features

The makefilet make modules should be configured with the following steps:

  1. make sure that makefilet is available (see README for different approaches)
  2. add the include directive at the top of the Makefile: include makefilet/main.mk Only few variables (e.g. PYPI2DEB_PACKAGES) that influence the names of targets need to be defined before this include statement.
  3. store the current release in a file called ./VERSION (resp.: $(CURRENT_VERSION_FILE)): echo "1.0" > VERSION
  4. create ./.bumpversion.cfg with a content similar to the following:

    [bumpversion:file:VERSION]
    
    [bumpversion:file:foo/__init__.py]
    search = ^VERSION = "{current_version}"
    
  5. optional: create a "help" target and describe project-specific targets

    help:
        @echo "Useful targets for FOO:"
        @echo "    bar      prepare the fun"
        @echo "    baz      enjoy the result"
        @echo
    
  6. for python packages: define the directory containing your setup.py (defaults to "."): DIR_PYTHON_SETUP = foo/bar

  7. for repositories requiring git submodules for the build process:

    DEBIAN_PACKAGE_SUBMODULE_DIRECTORIES = submodule1/foo submodule2/bar
    

    You may also define a prep-source:: make target (mind the double colon) to run some actions prior to the creation of the source archive

8) for repositories creating additional deb packages directly from pypi (via pypi2deb):

```
PYPI2DEB_PACKAGES = marshmallow spidev
```
BEWARE: this variable needs to be set _before_ the include statement for "main.mk".

Common targets to be overwritten

This include file adds the following implicit dependencies:

  • clean
  • dist
  • install
  • report
  • test

These targets depend on related targets within the specific sub modules (if applicable).

Feel free to define these targets in your own Makefile, if you need custom operations.

Specific sub-targets implemented by the various modules

The following targets are implemented:

  • dist-deb-packages-directory: create the deb packages and store the resulting package files (with the version string and architecture stripped from the filename) in the directoryDIR_DEBIAN_SIMPLIFIED_PACKAGE_FILES`. This includes deb package files created via "dist-deb" and "dist-pypi2deb".
  • dist-deb: create the deb packages and store them in DIR_DEBIAN_BUILD
  • init-deb: create an example deb packaging in the 'debian/' directory (via 'dh_make')
  • upload-deb: upload the deb packages to the internal repository
  • dist-pypi2deb: create deb packages via pypi2deb directly from the Python package index
  • upload-pypi2deb: upload the packages created via pypi2deb to the internal repository
  • dist-python: build a python module via setup.py
  • upload-python: upload the python module to the internal pypi repository
  • test-deb: run lintian for a deb package
  • test-python: run flake8
  • release-(major|minor|patch): increment version number and commit this change
  • release-undo: revert the last commit, if it was a release (see above)
  • release-push: push the changes (commits and tags) after a release

Variables

The following variables are initialized with sane defaults:

  • RM
  • PYTHON_BIN
  • PYPI2DEB_PYTHON_PREFIX (default: "python3", may also be "python")
  • BUILD_ID (based on the git commit hash)
  • DIR_BUILD
  • DIR_DIST
  • DESTDIR

Functions

The following functions can be called via $(call FOO,bar,baz):

  • get_current_version