File: 22-rules.txt

package info (click to toggle)
debmake-doc 1.22-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 12,952 kB
  • sloc: makefile: 916; sh: 692; python: 202; ansic: 114; sed: 16
file content (38 lines) | stat: -rw-r--r-- 2,281 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// vim:set filetype=asciidoc:
[[rules]]
=== *debian/rules* file

The *debian/rules* file is the executable script which re-targets the upstream build system to install files in the **$(DESTDIR)** and creates the archive file of the generated files as the *deb* file.  The *deb* file is used for the binary distribution and installed to the system using the *dpkg* command.

The Debian policy compliant *debian/rules* file supporting all the required targets can be written as simple as footnote:[The *debmake* command generates a bit more complicated *debian/rules* file.  But this is the core part.]:

.Simple *debian/rules*:
----
#!/usr/bin/make -f
#export DH_VERBOSE = 1

%:
	dh $@
----

The *dh* command functions as the sequencer to call all required "`**dh** __target__`" commands at the right moment. footnote:[This simplicity is available since version 7 of the *debhelper* package.  This guide assumes the use of *debhelper* version @@@dhcompat@@@ or newer.]

* *dh clean* : clean files in the source tree.
* *dh build* : build the source tree
* *dh build-arch* : build the source tree for architecture dependent packages
* *dh build-indep* : build the source tree for architecture independent packages
* *dh install* : install the binary files to *$(DESTDIR)*
* *dh install-arch* : install the binary files to *$(DESTDIR)* for architecture dependent packages
* *dh install-indep* : install the binary files to *$(DESTDIR)* for architecture independent packages
* *dh binary* : generate the *deb* file
* *dh binary-arch* : generate the *deb* file for architecture dependent packages
* *dh binary-indep* : generate the *deb* file for architecture independent packages

Here, **$(DESTDIR)** path depends on the build type.

* "`**DESTDIR=debian/**__binarypackage__**/**`" for single binary package footnote:[This is the default up to *debhelper* v13.  At *debhelper* v14, it warns the default change. After *debhelper* v15, it will change the default to **DESTDIR=debian/tmp/** .]
* "`**DESTDIR=debian/tmp/**`" for multi binary package

See "`<<rules-custom>>`" and "`<<rules-variables>>`" for customization.

TIP: Setting "`*export DH_VERBOSE = 1*`" outputs every command that modifies files on the build system.  Also it enables verbose build logs for some build systems.