Let's move to talk about the target responsible for installing procedures, named install. Here it is how install target looks like:
install: build dh_testdir dh_testroot dh_clean -k dh_installdirs Add here commands to install the package into debian/foo. $(MAKE) DESTDIR=$(CURDIR)/debian/foo install
Install target depends on build target, explained above. Let's get closer to the commands listed in the previous example:
dh_clean -k
In this case, dh_clean specifies the -k option, that prevent debian/dirs file to get deleted. This is necessary to be used anytime you have a debian/rules that has 2 binary targets that build different .deb packages. (e.g packaging libraries, one build target packages the shared libraries, other one -dev package.)
dh_installdirs
This command (part of debhelper) perform the creation of subdirectories in package build directories.
Note: dh_destdir and dh_testroot are explained above.
After executing this commands, the developer will be free to add any other command to install the package after the specified comment:
Add here commands to install the package into debian/foo.
In our case, by default is specified that the package will be installed inside debian/foo, taking foo as the name of the package we are creating. It will make install all files previously configured by the configure/config.status target and compiled by the build target into DESTDIR variable, that can be modified by the developer to suit his needs. Like the clean target, the folder that contains sources files need to be specified not using the local uri, e.g /home/bar/foo/debian/foo but using the $(CURDIR) variable, recognized universally by build systems like pbuilder.
Install target allows the developer to launch debhelper's scripts that will install and place every file in the correct location. I suggest you to check debhelper or dh_- scripts man page available by running man command in a terminal followed by man page section (1-8) and application name (e.g man 1 dh_-).