Appendix C: Complex Makefile Example 177
Appendix C Complex Makefile Example
Here is the makefile for the GNU tar program. This is a moderately complex makefile.
The first line uses a #! setting to allow the makefile to be executed directly.
Because it is the first target, the default goal is ‘all’. An interesting feature of this
makefile is that testpad.h is a source file automatically created by the testpad program,
itself compiled from testpad.c.
If you type ‘make’ or ‘make all’, then make creates the tar executable, the rmt daemon
that provides remote tape access, and the tar.info Info file.
If you type ‘make install’, then make not only creates tar, rmt, and tar.info, but
also installs them.
If you type ‘make clean’, then make removes the ‘.o’ files, and the tar, rmt, testpad,
testpad.h, and core files.
If you type ‘make distclean’, then make not only removes the same files as does ‘make
clean’ but also the TAGS, Makefile, and config.status files. (Although it is not evident,
this makefile (and config.status) is generated by the user with the configure program,
which is provided in the tar distribution, but is not shown here.)
If you type ‘make realclean’, then make removes the same files as does ‘make distclean’
and also removes the Info files generated from tar.texinfo.
In addition, there are targets shar and dist that create distribution kits.
#!/usr/bin/make -f
# Generated automatically from Makefile.in by configure.
# Un*x Makefile for GNU tar program.
# Copyright (C) 1991 Free Software Foundation, Inc.
# This program is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License ...
...
...
SHELL = /bin/sh
#### Start of system configuration section. ####
srcdir = .
# If you use gcc, you should either run the
# fixincludes script that comes with it or else use
# gcc with the -traditional option. Otherwise ioctl
# calls will be compiled incorrectly on some systems.
CC = gcc -O
YACC = bison -y
INSTALL = /usr/local/bin/install -c
INSTALLDATA = /usr/local/bin/install -c -m 644
Comentários a estes Manuais