• No se han encontrado resultados

Presentación del programa diseñado y una breve programación en C# del interfaz

3.2. Solución del problema

3.2.8. Presentación del programa diseñado y una breve programación en C# del interfaz

Delete all the installed files—the copies that the ‘install’ target creates. This rule should not modify the directories where compilation is done, only the directories where files are installed.

The uninstallation commands are divided into three categories, just like the in- stallation commands. SeeSection 14.6 [Install Command Categories], page 127. ‘install-strip’

Like install, but strip the executable files while installing them. In simple cases, this target can use the installtarget in a simple way:

install-strip:

$(MAKE) INSTALL_PROGRAM=’$(INSTALL_PROGRAM) -s’ \ install

But if the package installs scripts as well as real executables, theinstall-strip target can’t just refer to theinstall target; it has to strip the executables but not the scripts.

install-stripshould not strip the executables in the build directory which are being copied for installation. It should only strip the copies that are installed. Normally we do not recommend stripping an executable unless you are sure the program has no bugs. However, it can be reasonable to install a stripped exe- cutable for actual execution while saving the unstripped executable elsewhere in case there is a bug.

‘clean’

Delete all files from the current directory that are normally created by build- ing the program. Don’t delete the files that record the configuration. Also preserve files that could be made by building, but normally aren’t because the distribution comes with them.

Delete ‘.dvi’ files here if they are not part of the distribution. ‘distclean’

Delete all files from the current directory that are created by configuring or building the program. If you have unpacked the source and built the program without creating any other files, ‘make distclean’ should leave only the files that were in the distribution.

‘mostlyclean’

Like ‘clean’, but may refrain from deleting a few files that people normally don’t want to recompile. For example, the ‘mostlyclean’ target for GCC does not delete ‘libgcc.a’, because recompiling it is rarely necessary and takes a lot of time.

‘maintainer-clean’

Delete almost everything from the current directory that can be reconstructed with this Makefile. This typically includes everything deleted by distclean, plus more: C source files produced by Bison, tags tables, Info files, and so on. The reason we say “almost everything” is that running the command ‘make maintainer-clean’ should not delete ‘configure’ even if ‘configure’ can be remade using a rule in the Makefile. More generally, ‘make maintainer-clean’ should not delete anything that needs to exist in order to run ‘configure’ and then begin to build the program. This is the only exception;maintainer-clean should delete everything else that can be rebuilt.

The ‘maintainer-clean’ target is intended to be used by a maintainer of the package, not by ordinary users. You may need special tools to reconstruct some of the files that ‘make maintainer-clean’ deletes. Since these files are normally included in the distribution, we don’t take care to make them easy to reconstruct. If you find you need to unpack the full distribution again, don’t blame us.

To help make users aware of this, the commands for the special maintainer- clean target should start with these two:

@echo ’This command is intended for maintainers to use; it’ @echo ’deletes files that may need special tools to rebuild.’ ‘TAGS’ Update a tags table for this program.

‘info’ Generate any Info files needed. The best way to write the rules is as follows: info: foo.info

foo.info: foo.texi chap1.texi chap2.texi $(MAKEINFO) $(srcdir)/foo.texi

You must define the variable MAKEINFO in the Makefile. It should run the makeinfo program, which is part of the Texinfo distribution.

Normally a GNU distribution comes with Info files, and that means the Info files are present in the source directory. Therefore, the Make rule for an info file should update it in the source directory. When users build the package, ordinarily Make will not update the Info files because they will already be up to date.

‘dvi’ Generate DVI files for all Texinfo documentation. For example: dvi: foo.dvi

foo.dvi: foo.texi chap1.texi chap2.texi $(TEXI2DVI) $(srcdir)/foo.texi

You must define the variable TEXI2DVI in the Makefile. It should run the program texi2dvi, which is part of the Texinfo distribution.1 Alternatively,

write just the dependencies, and allow GNU make to provide the command. ‘dist’ Create a distribution tar file for this program. The tar file should be set up so

that the file names in the tar file start with a subdirectory name which is the name of the package it is a distribution for. This name can include the version number.

For example, the distribution tar file of GCC version 1.40 unpacks into a sub- directory named ‘gcc-1.40’.

The easiest way to do this is to create a subdirectory appropriately named, use ln orcp to install the proper files in it, and thentar that subdirectory. Compress the tar file with gzip. For example, the actual distribution file for GCC version 1.40 is called ‘gcc-1.40.tar.gz’.

1

The disttarget should explicitly depend on all non-source files that are in the distribution, to make sure they are up to date in the distribution. See section “Making Releases” in GNU Coding Standards.

‘check’ Perform self-tests (if any). The user must build the program before running the tests, but need not install the program; you should write the self-tests so that they work when the program is built but not installed.

The following targets are suggested as conventional names, for programs in which they are useful.

installcheck

Perform installation tests (if any). The user must build and install the program before running the tests. You should not assume that ‘$(bindir)’ is in the search path.

installdirs

It’s useful to add a target named ‘installdirs’ to create the directories where files are installed, and their parent directories. There is a script called ‘mkinstalldirs’ which is convenient for this; you can find it in the Texinfo package. You can use a rule like this:

# Make sure all installation directories (e.g. $(bindir)) # actually exist by making them if necessary.

installdirs: mkinstalldirs

$(srcdir)/mkinstalldirs $(bindir) $(datadir) \ $(libdir) $(infodir) \ $(mandir)

or, if you wish to support DESTDIR,

# Make sure all installation directories (e.g. $(bindir)) # actually exist by making them if necessary.

installdirs: mkinstalldirs

$(srcdir)/mkinstalldirs \

$(DESTDIR)$(bindir) $(DESTDIR)$(datadir) \ $(DESTDIR)$(libdir) $(DESTDIR)$(infodir) \ $(DESTDIR)$(mandir)

This rule should not modify the directories where compilation is done. It should do nothing but create installation directories.

14.6 Install Command Categories

When writing the install target, you must classify all the commands into three cate- gories: normal ones,pre-installation commands and post-installationcommands.

Normal commands move files into their proper places, and set their modes. They may not alter any files except the ones that come entirely from the package they belong to.

Pre-installation and post-installation commands may alter other files; in particular, they can edit global configuration files or data bases.

Pre-installation commands are typically executed before the normal commands, and post-installation commands are typically run after the normal commands.

The most common use for a post-installation command is to run install-info. This cannot be done with a normal command, since it alters a file (the Info directory) which does not come entirely and solely from the package being installed. It is a post-installation command because it needs to be done after the normal command which installs the package’s Info files.

Most programs don’t need any pre-installation commands, but we have the feature just in case it is needed.

To classify the commands in theinstallrule into these three categories, insertcategory lines among them. A category line specifies the category for the commands that follow.

A category line consists of a tab and a reference to a special Make variable, plus an optional comment at the end. There are three variables you can use, one for each category; the variable name specifies the category. Category lines are no-ops in ordinary execution because these three Make variables are normally undefined (and youshould notdefine them in the makefile).

Here are the three possible category lines, each with a comment that explains what it means:

$(PRE_INSTALL) # Pre-install commands follow. $(POST_INSTALL) # Post-install commands follow. $(NORMAL_INSTALL) # Normal commands follow.

If you don’t use a category line at the beginning of theinstall rule, all the commands are classified as normal until the first category line. If you don’t use any category lines, all the commands are classified as normal.

These are the category lines for uninstall:

$(PRE_UNINSTALL) # Pre-uninstall commands follow. $(POST_UNINSTALL) # Post-uninstall commands follow. $(NORMAL_UNINSTALL) # Normal commands follow.

Typically, a pre-uninstall command would be used for deleting entries from the Info directory.

If the install or uninstall target has any dependencies which act as subroutines of installation, then you should start each dependency’s commands with a category line, and start the main target’s commands with a category line also. This way, you can ensure that each command is placed in the right category regardless of which of the dependencies actually run.

Pre-installation and post-installation commands should not run any programs except for these:

[ basename bash cat chgrp chmod chown cmp cp dd diff echo egrep expand expr false fgrep find getopt grep gunzip gzip hostname install install-info kill ldconfig ln ls md5sum mkdir mkfifo mknod mv printenv pwd rm rmdir sed sort tee test touch true uname xargs yes

The reason for distinguishing the commands in this way is for the sake of making binary packages. Typically a binary package contains all the executables and other files that need to be installed, and has its own method of installing them—so it does not need to run the normal installation commands. But installing the binary package does need to execute the pre-installation and post-installation commands.

Programs to build binary packages work by extracting the pre-installation and post- installation commands. Here is one way of extracting the pre-installation commands:

make -n install -o all \

PRE_INSTALL=pre-install \ POST_INSTALL=post-install \ NORMAL_INSTALL=normal-install \ | gawk -f pre-install.awk

where the file ‘pre-install.awk’ could contain this:

$0 ~ /^\t[ \t]*(normal_install|post_install)[ \t]*$/ {on = 0} on {print $0}

$0 ~ /^\t[ \t]*pre_install[ \t]*$/ {on = 1}

The resulting file of pre-installation commands is executed as a shell script as part of installing the binary package.

Appendix A Quick Reference

This appendix summarizes the directives, text manipulation functions, and special vari- ables which GNUmakeunderstands. SeeSection 4.8 [Special Targets], page 27,Section 10.2 [Catalogue of Implicit Rules], page 90, and Section 9.7 [Summary of Options], page 84, for other summaries.

Here is a summary of the directives GNU make recognizes: definevariable

endef

Define a multi-line, recursively-expanded variable. SeeSection 5.7 [Sequences], page 46.

ifdefvariable ifndefvariable ifeq (a,b) ifeq "a" "b" ifeq ’a’ ’b’ ifneq (a,b) ifneq "a" "b" ifneq ’a’ ’b’ else endif

Conditionally evaluate part of the makefile. SeeChapter 7 [Conditionals], page 61. include file

-includefile

sincludefile

Include another makefile.

SeeSection 3.3 [Including Other Makefiles], page 10. overridevariable =value

overridevariable :=value

overridevariable +=value

overridevariable ?=value

override definevariable

endef

Define a variable, overriding any previous definition, even one from the com- mand line.

SeeSection 6.7 [The overrideDirective], page 57. export

Tell maketo export all variables to child processes by default.

exportvariable

exportvariable =value

exportvariable := value

exportvariable += value

exportvariable ?= value

unexportvariable

Tell makewhether or not to export a particular variable to child processes. SeeSection 5.6.2 [Communicating Variables to a Sub-make], page 42. vpathpattern path

Specify a search path for files matching a ‘%’ pattern. SeeSection 4.4.2 [The vpathDirective], page 21. vpathpattern

Remove all search paths previously specified forpattern.

vpath Remove all search paths previously specified in anyvpath directive.

Here is a summary of the text manipulation functions (see Chapter 8 [Functions], page 65):

$(subst from,to,text)

Replace fromwithto intext.

SeeSection 8.2 [Functions for String Substitution and Analysis], page 66. $(patsubstpattern,replacement,text)

Replace words matching patternwithreplacement intext.

SeeSection 8.2 [Functions for String Substitution and Analysis], page 66. $(strip string)

Remove excess whitespace characters from string.

SeeSection 8.2 [Functions for String Substitution and Analysis], page 66. $(findstring find,text)

Locate find intext.

SeeSection 8.2 [Functions for String Substitution and Analysis], page 66. $(filterpattern...,text)

Select words in textthat match one of the patternwords.

SeeSection 8.2 [Functions for String Substitution and Analysis], page 66. $(filter-out pattern...,text)

Select words in textthat do not match any of thepattern words.

SeeSection 8.2 [Functions for String Substitution and Analysis], page 66. $(sortlist)

Sort the words in list lexicographically, removing duplicates.

SeeSection 8.2 [Functions for String Substitution and Analysis], page 66. $(dirnames...)

Extract the directory part of each file name.

$(notdirnames...)

Extract the non-directory part of each file name. SeeSection 8.3 [Functions for File Names], page 69. $(suffixnames...)

Extract the suffix (the last ‘.’ and following characters) of each file name. SeeSection 8.3 [Functions for File Names], page 69.

$(basenamenames...)

Extract the base name (name without suffix) of each file name. SeeSection 8.3 [Functions for File Names], page 69.

$(addsuffix suffix,names...)

Append suffix to each word innames.

SeeSection 8.3 [Functions for File Names], page 69. $(addprefix prefix,names...)

Prepend prefix to each word innames.

SeeSection 8.3 [Functions for File Names], page 69. $(joinlist1,list2)

Join two parallel lists of words.

SeeSection 8.3 [Functions for File Names], page 69. $(wordn,text)

Extract thenth word (one-origin) of text.

SeeSection 8.3 [Functions for File Names], page 69. $(words text)

Count the number of words intext.

SeeSection 8.3 [Functions for File Names], page 69. $(wordlists,e,text)

Returns the list of words in textfrom s toe.

SeeSection 8.3 [Functions for File Names], page 69. $(firstword names...)

Extract the first word of names.

SeeSection 8.3 [Functions for File Names], page 69. $(wildcardpattern...)

Find file names matching a shell file name pattern (not a ‘%’ pattern). SeeSection 4.3.3 [The Functionwildcard], page 20.

$(error text...)

When this function is evaluated,make generates a fatal error with the message

text.

SeeSection 8.11 [Functions That Control Make], page 77. $(warning text...)

When this function is evaluated, make generates a warning with the message

text.

$(shell command)

Execute a shell command and return its output. SeeSection 8.10 [Theshell Function], page 76. $(originvariable)

Return a string describing how the make variablevariable was defined. SeeSection 8.9 [The originFunction], page 75.

$(foreach var,words,text)

Evaluate text with var bound to each word in words, and concatenate the results.

SeeSection 8.4 [The foreach Function], page 71. $(callvar,param,...)

Evaluate the variablevar replacing any references to$(1),$(2)with the first, second, etc. paramvalues.

SeeSection 8.6 [The call Function], page 72.

Here is a summary of the automatic variables. SeeSection 10.5.3 [Automatic Variables], page 98, for full information.

$@ The file name of the target.

$% The target member name, when the target is an archive member. $< The name of the first prerequisite.

$? The names of all the prerequisites that are newer than the target, with spaces between them. For prerequisites which are archive members, only the member named is used (see Chapter 11 [Archives], page 107).

$^

$+ The names of all the prerequisites, with spaces between them. For prerequisites which are archive members, only the member named is used (see Chapter 11 [Archives], page 107). The value of $^ omits duplicate prerequisites, while $+ retains them and preserves their order.

$* The stem with which an implicit rule matches (seeSection 10.5.4 [How Patterns Match], page 100).

$(@D)

$(@F) The directory part and the file-within-directory part of $@. $(*D)

$(*F) The directory part and the file-within-directory part of $*. $(%D)

$(%F) The directory part and the file-within-directory part of $%. $(<D)

$(<F) The directory part and the file-within-directory part of $<. $(^D)

$(+D)

$(+F) The directory part and the file-within-directory part of $+. $(?D)

$(?F) The directory part and the file-within-directory part of $?. These variables are used specially by GNU make:

MAKEFILES

Makefiles to be read on every invocation of make. SeeSection 3.4 [The Variable MAKEFILES], page 11. VPATH

Directory search path for files not found in the current directory. SeeSection 4.4.1 [VPATH Search Path for All Prerequisites], page 21. SHELL

The name of the system default command interpreter, usually ‘/bin/sh’. You can set SHELL in the makefile to change the shell used to run commands. See

Section 5.2 [Command Execution], page 37. MAKESHELL

On MS-DOS only, the name of the command interpreter that is to be used by make. This value takes precedence over the value of SHELL. See Section 5.2 [MAKESHELL variable], page 37.

MAKE

The name with which make was invoked. Using this variable in commands has special meaning. See Section 5.6.1 [How theMAKE Variable Works], page 42. MAKELEVEL

The number of levels of recursion (sub-makes). SeeSection 5.6.2 [Variables/Recursion], page 42. MAKEFLAGS

The flags given to make. You can set this in the environment or a makefile to set flags.

SeeSection 5.6.3 [Communicating Options to a Sub-make], page 44.

It is never appropriate to use MAKEFLAGS directly on a command line: its con- tents may not be quoted correctly for use in the shell. Always allow recursive make’s to obtain these values through the environment from its parent.

MAKECMDGOALS

The targets given to make on the command line. Setting this variable has no effect on the operation ofmake.

SeeSection 9.2 [Arguments to Specify the Goals], page 79. CURDIR

Set to the pathname of the current working directory (after all -Coptions are processed, if any). Setting this variable has no effect on the operation of make. SeeSection 5.6 [Recursive Use of make], page 41.

SUFFIXES

The default list of suffixes before make reads any makefiles. .LIBPATTERNS

Defines the naming of the libraries makesearches for, and their order. SeeSection 4.4.6 [Directory Search for Link Libraries], page 24.

Appendix B Errors Generated by Make

Here is a list of the more common errors you might see generated by make, and some information about what they mean and how to fix them.

Sometimesmakeerrors are not fatal, especially in the presence of a-prefix on a command script line, or the-kcommand line option. Errors that are fatal are prefixed with the string ***.

Error messages are all either prefixed with the name of the program (usually ‘make’), or, if the error is found in a makefile, the name of the file and linenumber containing the problem.

In the table below, these common prefixes are left off. ‘[foo] ErrorNN’

‘[foo]signal description’

These errors are not really make errors at all. They mean that a program that make invoked as part of a command script returned a non-0 error code (‘Error

NN’), which make interprets as failure, or it exited in some other abnormal fashion (with a signal of some type). See Section 5.4 [Errors in Commands], page 40.

If no *** is attached to the message, then the subprocess failed but the rule in the makefile was prefixed with the - special character, so make ignored the error.

‘missing separator. Stop.’

‘missing separator (did you mean TAB instead of 8 spaces?). Stop.’

This means thatmake could not understand much of anything about the com- mand line it just read. GNU make looks for various kinds of separators (:, =, TAB characters, etc.) to help it decide what kind of commandline it’s seeing. This means it couldn’t find a valid one.

One of the most common reasons for this message is that you (or perhaps your oh-so-helpful editor, as is the case with many MS-Windows editors) have attempted to indent your command scripts with spaces instead of a TAB char-

Documento similar