1 This is ../info/standards.info, produced by makeinfo version 4.8 from
5 * Standards: (standards). GNU coding standards.
8 GNU Coding Standards Copyright (C) 1992, 1993, 1994, 1995, 1996,
9 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
11 Permission is granted to make and distribute verbatim copies of this
12 manual provided the copyright notice and this permission notice are
13 preserved on all copies.
15 Permission is granted to copy and distribute modified versions of
16 this manual under the conditions for verbatim copying, provided that
17 the entire resulting derived work is distributed under the terms of a
18 permission notice identical to this one.
20 Permission is granted to copy and distribute translations of this
21 manual into another language, under the above conditions for modified
22 versions, except that this permission notice may be stated in a
23 translation approved by the Free Software Foundation.
26 File: standards.info, Node: Top, Next: Preface, Prev: (dir), Up: (dir)
31 Last updated February 21, 2001.
35 * Preface:: About the GNU Coding Standards
36 * Legal Issues:: Keeping Free Software Free
37 * Design Advice:: General Program Design
38 * Program Behavior:: Program Behavior for All Programs
39 * Writing C:: Making The Best Use of C
40 * Documentation:: Documenting Programs
41 * Managing Releases:: The Release Process
42 * References:: References to Non-Free Software or Documentation
46 File: standards.info, Node: Preface, Next: Legal Issues, Prev: Top, Up: Top
48 1 About the GNU Coding Standards
49 ********************************
51 The GNU Coding Standards were written by Richard Stallman and other GNU
52 Project volunteers. Their purpose is to make the GNU system clean,
53 consistent, and easy to install. This document can also be read as a
54 guide to writing portable, robust and reliable programs. It focuses on
55 programs written in C, but many of the rules and principles are useful
56 even if you write in another programming language. The rules often
57 state reasons for writing in a certain way.
59 Corrections or suggestions for this document should be sent to
60 <bug-standards@gnu.org>. If you make a suggestion, please include a
61 suggested new wording for it; our time is limited. We prefer a context
62 diff to the `standards.texi' or `make-stds.texi' files, but if you
63 don't have those files, please mail your suggestion anyway.
65 This release of the GNU Coding Standards was last updated February
68 If you did not obtain this file directly from the GNU project and
69 recently, please check for a newer version. You can ftp the GNU Coding
70 Standards from any GNU FTP host in the directory `/pub/gnu/standards/'.
71 The GNU Coding Standards are available there in several different
72 formats: `standards.text', `standards.texi', `standards.info', and
73 `standards.dvi'. The GNU Coding Standards are also available on the
74 GNU World Wide Web server: `http://www.gnu.org/prep/standards_toc.html'.
77 File: standards.info, Node: Legal Issues, Next: Design Advice, Prev: Preface, Up: Top
79 2 Keeping Free Software Free
80 ****************************
82 This node discusses how you can make sure that GNU software avoids
83 legal difficulties, and other related issues.
87 * Reading Non-Free Code:: Referring to Proprietary Programs
88 * Contributions:: Accepting Contributions
89 * Trademarks:: How We Deal with Trademark Issues
92 File: standards.info, Node: Reading Non-Free Code, Next: Contributions, Up: Legal Issues
94 2.1 Referring to Proprietary Programs
95 =====================================
97 Don't in any circumstances refer to Unix source code for or during your
98 work on GNU! (Or to any other proprietary programs.)
100 If you have a vague recollection of the internals of a Unix program,
101 this does not absolutely mean you can't write an imitation of it, but
102 do try to organize the imitation internally along different lines,
103 because this is likely to make the details of the Unix version
104 irrelevant and dissimilar to your results.
106 For example, Unix utilities were generally optimized to minimize
107 memory use; if you go for speed instead, your program will be very
108 different. You could keep the entire input file in core and scan it
109 there instead of using stdio. Use a smarter algorithm discovered more
110 recently than the Unix program. Eliminate use of temporary files. Do
111 it in one pass instead of two (we did this in the assembler).
113 Or, on the contrary, emphasize simplicity instead of speed. For some
114 applications, the speed of today's computers makes simpler algorithms
117 Or go for generality. For example, Unix programs often have static
118 tables or fixed-size strings, which make for arbitrary limits; use
119 dynamic allocation instead. Make sure your program handles NULs and
120 other funny characters in the input files. Add a programming language
121 for extensibility and write part of the program in that language.
123 Or turn some parts of the program into independently usable
124 libraries. Or use a simple garbage collector instead of tracking
125 precisely when to free memory, or use a new GNU facility such as
129 File: standards.info, Node: Contributions, Next: Trademarks, Prev: Reading Non-Free Code, Up: Legal Issues
131 2.2 Accepting Contributions
132 ===========================
134 If the program you are working on is copyrighted by the Free Software
135 Foundation, then when someone else sends you a piece of code to add to
136 the program, we need legal papers to use it--just as we asked you to
137 sign papers initially. _Each_ person who makes a nontrivial
138 contribution to a program must sign some sort of legal papers in order
139 for us to have clear title to the program; the main author alone is not
142 So, before adding in any contributions from other people, please tell
143 us, so we can arrange to get the papers. Then wait until we tell you
144 that we have received the signed papers, before you actually use the
147 This applies both before you release the program and afterward. If
148 you receive diffs to fix a bug, and they make significant changes, we
149 need legal papers for that change.
151 This also applies to comments and documentation files. For copyright
152 law, comments and code are just text. Copyright applies to all kinds of
153 text, so we need legal papers for all kinds.
155 We know it is frustrating to ask for legal papers; it's frustrating
156 for us as well. But if you don't wait, you are going out on a limb--for
157 example, what if the contributor's employer won't sign a disclaimer?
158 You might have to take that code out again!
160 You don't need papers for changes of a few lines here or there, since
161 they are not significant for copyright purposes. Also, you don't need
162 papers if all you get from the suggestion is some ideas, not actual code
163 which you use. For example, if someone send you one implementation, but
164 you write a different implementation of the same idea, you don't need to
167 The very worst thing is if you forget to tell us about the other
168 contributor. We could be very embarrassed in court some day as a
171 We have more detailed advice for maintainers of programs; if you have
172 reached the stage of actually maintaining a program for GNU (whether
173 released or not), please ask us for a copy.
176 File: standards.info, Node: Trademarks, Prev: Contributions, Up: Legal Issues
181 Please do not include any trademark acknowledgements in GNU software
182 packages or documentation.
184 Trademark acknowledgements are the statements that such-and-such is a
185 trademark of so-and-so. The GNU Project has no objection to the basic
186 idea of trademarks, but these acknowledgements feel like kowtowing, so
187 we don't use them. There is no legal requirement for them.
189 What is legally required, as regards other people's trademarks, is to
190 avoid using them in ways which a reader might read as naming or labeling
191 our own programs or activities. For example, since "Objective C" is
192 (or at least was) a trademark, we made sure to say that we provide a
193 "compiler for the Objective C language" rather than an "Objective C
194 compiler". The latter is meant to be short for the former, but it does
195 not explicitly state the relationship, so it could be misinterpreted as
196 using "Objective C" as a label for the compiler rather than for the
200 File: standards.info, Node: Design Advice, Next: Program Behavior, Prev: Legal Issues, Up: Top
202 3 General Program Design
203 ************************
205 This node discusses some of the issues you should take into account
206 when designing your program.
210 * Source Language:: Which languges to use.
211 * Compatibility:: Compatibility with other implementations
212 * Using Extensions:: Using non-standard features
213 * Standard C:: Using Standard C features
216 File: standards.info, Node: Source Language, Next: Compatibility, Up: Design Advice
218 3.1 Which Languages to Use
219 ==========================
221 When you want to use a language that gets compiled and runs at high
222 speed, the best language to use is C. Using another language is like
223 using a non-standard feature: it will cause trouble for users. Even if
224 GCC supports the other language, users may find it inconvenient to have
225 to install the compiler for that other language in order to build your
226 program. For example, if you write your program in C++, people will
227 have to install the GNU C++ compiler in order to compile your program.
229 C has one other advantage over C++ and other compiled languages: more
230 people know C, so more people will find it easy to read and modify the
231 program if it is written in C.
233 So in general it is much better to use C, rather than the comparable
236 But there are two exceptions to that conclusion:
238 * It is no problem to use another language to write a tool
239 specifically intended for use with that language. That is because
240 the only people who want to build the tool will be those who have
241 installed the other language anyway.
243 * If an application is of interest only to a narrow part of the
244 community, then the question of which language it is written in
245 has less effect on other people, so you may as well please
248 Many programs are designed to be extensible: they include an
249 interpreter for a language that is higher level than C. Often much of
250 the program is written in that language, too. The Emacs editor
251 pioneered this technique.
253 The standard extensibility interpreter for GNU software is GUILE,
254 which implements the language Scheme (an especially clean and simple
255 dialect of Lisp). `http://www.gnu.org/software/guile/'. We don't
256 reject programs written in other "scripting languages" such as Perl and
257 Python, but using GUILE is very important for the overall consistency of
261 File: standards.info, Node: Compatibility, Next: Using Extensions, Prev: Source Language, Up: Design Advice
263 3.2 Compatibility with Other Implementations
264 ============================================
266 With occasional exceptions, utility programs and libraries for GNU
267 should be upward compatible with those in Berkeley Unix, and upward
268 compatible with Standard C if Standard C specifies their behavior, and
269 upward compatible with POSIX if POSIX specifies their behavior.
271 When these standards conflict, it is useful to offer compatibility
272 modes for each of them.
274 Standard C and POSIX prohibit many kinds of extensions. Feel free
275 to make the extensions anyway, and include a `--ansi', `--posix', or
276 `--compatible' option to turn them off. However, if the extension has
277 a significant chance of breaking any real programs or scripts, then it
278 is not really upward compatible. So you should try to redesign its
279 interface to make it upward compatible.
281 Many GNU programs suppress extensions that conflict with POSIX if the
282 environment variable `POSIXLY_CORRECT' is defined (even if it is
283 defined with a null value). Please make your program recognize this
284 variable if appropriate.
286 When a feature is used only by users (not by programs or command
287 files), and it is done poorly in Unix, feel free to replace it
288 completely with something totally different and better. (For example,
289 `vi' is replaced with Emacs.) But it is nice to offer a compatible
290 feature as well. (There is a free `vi' clone, so we offer it.)
292 Additional useful features are welcome regardless of whether there
293 is any precedent for them.
296 File: standards.info, Node: Using Extensions, Next: Standard C, Prev: Compatibility, Up: Design Advice
298 3.3 Using Non-standard Features
299 ===============================
301 Many GNU facilities that already exist support a number of convenient
302 extensions over the comparable Unix facilities. Whether to use these
303 extensions in implementing your program is a difficult question.
305 On the one hand, using the extensions can make a cleaner program.
306 On the other hand, people will not be able to build the program unless
307 the other GNU tools are available. This might cause the program to
308 work on fewer kinds of machines.
310 With some extensions, it might be easy to provide both alternatives.
311 For example, you can define functions with a "keyword" `INLINE' and
312 define that as a macro to expand into either `inline' or nothing,
313 depending on the compiler.
315 In general, perhaps it is best not to use the extensions if you can
316 straightforwardly do without them, but to use the extensions if they
317 are a big improvement.
319 An exception to this rule are the large, established programs (such
320 as Emacs) which run on a great variety of systems. Using GNU
321 extensions in such programs would make many users unhappy, so we don't
324 Another exception is for programs that are used as part of
325 compilation: anything that must be compiled with other compilers in
326 order to bootstrap the GNU compilation facilities. If these require
327 the GNU compiler, then no one can compile them without having them
328 installed already. That would be extremely troublesome in certain
332 File: standards.info, Node: Standard C, Prev: Using Extensions, Up: Design Advice
334 3.4 Standard C and Pre-Standard C
335 =================================
337 1989 Standard C is widespread enough now that it is ok to use its
338 features in new programs. There is one exception: do not ever use the
339 "trigraph" feature of Standard C.
341 1999 Standard C is not widespread yet, so please do not require its
342 features in programs. It is ok to use its features if they are present.
344 However, it is easy to support pre-standard compilers in most
345 programs, so if you know how to do that, feel free. If a program you
346 are maintaining has such support, you should try to keep it working.
348 To support pre-standard C, instead of writing function definitions in
349 standard prototype form,
355 write the definition in pre-standard style like this,
362 and use a separate declaration to specify the argument prototype:
366 You need such a declaration anyway, in a header file, to get the
367 benefit of prototypes in all the files where the function is called.
368 And once you have the declaration, you normally lose nothing by writing
369 the function definition in the pre-standard style.
371 This technique does not work for integer types narrower than `int'.
372 If you think of an argument as being of a type narrower than `int',
373 declare it as `int' instead.
375 There are a few special cases where this technique is hard to use.
376 For example, if a function argument needs to hold the system type
377 `dev_t', you run into trouble, because `dev_t' is shorter than `int' on
378 some machines; but you cannot use `int' instead, because `dev_t' is
379 wider than `int' on some machines. There is no type you can safely use
380 on all machines in a non-standard definition. The only way to support
381 non-standard C and pass such an argument is to check the width of
382 `dev_t' using Autoconf and choose the argument type accordingly. This
383 may not be worth the trouble.
385 In order to support pre-standard compilers that do not recognize
386 prototypes, you may want to use a preprocessor macro like this:
388 /* Declare the prototype for a general external function. */
389 #if defined (__STDC__) || defined (WINDOWSNT)
390 #define P_(proto) proto
396 File: standards.info, Node: Program Behavior, Next: Writing C, Prev: Design Advice, Up: Top
398 4 Program Behavior for All Programs
399 ***********************************
401 This node describes conventions for writing robust software. It also
402 describes general standards for error messages, the command line
403 interface, and how libraries should behave.
407 * Semantics:: Writing robust programs
408 * Libraries:: Library behavior
409 * Errors:: Formatting error messages
410 * User Interfaces:: Standards about interfaces generally
411 * Graphical Interfaces:: Standards for graphical interfaces
412 * Command-Line Interfaces:: Standards for command line interfaces
413 * Option Table:: Table of long options
414 * Memory Usage:: When and how to care about memory needs
415 * File Usage:: Which files to use, and where
418 File: standards.info, Node: Semantics, Next: Libraries, Up: Program Behavior
420 4.1 Writing Robust Programs
421 ===========================
423 Avoid arbitrary limits on the length or number of _any_ data structure,
424 including file names, lines, files, and symbols, by allocating all data
425 structures dynamically. In most Unix utilities, "long lines are
426 silently truncated". This is not acceptable in a GNU utility.
428 Utilities reading files should not drop NUL characters, or any other
429 nonprinting characters _including those with codes above 0177_. The
430 only sensible exceptions would be utilities specifically intended for
431 interface to certain types of terminals or printers that can't handle
432 those characters. Whenever possible, try to make programs work
433 properly with sequences of bytes that represent multibyte characters,
434 using encodings such as UTF-8 and others.
436 Check every system call for an error return, unless you know you
437 wish to ignore errors. Include the system error text (from `perror' or
438 equivalent) in _every_ error message resulting from a failing system
439 call, as well as the name of the file if any and the name of the
440 utility. Just "cannot open foo.c" or "stat failed" is not sufficient.
442 Check every call to `malloc' or `realloc' to see if it returned
443 zero. Check `realloc' even if you are making the block smaller; in a
444 system that rounds block sizes to a power of 2, `realloc' may get a
445 different block if you ask for less space.
447 In Unix, `realloc' can destroy the storage block if it returns zero.
448 GNU `realloc' does not have this bug: if it fails, the original block
449 is unchanged. Feel free to assume the bug is fixed. If you wish to
450 run your program on Unix, and wish to avoid lossage in this case, you
451 can use the GNU `malloc'.
453 You must expect `free' to alter the contents of the block that was
454 freed. Anything you want to fetch from the block, you must fetch before
457 If `malloc' fails in a noninteractive program, make that a fatal
458 error. In an interactive program (one that reads commands from the
459 user), it is better to abort the command and return to the command
460 reader loop. This allows the user to kill other processes to free up
461 virtual memory, and then try the command again.
463 Use `getopt_long' to decode arguments, unless the argument syntax
464 makes this unreasonable.
466 When static storage is to be written in during program execution, use
467 explicit C code to initialize it. Reserve C initialized declarations
468 for data that will not be changed.
470 Try to avoid low-level interfaces to obscure Unix data structures
471 (such as file directories, utmp, or the layout of kernel memory), since
472 these are less likely to work compatibly. If you need to find all the
473 files in a directory, use `readdir' or some other high-level interface.
474 These are supported compatibly by GNU.
476 The preferred signal handling facilities are the BSD variant of
477 `signal', and the POSIX `sigaction' function; the alternative USG
478 `signal' interface is an inferior design.
480 Nowadays, using the POSIX signal functions may be the easiest way to
481 make a program portable. If you use `signal', then on GNU/Linux
482 systems running GNU libc version 1, you should include `bsd/signal.h'
483 instead of `signal.h', so as to get BSD behavior. It is up to you
484 whether to support systems where `signal' has only the USG behavior, or
487 In error checks that detect "impossible" conditions, just abort.
488 There is usually no point in printing any message. These checks
489 indicate the existence of bugs. Whoever wants to fix the bugs will have
490 to read the source code and run a debugger. So explain the problem with
491 comments in the source. The relevant data will be in variables, which
492 are easy to examine with the debugger, so there is no point moving them
495 Do not use a count of errors as the exit status for a program.
496 _That does not work_, because exit status values are limited to 8 bits
497 (0 through 255). A single run of the program might have 256 errors; if
498 you try to return 256 as the exit status, the parent process will see 0
499 as the status, and it will appear that the program succeeded.
501 If you make temporary files, check the `TMPDIR' environment
502 variable; if that variable is defined, use the specified directory
505 In addition, be aware that there is a possible security problem when
506 creating temporary files in world-writable directories. In C, you can
507 avoid this problem by creating temporary files in this manner:
509 fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0600);
511 or by using the `mkstemps' function from libiberty.
513 In bash, use `set -C' to avoid this problem.
516 File: standards.info, Node: Libraries, Next: Errors, Prev: Semantics, Up: Program Behavior
521 Try to make library functions reentrant. If they need to do dynamic
522 storage allocation, at least try to avoid any nonreentrancy aside from
523 that of `malloc' itself.
525 Here are certain name conventions for libraries, to avoid name
528 Choose a name prefix for the library, more than two characters long.
529 All external function and variable names should start with this prefix.
530 In addition, there should only be one of these in any given library
531 member. This usually means putting each one in a separate source file.
533 An exception can be made when two external symbols are always used
534 together, so that no reasonable program could use one without the
535 other; then they can both go in the same file.
537 External symbols that are not documented entry points for the user
538 should have names beginning with `_'. The `_' should be followed by
539 the chosen name prefix for the library, to prevent collisions with
540 other libraries. These can go in the same files with user entry points
543 Static functions and variables can be used as you like and need not
544 fit any naming convention.
547 File: standards.info, Node: Errors, Next: User Interfaces, Prev: Libraries, Up: Program Behavior
549 4.3 Formatting Error Messages
550 =============================
552 Error messages from compilers should look like this:
554 SOURCE-FILE-NAME:LINENO: MESSAGE
556 If you want to mention the column number, use this format:
558 SOURCE-FILE-NAME:LINENO:COLUMN: MESSAGE
560 Line numbers should start from 1 at the beginning of the file, and
561 column numbers should start from 1 at the beginning of the line. (Both
562 of these conventions are chosen for compatibility.) Calculate column
563 numbers assuming that space and all ASCII printing characters have
564 equal width, and assuming tab stops every 8 columns.
566 Error messages from other noninteractive programs should look like
569 PROGRAM:SOURCE-FILE-NAME:LINENO: MESSAGE
571 when there is an appropriate source file, or like this:
575 when there is no relevant source file.
577 If you want to mention the column number, use this format:
579 PROGRAM:SOURCE-FILE-NAME:LINENO:COLUMN: MESSAGE
581 In an interactive program (one that is reading commands from a
582 terminal), it is better not to include the program name in an error
583 message. The place to indicate which program is running is in the
584 prompt or with the screen layout. (When the same program runs with
585 input from a source other than a terminal, it is not interactive and
586 would do best to print error messages using the noninteractive style.)
588 The string MESSAGE should not begin with a capital letter when it
589 follows a program name and/or file name. Also, it should not end with
592 Error messages from interactive programs, and other messages such as
593 usage messages, should start with a capital letter. But they should not
597 File: standards.info, Node: User Interfaces, Next: Graphical Interfaces, Prev: Errors, Up: Program Behavior
599 4.4 Standards for Interfaces Generally
600 ======================================
602 Please don't make the behavior of a utility depend on the name used to
603 invoke it. It is useful sometimes to make a link to a utility with a
604 different name, and that should not change what it does.
606 Instead, use a run time option or a compilation switch or both to
607 select among the alternate behaviors.
609 Likewise, please don't make the behavior of the program depend on the
610 type of output device it is used with. Device independence is an
611 important principle of the system's design; do not compromise it merely
612 to save someone from typing an option now and then. (Variation in error
613 message syntax when using a terminal is ok, because that is a side issue
614 that people do not depend on.)
616 If you think one behavior is most useful when the output is to a
617 terminal, and another is most useful when the output is a file or a
618 pipe, then it is usually best to make the default behavior the one that
619 is useful with output to a terminal, and have an option for the other
622 Compatibility requires certain programs to depend on the type of
623 output device. It would be disastrous if `ls' or `sh' did not do so in
624 the way all users expect. In some of these cases, we supplement the
625 program with a preferred alternate version that does not depend on the
626 output device type. For example, we provide a `dir' program much like
627 `ls' except that its default output format is always multi-column
631 File: standards.info, Node: Graphical Interfaces, Next: Command-Line Interfaces, Prev: User Interfaces, Up: Program Behavior
633 4.5 Standards for Graphical Interfaces
634 ======================================
636 When you write a program that provides a graphical user interface,
637 please make it work with X Windows and the GTK toolkit unless the
638 functionality specifically requires some alternative (for example,
639 "displaying jpeg images while in console mode").
641 In addition, please provide a command-line interface to control the
642 functionality. (In many cases, the graphical user interface can be a
643 separate program which invokes the command-line program.) This is so
644 that the same jobs can be done from scripts.
646 Please also consider providing a CORBA interface (for use from
647 GNOME), a library interface (for use from C), and perhaps a
648 keyboard-driven console interface (for use by users from console mode).
649 Once you are doing the work to provide the functionality and the
650 graphical interface, these won't be much extra work.
653 File: standards.info, Node: Command-Line Interfaces, Next: Option Table, Prev: Graphical Interfaces, Up: Program Behavior
655 4.6 Standards for Command Line Interfaces
656 =========================================
658 It is a good idea to follow the POSIX guidelines for the command-line
659 options of a program. The easiest way to do this is to use `getopt' to
660 parse them. Note that the GNU version of `getopt' will normally permit
661 options anywhere among the arguments unless the special argument `--'
662 is used. This is not what POSIX specifies; it is a GNU extension.
664 Please define long-named options that are equivalent to the
665 single-letter Unix-style options. We hope to make GNU more user
666 friendly this way. This is easy to do with the GNU function
669 One of the advantages of long-named options is that they can be
670 consistent from program to program. For example, users should be able
671 to expect the "verbose" option of any GNU program which has one, to be
672 spelled precisely `--verbose'. To achieve this uniformity, look at the
673 table of common long-option names when you choose the option names for
674 your program (*note Option Table::).
676 It is usually a good idea for file names given as ordinary arguments
677 to be input files only; any output files would be specified using
678 options (preferably `-o' or `--output'). Even if you allow an output
679 file name as an ordinary argument for compatibility, try to provide an
680 option as another way to specify it. This will lead to more consistency
681 among GNU utilities, and fewer idiosyncracies for users to remember.
683 All programs should support two standard options: `--version' and
687 This option should direct the program to print information about
688 its name, version, origin and legal status, all on standard
689 output, and then exit successfully. Other options and arguments
690 should be ignored once this is seen, and the program should not
691 perform its normal function.
693 The first line is meant to be easy for a program to parse; the
694 version number proper starts after the last space. In addition,
695 it contains the canonical name for this program, in this format:
699 The program's name should be a constant string; _don't_ compute it
700 from `argv[0]'. The idea is to state the standard or canonical
701 name for the program, not its file name. There are other ways to
702 find out the precise file name where a command is found in `PATH'.
704 If the program is a subsidiary part of a larger package, mention
705 the package name in parentheses, like this:
707 emacsserver (GNU Emacs) 19.30
709 If the package has a version number which is different from this
710 program's version number, you can mention the package version
711 number just before the close-parenthesis.
713 If you *need* to mention the version numbers of libraries which
714 are distributed separately from the package which contains this
715 program, you can do so by printing an additional line of version
716 info for each library you want to mention. Use the same format
717 for these lines as for the first line.
719 Please do not mention all of the libraries that the program uses
720 "just for completeness"--that would produce a lot of unhelpful
721 clutter. Please mention library version numbers only if you find
722 in practice that they are very important to you in debugging.
724 The following line, after the version number line or lines, should
725 be a copyright notice. If more than one copyright notice is
726 called for, put each on a separate line.
728 Next should follow a brief statement that the program is free
729 software, and that users are free to copy and change it on certain
730 conditions. If the program is covered by the GNU GPL, say so
731 here. Also mention that there is no warranty, to the extent
734 It is ok to finish the output with a list of the major authors of
735 the program, as a way of giving credit.
737 Here's an example of output that follows these rules:
740 Copyright (C) 1996 Free Software Foundation, Inc.
741 GNU Emacs comes with NO WARRANTY,
742 to the extent permitted by law.
743 You may redistribute copies of GNU Emacs
744 under the terms of the GNU General Public License.
745 For more information about these matters,
746 see the files named COPYING.
748 You should adapt this to your program, of course, filling in the
749 proper year, copyright holder, name of program, and the references
750 to distribution terms, and changing the rest of the wording as
753 This copyright notice only needs to mention the most recent year in
754 which changes were made--there's no need to list the years for
755 previous versions' changes. You don't have to mention the name of
756 the program in these notices, if that is inconvenient, since it
757 appeared in the first line.
760 This option should output brief documentation for how to invoke the
761 program, on standard output, then exit successfully. Other
762 options and arguments should be ignored once this is seen, and the
763 program should not perform its normal function.
765 Near the end of the `--help' option's output there should be a line
766 that says where to mail bug reports. It should have this format:
768 Report bugs to MAILING-ADDRESS.
771 File: standards.info, Node: Option Table, Next: Memory Usage, Prev: Command-Line Interfaces, Up: Program Behavior
773 4.7 Table of Long Options
774 =========================
776 Here is a table of long options used by GNU programs. It is surely
777 incomplete, but we aim to list all the options that a new program might
778 want to be compatible with. If you use names not already in the table,
779 please send <bug-standards@gnu.org> a list of them, with their
780 meanings, so we can update the table.
786 `-a' in `du', `ls', `nm', `stty', `uname', and `unexpand'.
795 `-a' in `etags', `tee', `time'; `-r' in `tar'.
831 For server programs, run in the background.
849 `-b' in `cpio' and `diff'.
855 Used in `cpio' and `tar'.
858 `-b' in `head' and `tail'.
864 Used in various programs to make output shorter.
867 `-c' in `head', `split', and `tail'.
876 Used in various programs to specify the directory to use.
879 `-c' in `chgrp' and `chown'.
888 `-c' in `su'; `-x' in GDB.
897 `-Z' in `tar' and `shar'.
909 `-W copyleft' in `gawk'.
912 `-C' in `ptx', `recode', and `wdiff'; `-W copyright' in `gawk'.
924 Used in `tar' and `cpio'.
936 `-d' in Make and `m4'; `-t' in Bison.
942 `-d' in Bison and `ctags'.
948 `-L' in `chgrp', `chown', `cpio', `du', `ls', and `tar'.
954 Specify an I/O device (special file name).
969 Specify the directory to use, in various programs. In `ls', it
970 means to show directories themselves rather than their contents.
971 In `rm' and `ln', it means to not treat links to directories
998 `environment-overrides'
1038 `-i' in `cpio'; `-x' in `tar'.
1050 `-f' in `info', `gawk', Make, `mt', and `tar'; `-n' in `sed'; `-r'
1071 `fixed-output-files'
1081 `-f' in `cp', `ln', `mv', and `rm'.
1087 For server programs, run in the foreground; in other words, don't
1088 do anything special to run the server in the background.
1091 Used in `ls', `time', and `ptx'.
1115 `-z' in `tar' and `shar'.
1121 `-h' in `objdump' and `recode'
1127 Used to ask for brief usage information.
1132 `hide-control-chars'
1136 In `makeinfo', output HTML.
1145 `-I' in `ls'; `-x' in `recode'.
1153 `ignore-blank-lines'
1157 `-f' in `look' and `ptx'; `-i' in `diff' and `wdiff'.
1165 `ignore-indentation'
1174 `ignore-matching-lines'
1177 `ignore-space-change'
1184 `-i' in `etags'; `-I' in `m4'.
1193 `-i', `-l', and `-m' in Finger.
1196 In some programs, specify the name of the file to read as the
1209 `-i' in `cp', `ln', `mv', `rm'; `-e' in `m4'; `-p' in `xargs';
1231 `-k' in `du' and `ls'.
1246 Used in `split', `head', and `tail'.
1256 `-t' in `cpio'; `-l' in `recode'.
1271 No listing of which programs already use this; someone should
1272 check to see if any actually do, and tell <gnu@gnu.org>.
1278 `-m' in `hello' and `uname'.
1317 `-m' in `install', `mkdir', and `mkfifo'.
1340 `no-character-count'
1398 Used in `emacsclient'.
1401 Used in various programs to inhibit warnings.
1428 `-n' in `cpio' and `ls'.
1440 `-l' in `tar', `cp', and `du'.
1452 `-o' in `getopt', `fdlist', `fdmount', `fdmountd', and `fdumount'.
1455 In various programs, specify the output file name.
1476 `-p' in `mkdir' and `rmdir'.
1488 `-c' in `cpio' and `tar'.
1500 Used in `tar' and `cp'.
1502 `preserve-environment'
1505 `preserve-modification-time'
1511 `preserve-permissions'
1539 Specify an HTTP proxy.
1548 Used in many programs to inhibit the usual output. *Note_* every
1549 program accepting `--quiet' should accept `--silent' as a synonym.
1576 Used in `chgrp', `chown', `cp', `ls', `diff', and `rm'.
1585 `-r' in `tac' and `etags'.
1602 `report-identical-files'
1609 `-r' in `ls' and `nm'.
1639 Used by `recode' to chose files or pipes for sequencing passes.
1653 `show-function-line'
1660 Used in many programs to inhibit the usual output. *Note_* every
1661 program accepting `--silent' should accept `--quiet' as a synonym.
1667 Specify a file descriptor for a network server to use for its
1668 socket, instead of opening and binding a new socket. This
1669 provides a way to run, in a nonpriveledged process, a server that
1670 normally needs a reserved port number.
1676 `-W source' in `gawk'.
1700 Used in `tar' and `diff' to specify which file within a directory
1701 to start processing with.
1728 `-S' in `cp', `ln', `mv'.
1743 Used in GDB and `objdump'.
1752 `-t' in `expand' and `unexpand'.
1758 `-T' in `tput' and `ul'. `-t' in `wdiff'.
1767 Used in `ls' and `touch'.
1770 Specify how long to wait before giving up on some operation.
1779 `-t' in Make, `ranlib', and `recode'.
1785 `-t' in `hello'; `-W traditional' in `gawk'; `-G' in `ed', `m4',
1813 `-u' in `cp', `ctags', `mv', `tar'.
1816 Used in `gawk'; same as `--help'.
1825 Print more information about progress. Many programs support this.
1831 Print the version number.
1834 `-V' in `cp', `ln', `mv'.
1849 `-w' in `ls' and `ptx'.
1861 File: standards.info, Node: Memory Usage, Next: File Usage, Prev: Option Table, Up: Program Behavior
1866 If a program typically uses just a few meg of memory, don't bother
1867 making any effort to reduce memory usage. For example, if it is
1868 impractical for other reasons to operate on files more than a few meg
1869 long, it is reasonable to read entire input files into core to operate
1872 However, for programs such as `cat' or `tail', that can usefully
1873 operate on very large files, it is important to avoid using a technique
1874 that would artificially limit the size of files it can handle. If a
1875 program works by lines and could be applied to arbitrary user-supplied
1876 input files, it should keep only a line in memory, because this is not
1877 very hard and users will want to be able to operate on input files that
1878 are bigger than will fit in core all at once.
1880 If your program creates complicated data structures, just make them
1881 in core and give a fatal error if `malloc' returns zero.
1884 File: standards.info, Node: File Usage, Prev: Memory Usage, Up: Program Behavior
1889 Programs should be prepared to operate when `/usr' and `/etc' are
1890 read-only file systems. Thus, if the program manages log files, lock
1891 files, backup files, score files, or any other files which are modified
1892 for internal purposes, these files should not be stored in `/usr' or
1895 There are two exceptions. `/etc' is used to store system
1896 configuration information; it is reasonable for a program to modify
1897 files in `/etc' when its job is to update the system configuration.
1898 Also, if the user explicitly asks to modify one file in a directory, it
1899 is reasonable for the program to store other files in the same
1903 File: standards.info, Node: Writing C, Next: Documentation, Prev: Program Behavior, Up: Top
1905 5 Making The Best Use of C
1906 **************************
1908 This node provides advice on how best to use the C language when
1909 writing GNU software.
1913 * Formatting:: Formatting Your Source Code
1914 * Comments:: Commenting Your Work
1915 * Syntactic Conventions:: Clean Use of C Constructs
1916 * Names:: Naming Variables and Functions
1917 * System Portability:: Portability between different operating systems
1918 * CPU Portability:: Supporting the range of CPU types
1919 * System Functions:: Portability and ``standard'' library functions
1920 * Internationalization:: Techniques for internationalization
1921 * Mmap:: How you can safely use `mmap'.
1924 File: standards.info, Node: Formatting, Next: Comments, Up: Writing C
1926 5.1 Formatting Your Source Code
1927 ===============================
1929 It is important to put the open-brace that starts the body of a C
1930 function in column zero, and avoid putting any other open-brace or
1931 open-parenthesis or open-bracket in column zero. Several tools look
1932 for open-braces in column zero to find the beginnings of C functions.
1933 These tools will not work on code not formatted that way.
1935 It is also important for function definitions to start the name of
1936 the function in column zero. This helps people to search for function
1937 definitions, and may also help certain tools recognize them. Thus, the
1938 proper format is this:
1941 concat (s1, s2) /* Name starts in column zero here */
1943 { /* Open brace in column zero here */
1947 or, if you want to use Standard C syntax, format the definition like
1951 concat (char *s1, char *s2)
1956 In Standard C, if the arguments don't fit nicely on one line, split
1960 lots_of_args (int an_integer, long a_long, short a_short,
1961 double a_double, float a_float)
1964 The rest of this section gives our recommendations for other aspects
1965 of C formatting style, which is also the default style of the `indent'
1966 program in version 1.2 and newer. It corresponds to the options
1968 -nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2
1969 -ndj -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -psl -nsc -nsob
1971 We don't think of these recommendations as requirements, because it
1972 causes no problems for users if two different programs have different
1975 But whatever style you use, please use it consistently, since a
1976 mixture of styles within one program tends to look ugly. If you are
1977 contributing changes to an existing program, please follow the style of
1980 For the body of the function, our recommended style looks like this:
1991 return ++x + bar ();
1994 We find it easier to read a program when it has spaces before the
1995 open-parentheses and after the commas. Especially after the commas.
1997 When you split an expression into multiple lines, split it before an
1998 operator, not after one. Here is the right way:
2000 if (foo_this_is_long && bar > win (x, y, z)
2001 && remaining_condition)
2003 Try to avoid having two operators of different precedence at the same
2004 level of indentation. For example, don't write this:
2006 mode = (inmode[j] == VOIDmode
2007 || GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j])
2008 ? outmode[j] : inmode[j]);
2010 Instead, use extra parentheses so that the indentation shows the
2013 mode = ((inmode[j] == VOIDmode
2014 || (GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j])))
2015 ? outmode[j] : inmode[j]);
2017 Insert extra parentheses so that Emacs will indent the code properly.
2018 For example, the following indentation looks nice if you do it by hand,
2020 v = rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
2021 + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000;
2023 but Emacs would alter it. Adding a set of parentheses produces
2024 something that looks equally nice, and which Emacs will preserve:
2026 v = (rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
2027 + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000);
2029 Format do-while statements like this:
2037 Please use formfeed characters (control-L) to divide the program into
2038 pages at logical places (but not within a function). It does not matter
2039 just how long the pages are, since they do not have to fit on a printed
2040 page. The formfeeds should appear alone on lines by themselves.
2043 File: standards.info, Node: Comments, Next: Syntactic Conventions, Prev: Formatting, Up: Writing C
2045 5.2 Commenting Your Work
2046 ========================
2048 Every program should start with a comment saying briefly what it is for.
2049 Example: `fmt - filter for simple filling of text'.
2051 Please write the comments in a GNU program in English, because
2052 English is the one language that nearly all programmers in all
2053 countries can read. If you do not write English well, please write
2054 comments in English as well as you can, then ask other people to help
2055 rewrite them. If you can't write comments in English, please find
2056 someone to work with you and translate your comments into English.
2058 Please put a comment on each function saying what the function does,
2059 what sorts of arguments it gets, and what the possible values of
2060 arguments mean and are used for. It is not necessary to duplicate in
2061 words the meaning of the C argument declarations, if a C type is being
2062 used in its customary fashion. If there is anything nonstandard about
2063 its use (such as an argument of type `char *' which is really the
2064 address of the second character of a string, not the first), or any
2065 possible values that would not work the way one would expect (such as,
2066 that strings containing newlines are not guaranteed to work), be sure
2069 Also explain the significance of the return value, if there is one.
2071 Please put two spaces after the end of a sentence in your comments,
2072 so that the Emacs sentence commands will work. Also, please write
2073 complete sentences and capitalize the first word. If a lower-case
2074 identifier comes at the beginning of a sentence, don't capitalize it!
2075 Changing the spelling makes it a different identifier. If you don't
2076 like starting a sentence with a lower case letter, write the sentence
2077 differently (e.g., "The identifier lower-case is ...").
2079 The comment on a function is much clearer if you use the argument
2080 names to speak about the argument values. The variable name itself
2081 should be lower case, but write it in upper case when you are speaking
2082 about the value rather than the variable itself. Thus, "the inode
2083 number NODE_NUM" rather than "an inode".
2085 There is usually no purpose in restating the name of the function in
2086 the comment before it, because the reader can see that for himself.
2087 There might be an exception when the comment is so long that the
2088 function itself would be off the bottom of the screen.
2090 There should be a comment on each static variable as well, like this:
2092 /* Nonzero means truncate lines in the display;
2093 zero means continue them. */
2096 Every `#endif' should have a comment, except in the case of short
2097 conditionals (just a few lines) that are not nested. The comment should
2098 state the condition of the conditional that is ending, _including its
2099 sense_. `#else' should have a comment describing the condition _and
2100 sense_ of the code that follows. For example:
2106 #endif /* not foo */
2111 but, by contrast, write the comments this way for a `#ifndef':
2120 #endif /* not foo */
2123 File: standards.info, Node: Syntactic Conventions, Next: Names, Prev: Comments, Up: Writing C
2125 5.3 Clean Use of C Constructs
2126 =============================
2128 Please explicitly declare the types of all objects. For example, you
2129 should explicitly declare all arguments to functions, and you should
2130 declare functions to return `int' rather than omitting the `int'.
2132 Some programmers like to use the GCC `-Wall' option, and change the
2133 code whenever it issues a warning. If you want to do this, then do.
2134 Other programmers prefer not to use `-Wall', because it gives warnings
2135 for valid and legitimate code which they do not want to change. If you
2136 want to do this, then do. The compiler should be your servant, not
2139 Declarations of external functions and functions to appear later in
2140 the source file should all go in one place near the beginning of the
2141 file (somewhere before the first function definition in the file), or
2142 else should go in a header file. Don't put `extern' declarations inside
2145 It used to be common practice to use the same local variables (with
2146 names like `tem') over and over for different values within one
2147 function. Instead of doing this, it is better declare a separate local
2148 variable for each distinct purpose, and give it a name which is
2149 meaningful. This not only makes programs easier to understand, it also
2150 facilitates optimization by good compilers. You can also move the
2151 declaration of each local variable into the smallest scope that includes
2152 all its uses. This makes the program even cleaner.
2154 Don't use local variables or parameters that shadow global
2157 Don't declare multiple variables in one declaration that spans lines.
2158 Start a new declaration on each line, instead. For example, instead of
2173 (If they are global variables, each should have a comment preceding it
2176 When you have an `if'-`else' statement nested in another `if'
2177 statement, always put braces around the `if'-`else'. Thus, never write
2196 If you have an `if' statement nested inside of an `else' statement,
2197 either write `else if' on one line, like this,
2204 with its `then'-part indented like the preceding `then'-part, or write
2205 the nested `if' within braces like this:
2215 Don't declare both a structure tag and variables or typedefs in the
2216 same declaration. Instead, declare the structure tag separately and
2217 then use it to declare the variables or typedefs.
2219 Try to avoid assignments inside `if'-conditions. For example, don't
2222 if ((foo = (char *) malloc (sizeof *foo)) == 0)
2223 fatal ("virtual memory exhausted");
2225 instead, write this:
2227 foo = (char *) malloc (sizeof *foo);
2229 fatal ("virtual memory exhausted");
2231 Don't make the program ugly to placate `lint'. Please don't insert
2232 any casts to `void'. Zero without a cast is perfectly fine as a null
2233 pointer constant, except when calling a varargs function.
2236 File: standards.info, Node: Names, Next: System Portability, Prev: Syntactic Conventions, Up: Writing C
2238 5.4 Naming Variables and Functions
2239 ==================================
2241 The names of global variables and functions in a program serve as
2242 comments of a sort. So don't choose terse names--instead, look for
2243 names that give useful information about the meaning of the variable or
2244 function. In a GNU program, names should be English, like other
2247 Local variable names can be shorter, because they are used only
2248 within one context, where (presumably) comments explain their purpose.
2250 Try to limit your use of abbreviations in symbol names. It is ok to
2251 make a few abbreviations, explain what they mean, and then use them
2252 frequently, but don't use lots of obscure abbreviations.
2254 Please use underscores to separate words in a name, so that the Emacs
2255 word commands can be useful within them. Stick to lower case; reserve
2256 upper case for macros and `enum' constants, and for name-prefixes that
2257 follow a uniform convention.
2259 For example, you should use names like `ignore_space_change_flag';
2260 don't use names like `iCantReadThis'.
2262 Variables that indicate whether command-line options have been
2263 specified should be named after the meaning of the option, not after
2264 the option-letter. A comment should state both the exact meaning of
2265 the option and its letter. For example,
2267 /* Ignore changes in horizontal whitespace (-b). */
2268 int ignore_space_change_flag;
2270 When you want to define names with constant integer values, use
2271 `enum' rather than `#define'. GDB knows about enumeration constants.
2273 You might want to make sure that none of the file names would
2274 conflict the files were loaded onto an MS-DOS file system which
2275 shortens the names. You can use the program `doschk' to test for this.
2277 Some GNU programs were designed to limit themselves to file names of
2278 14 characters or less, to avoid file name conflicts if they are read
2279 into older System V systems. Please preserve this feature in the
2280 existing GNU programs that have it, but there is no need to do this in
2281 new GNU programs. `doschk' also reports file names longer than 14
2285 File: standards.info, Node: System Portability, Next: CPU Portability, Prev: Names, Up: Writing C
2287 5.5 Portability between System Types
2288 ====================================
2290 In the Unix world, "portability" refers to porting to different Unix
2291 versions. For a GNU program, this kind of portability is desirable, but
2294 The primary purpose of GNU software is to run on top of the GNU
2295 kernel, compiled with the GNU C compiler, on various types of CPU. So
2296 the kinds of portability that are absolutely necessary are quite
2297 limited. But it is important to support Linux-based GNU systems, since
2298 they are the form of GNU that is popular.
2300 Beyond that, it is good to support the other free operating systems
2301 (*BSD), and it is nice to support other Unix-like systems if you want
2302 to. Supporting a variety of Unix-like systems is desirable, although
2303 not paramount. It is usually not too hard, so you may as well do it.
2304 But you don't have to consider it an obligation, if it does turn out to
2307 The easiest way to achieve portability to most Unix-like systems is
2308 to use Autoconf. It's unlikely that your program needs to know more
2309 information about the host platform than Autoconf can provide, simply
2310 because most of the programs that need such knowledge have already been
2313 Avoid using the format of semi-internal data bases (e.g.,
2314 directories) when there is a higher-level alternative (`readdir').
2316 As for systems that are not like Unix, such as MSDOS, Windows, the
2317 Macintosh, VMS, and MVS, supporting them is often a lot of work. When
2318 that is the case, it is better to spend your time adding features that
2319 will be useful on GNU and GNU/Linux, rather than on supporting other
2320 incompatible systems.
2322 It is a good idea to define the "feature test macro" `_GNU_SOURCE'
2323 when compiling your C files. When you compile on GNU or GNU/Linux,
2324 this will enable the declarations of GNU library extension functions,
2325 and that will usually give you a compiler error message if you define
2326 the same function names in some other way in your program. (You don't
2327 have to actually _use_ these functions, if you prefer to make the
2328 program more portable to other systems.)
2330 But whether or not you use these GNU extensions, you should avoid
2331 using their names for any other meanings. Doing so would make it hard
2332 to move your code into other GNU programs.
2335 File: standards.info, Node: CPU Portability, Next: System Functions, Prev: System Portability, Up: Writing C
2337 5.6 Portability between CPUs
2338 ============================
2340 Even GNU systems will differ because of differences among CPU
2341 types--for example, difference in byte ordering and alignment
2342 requirements. It is absolutely essential to handle these differences.
2343 However, don't make any effort to cater to the possibility that an
2344 `int' will be less than 32 bits. We don't support 16-bit machines in
2347 Similarly, don't make any effort to cater to the possibility that
2348 `long' will be smaller than predefined types like `size_t'. For
2349 example, the following code is ok:
2351 printf ("size = %lu\n", (unsigned long) sizeof array);
2352 printf ("diff = %ld\n", (long) (pointer2 - pointer1));
2354 1989 Standard C requires this to work, and we know of only one
2355 counterexample: 64-bit programs on Microsoft Windows IA-64. We will
2356 leave it to those who want to port GNU programs to that environment to
2357 figure out how to do it.
2359 Predefined file-size types like `off_t' are an exception: they are
2360 longer than `long' on many platforms, so code like the above won't work
2361 with them. One way to print an `off_t' value portably is to print its
2362 digits yourself, one by one.
2364 Don't assume that the address of an `int' object is also the address
2365 of its least-significant byte. This is false on big-endian machines.
2366 Thus, don't make the following mistake:
2370 while ((c = getchar()) != EOF)
2371 write(file_descriptor, &c, 1);
2373 When calling functions, you need not worry about the difference
2374 between pointers of various types, or between pointers and integers.
2375 On most machines, there's no difference anyway. As for the few
2376 machines where there is a difference, all of them support Standard C
2377 prototypes, so you can use prototypes (perhaps conditionalized to be
2378 active only in Standard C) to make the code work on those systems.
2380 In certain cases, it is ok to pass integer and pointer arguments
2381 indiscriminately to the same function, and use no prototype on any
2382 system. For example, many GNU programs have error-reporting functions
2383 that pass their arguments along to `printf' and friends:
2385 error (s, a1, a2, a3)
2389 fprintf (stderr, "error: ");
2390 fprintf (stderr, s, a1, a2, a3);
2393 In practice, this works on all machines, since a pointer is generally
2394 the widest possible kind of argument; it is much simpler than any
2395 "correct" alternative. Be sure _not_ to use a prototype for such
2398 If you have decided to use Standard C, then you can instead define
2399 `error' using `stdarg.h', and pass the arguments along to `vfprintf'.
2401 Avoid casting pointers to integers if you can. Such casts greatly
2402 reduce portability, and in most programs they are easy to avoid. In the
2403 cases where casting pointers to integers is essential--such as, a Lisp
2404 interpreter which stores type information as well as an address in one
2405 word--you'll have to make explicit provisions to handle different word
2406 sizes. You will also need to make provision for systems in which the
2407 normal range of addresses you can get from `malloc' starts far away
2411 File: standards.info, Node: System Functions, Next: Internationalization, Prev: CPU Portability, Up: Writing C
2413 5.7 Calling System Functions
2414 ============================
2416 C implementations differ substantially. Standard C reduces but does
2417 not eliminate the incompatibilities; meanwhile, many GNU packages still
2418 support pre-standard compilers because this is not hard to do. This
2419 chapter gives recommendations for how to use the more-or-less standard C
2420 library functions to avoid unnecessary loss of portability.
2422 * Don't use the return value of `sprintf'. It returns the number of
2423 characters written on some systems, but not on all systems.
2425 * Be aware that `vfprintf' is not always available.
2427 * `main' should be declared to return type `int'. It should
2428 terminate either by calling `exit' or by returning the integer
2429 status code; make sure it cannot ever return an undefined value.
2431 * Don't declare system functions explicitly.
2433 Almost any declaration for a system function is wrong on some
2434 system. To minimize conflicts, leave it to the system header
2435 files to declare system functions. If the headers don't declare a
2436 function, let it remain undeclared.
2438 While it may seem unclean to use a function without declaring it,
2439 in practice this works fine for most system library functions on
2440 the systems where this really happens; thus, the disadvantage is
2441 only theoretical. By contrast, actual declarations have
2442 frequently caused actual conflicts.
2444 * If you must declare a system function, don't specify the argument
2445 types. Use an old-style declaration, not a Standard C prototype.
2446 The more you specify about the function, the more likely a
2449 * In particular, don't unconditionally declare `malloc' or `realloc'.
2451 Most GNU programs use those functions just once, in functions
2452 conventionally named `xmalloc' and `xrealloc'. These functions
2453 call `malloc' and `realloc', respectively, and check the results.
2455 Because `xmalloc' and `xrealloc' are defined in your program, you
2456 can declare them in other files without any risk of type conflict.
2458 On most systems, `int' is the same length as a pointer; thus, the
2459 calls to `malloc' and `realloc' work fine. For the few
2460 exceptional systems (mostly 64-bit machines), you can use
2461 *conditionalized* declarations of `malloc' and `realloc'--or put
2462 these declarations in configuration files specific to those
2465 * The string functions require special treatment. Some Unix systems
2466 have a header file `string.h'; others have `strings.h'. Neither
2467 file name is portable. There are two things you can do: use
2468 Autoconf to figure out which file to include, or don't include
2471 * If you don't include either strings file, you can't get
2472 declarations for the string functions from the header file in the
2475 That causes less of a problem than you might think. The newer
2476 standard string functions should be avoided anyway because many
2477 systems still don't support them. The string functions you can
2480 strcpy strncpy strcat strncat
2481 strlen strcmp strncmp
2484 The copy and concatenate functions work fine without a declaration
2485 as long as you don't use their values. Using their values without
2486 a declaration fails on systems where the width of a pointer
2487 differs from the width of `int', and perhaps in other cases. It
2488 is trivial to avoid using their values, so do that.
2490 The compare functions and `strlen' work fine without a declaration
2491 on most systems, possibly all the ones that GNU software runs on.
2492 You may find it necessary to declare them *conditionally* on a few
2495 The search functions must be declared to return `char *'. Luckily,
2496 there is no variation in the data type they return. But there is
2497 variation in their names. Some systems give these functions the
2498 names `index' and `rindex'; other systems use the names `strchr'
2499 and `strrchr'. Some systems support both pairs of names, but
2500 neither pair works on all systems.
2502 You should pick a single pair of names and use it throughout your
2503 program. (Nowadays, it is better to choose `strchr' and `strrchr'
2504 for new programs, since those are the standard names.) Declare
2505 both of those names as functions returning `char *'. On systems
2506 which don't support those names, define them as macros in terms of
2507 the other pair. For example, here is what to put at the beginning
2508 of your file (or in a header) if you want to use the names
2509 `strchr' and `strrchr' throughout:
2512 #define strchr index
2514 #ifndef HAVE_STRRCHR
2515 #define strrchr rindex
2521 Here we assume that `HAVE_STRCHR' and `HAVE_STRRCHR' are macros
2522 defined in systems where the corresponding functions exist. One way to
2523 get them properly defined is to use Autoconf.
2526 File: standards.info, Node: Internationalization, Next: Mmap, Prev: System Functions, Up: Writing C
2528 5.8 Internationalization
2529 ========================
2531 GNU has a library called GNU gettext that makes it easy to translate the
2532 messages in a program into various languages. You should use this
2533 library in every program. Use English for the messages as they appear
2534 in the program, and let gettext provide the way to translate them into
2537 Using GNU gettext involves putting a call to the `gettext' macro
2538 around each string that might need translation--like this:
2540 printf (gettext ("Processing file `%s'..."));
2542 This permits GNU gettext to replace the string `"Processing file
2543 `%s'..."' with a translated version.
2545 Once a program uses gettext, please make a point of writing calls to
2546 `gettext' when you add new strings that call for translation.
2548 Using GNU gettext in a package involves specifying a "text domain
2549 name" for the package. The text domain name is used to separate the
2550 translations for this package from the translations for other packages.
2551 Normally, the text domain name should be the same as the name of the
2552 package--for example, `fileutils' for the GNU file utilities.
2554 To enable gettext to work well, avoid writing code that makes
2555 assumptions about the structure of words or sentences. When you want
2556 the precise text of a sentence to vary depending on the data, use two or
2557 more alternative string constants each containing a complete sentences,
2558 rather than inserting conditionalized words or phrases into a single
2561 Here is an example of what not to do:
2563 printf ("%d file%s processed", nfiles,
2564 nfiles != 1 ? "s" : "");
2566 The problem with that example is that it assumes that plurals are made
2567 by adding `s'. If you apply gettext to the format string, like this,
2569 printf (gettext ("%d file%s processed"), nfiles,
2570 nfiles != 1 ? "s" : "");
2572 the message can use different words, but it will still be forced to use
2573 `s' for the plural. Here is a better way:
2575 printf ((nfiles != 1 ? "%d files processed"
2576 : "%d file processed"),
2579 This way, you can apply gettext to each of the two strings
2582 printf ((nfiles != 1 ? gettext ("%d files processed")
2583 : gettext ("%d file processed")),
2586 This can be any method of forming the plural of the word for "file", and
2587 also handles languages that require agreement in the word for
2590 A similar problem appears at the level of sentence structure with
2593 printf ("# Implicit rule search has%s been done.\n",
2594 f->tried_implicit ? "" : " not");
2596 Adding `gettext' calls to this code cannot give correct results for all
2597 languages, because negation in some languages requires adding words at
2598 more than one place in the sentence. By contrast, adding `gettext'
2599 calls does the job straightfowardly if the code starts out like this:
2601 printf (f->tried_implicit
2602 ? "# Implicit rule search has been done.\n",
2603 : "# Implicit rule search has not been done.\n");
2606 File: standards.info, Node: Mmap, Prev: Internationalization, Up: Writing C
2611 Don't assume that `mmap' either works on all files or fails for all
2612 files. It may work on some files and fail on others.
2614 The proper way to use `mmap' is to try it on the specific file for
2615 which you want to use it--and if `mmap' doesn't work, fall back on
2616 doing the job in another way using `read' and `write'.
2618 The reason this precaution is needed is that the GNU kernel (the
2619 HURD) provides a user-extensible file system, in which there can be many
2620 different kinds of "ordinary files." Many of them support `mmap', but
2621 some do not. It is important to make programs handle all these kinds
2625 File: standards.info, Node: Documentation, Next: Managing Releases, Prev: Writing C, Up: Top
2627 6 Documenting Programs
2628 **********************
2630 A GNU program should ideally come with full free documentation, adequate
2631 for both reference and tutorial purposes. If the package can be
2632 programmed or extended, the documentation should cover programming or
2633 extending it, as well as just using it.
2637 * GNU Manuals:: Writing proper manuals.
2638 * Doc Strings and Manuals:: Compiling doc strings doesn't make a manual.
2639 * Manual Structure Details:: Specific structure conventions.
2640 * License for Manuals:: Writing the distribution terms for a manual.
2641 * Manual Credits:: Giving credit to documentation contributors.
2642 * Printed Manuals:: Mentioning the printed manual.
2643 * NEWS File:: NEWS files supplement manuals.
2644 * Change Logs:: Recording Changes
2645 * Man Pages:: Man pages are secondary.
2646 * Reading other Manuals:: How far you can go in learning
2650 File: standards.info, Node: GNU Manuals, Next: Doc Strings and Manuals, Up: Documentation
2655 The preferred document format for the GNU system is the Texinfo
2656 formatting language. Every GNU package should (ideally) have
2657 documentation in Texinfo both for reference and for learners. Texinfo
2658 makes it possible to produce a good quality formatted book, using TeX,
2659 and to generate an Info file. It is also possible to generate HTML
2660 output from Texinfo source. See the Texinfo manual, either the
2661 hardcopy, or the on-line version available through `info' or the Emacs
2662 Info subsystem (`C-h i').
2664 Nowadays some other formats such as Docbook and Sgmltexi can be
2665 converted automatically into Texinfo. It is ok to produce the Texinfo
2666 documentation by conversion this way, as long as it gives good results.
2668 Programmers often find it most natural to structure the documentation
2669 following the structure of the implementation, which they know. But
2670 this structure is not necessarily good for explaining how to use the
2671 program; it may be irrelevant and confusing for a user.
2673 At every level, from the sentences in a paragraph to the grouping of
2674 topics into separate manuals, the right way to structure documentation
2675 is according to the concepts and questions that a user will have in mind
2676 when reading it. Sometimes this structure of ideas matches the
2677 structure of the implementation of the software being documented--but
2678 often they are different. Often the most important part of learning to
2679 write good documentation is learning to notice when you are structuring
2680 the documentation like the implementation, and think about better
2683 For example, each program in the GNU system probably ought to be
2684 documented in one manual; but this does not mean each program should
2685 have its own manual. That would be following the structure of the
2686 implementation, rather than the structure that helps the user
2689 Instead, each manual should cover a coherent _topic_. For example,
2690 instead of a manual for `diff' and a manual for `diff3', we have one
2691 manual for "comparison of files" which covers both of those programs,
2692 as well as `cmp'. By documenting these programs together, we can make
2693 the whole subject clearer.
2695 The manual which discusses a program should certainly document all of
2696 the program's command-line options and all of its commands. It should
2697 give examples of their use. But don't organize the manual as a list of
2698 features. Instead, organize it logically, by subtopics. Address the
2699 questions that a user will ask when thinking about the job that the
2702 In general, a GNU manual should serve both as tutorial and reference.
2703 It should be set up for convenient access to each topic through Info,
2704 and for reading straight through (appendixes aside). A GNU manual
2705 should give a good introduction to a beginner reading through from the
2706 start, and should also provide all the details that hackers want. The
2707 Bison manual is a good example of this--please take a look at it to see
2710 That is not as hard as it first sounds. Arrange each chapter as a
2711 logical breakdown of its topic, but order the sections, and write their
2712 text, so that reading the chapter straight through makes sense. Do
2713 likewise when structuring the book into chapters, and when structuring a
2714 section into paragraphs. The watchword is, _at each point, address the
2715 most fundamental and important issue raised by the preceding text._
2717 If necessary, add extra chapters at the beginning of the manual which
2718 are purely tutorial and cover the basics of the subject. These provide
2719 the framework for a beginner to understand the rest of the manual. The
2720 Bison manual provides a good example of how to do this.
2722 To serve as a reference, a manual should have an Index that list all
2723 the functions, variables, options, and important concepts that are part
2724 of the program. One combined Index should do for a short manual, but
2725 sometimes for a complex package it is better to use multiple indices.
2726 The Texinfo manual includes advice on preparing good index entries, see
2727 *Note Making Index Entries: (texinfo)Index Entries, and see *Note
2728 Defining the Entries of an Index: (texinfo)Indexing Commands.
2730 Don't use Unix man pages as a model for how to write GNU
2731 documentation; most of them are terse, badly structured, and give
2732 inadequate explanation of the underlying concepts. (There are, of
2733 course, some exceptions.) Also, Unix man pages use a particular format
2734 which is different from what we use in GNU manuals.
2736 Please include an email address in the manual for where to report
2737 bugs _in the manual_.
2739 Please do not use the term "pathname" that is used in Unix
2740 documentation; use "file name" (two words) instead. We use the term
2741 "path" only for search paths, which are lists of directory names.
2743 Please do not use the term "illegal" to refer to erroneous input to a
2744 computer program. Please use "invalid" for this, and reserve the term
2745 "illegal" for activities punishable by law.
2748 File: standards.info, Node: Doc Strings and Manuals, Next: Manual Structure Details, Prev: GNU Manuals, Up: Documentation
2750 6.2 Doc Strings and Manuals
2751 ===========================
2753 Some programming systems, such as Emacs, provide a documentation string
2754 for each function, command or variable. You may be tempted to write a
2755 reference manual by compiling the documentation strings and writing a
2756 little additional text to go around them--but you must not do it. That
2757 approach is a fundamental mistake. The text of well-written
2758 documentation strings will be entirely wrong for a manual.
2760 A documentation string needs to stand alone--when it appears on the
2761 screen, there will be no other text to introduce or explain it.
2762 Meanwhile, it can be rather informal in style.
2764 The text describing a function or variable in a manual must not stand
2765 alone; it appears in the context of a section or subsection. Other text
2766 at the beginning of the section should explain some of the concepts, and
2767 should often make some general points that apply to several functions or
2768 variables. The previous descriptions of functions and variables in the
2769 section will also have given information about the topic. A description
2770 written to stand alone would repeat some of that information; this
2771 redundance looks bad. Meanwhile, the informality that is acceptable in
2772 a documentation string is totally unacceptable in a manual.
2774 The only good way to use documentation strings in writing a good
2775 manual is to use them as a source of information for writing good text.
2778 File: standards.info, Node: Manual Structure Details, Next: License for Manuals, Prev: Doc Strings and Manuals, Up: Documentation
2780 6.3 Manual Structure Details
2781 ============================
2783 The title page of the manual should state the version of the programs or
2784 packages documented in the manual. The Top node of the manual should
2785 also contain this information. If the manual is changing more
2786 frequently than or independent of the program, also state a version
2787 number for the manual in both of these places.
2789 Each program documented in the manual should have a node named
2790 `PROGRAM Invocation' or `Invoking PROGRAM'. This node (together with
2791 its subnodes, if any) should describe the program's command line
2792 arguments and how to run it (the sort of information people would look
2793 in a man page for). Start with an `@example' containing a template for
2794 all the options and arguments that the program uses.
2796 Alternatively, put a menu item in some menu whose item name fits one
2797 of the above patterns. This identifies the node which that item points
2798 to as the node for this purpose, regardless of the node's actual name.
2800 The `--usage' feature of the Info reader looks for such a node or
2801 menu item in order to find the relevant text, so it is essential for
2802 every Texinfo file to have one.
2804 If one manual describes several programs, it should have such a node
2805 for each program described in the manual.
2808 File: standards.info, Node: License for Manuals, Next: Manual Credits, Prev: Manual Structure Details, Up: Documentation
2810 6.4 License for Manuals
2811 =======================
2813 Please use the GNU Free Documentation License for all GNU manuals that
2814 are more than a few pages long. Likewise for a collection of short
2815 documents--you only need one copy of the GNU FDL for the whole
2816 collection. For a single short document, you can use a very permissive
2817 non-copyleft license, to avoid taking up space with a long license.
2819 See `http://www.gnu.org/copyleft/fdl-howto.html' for more explanation
2820 of how to employ the GFDL.
2822 Note that it is not obligatory to include a copy of the GNU GPL or
2823 GNU LGPL in a manual whose license is neither the GPL nor the LGPL. It
2824 can be a good idea to include the program's license in a large manual;
2825 in a short manual, whose size would be increased considerably by
2826 including the program's license, it is probably better not to include
2830 File: standards.info, Node: Manual Credits, Next: Printed Manuals, Prev: License for Manuals, Up: Documentation
2835 Please credit the principal human writers of the manual as the authors,
2836 on the title page of the manual. If a company sponsored the work, thank
2837 the company in a suitable place in the manual, but do not cite the
2838 company as an author.
2841 File: standards.info, Node: Printed Manuals, Next: NEWS File, Prev: Manual Credits, Up: Documentation
2846 The FSF publishes some GNU manuals in printed form. To encourage sales
2847 of these manuals, the on-line versions of the manual should mention at
2848 the very start that the printed manual is available and should point at
2849 information for getting it--for instance, with a link to the page
2850 `http://www.gnu.org/order/order.html'. This should not be included in
2851 the printed manual, though, because there it is redundant.
2853 It is also useful to explain in the on-line forms of the manual how
2854 the user can print out the manual from the sources.
2857 File: standards.info, Node: NEWS File, Next: Change Logs, Prev: Printed Manuals, Up: Documentation
2862 In addition to its manual, the package should have a file named `NEWS'
2863 which contains a list of user-visible changes worth mentioning. In
2864 each new release, add items to the front of the file and identify the
2865 version they pertain to. Don't discard old items; leave them in the
2866 file after the newer items. This way, a user upgrading from any
2867 previous version can see what is new.
2869 If the `NEWS' file gets very long, move some of the older items into
2870 a file named `ONEWS' and put a note at the end referring the user to
2874 File: standards.info, Node: Change Logs, Next: Man Pages, Prev: NEWS File, Up: Documentation
2879 Keep a change log to describe all the changes made to program source
2880 files. The purpose of this is so that people investigating bugs in the
2881 future will know about the changes that might have introduced the bug.
2882 Often a new bug can be found by looking at what was recently changed.
2883 More importantly, change logs can help you eliminate conceptual
2884 inconsistencies between different parts of a program, by giving you a
2885 history of how the conflicting concepts arose and who they came from.
2889 * Change Log Concepts::
2890 * Style of Change Logs::
2892 * Conditional Changes::
2893 * Indicating the Part Changed::
2896 File: standards.info, Node: Change Log Concepts, Next: Style of Change Logs, Up: Change Logs
2898 6.8.1 Change Log Concepts
2899 -------------------------
2901 You can think of the change log as a conceptual "undo list" which
2902 explains how earlier versions were different from the current version.
2903 People can see the current version; they don't need the change log to
2904 tell them what is in it. What they want from a change log is a clear
2905 explanation of how the earlier version differed.
2907 The change log file is normally called `ChangeLog' and covers an
2908 entire directory. Each directory can have its own change log, or a
2909 directory can use the change log of its parent directory-it's up to you.
2911 Another alternative is to record change log information with a
2912 version control system such as RCS or CVS. This can be converted
2913 automatically to a `ChangeLog' file using `rcs2log'; in Emacs, the
2914 command `C-x v a' (`vc-update-change-log') does the job.
2916 There's no need to describe the full purpose of the changes or how
2917 they work together. If you think that a change calls for explanation,
2918 you're probably right. Please do explain it--but please put the
2919 explanation in comments in the code, where people will see it whenever
2920 they see the code. For example, "New function" is enough for the
2921 change log when you add a function, because there should be a comment
2922 before the function definition to explain what it does.
2924 However, sometimes it is useful to write one line to describe the
2925 overall purpose of a batch of changes.
2927 The easiest way to add an entry to `ChangeLog' is with the Emacs
2928 command `M-x add-change-log-entry'. An entry should have an asterisk,
2929 the name of the changed file, and then in parentheses the name of the
2930 changed functions, variables or whatever, followed by a colon. Then
2931 describe the changes you made to that function or variable.
2934 File: standards.info, Node: Style of Change Logs, Next: Simple Changes, Prev: Change Log Concepts, Up: Change Logs
2936 6.8.2 Style of Change Logs
2937 --------------------------
2939 Here are some simple examples of change log entries, starting with the
2940 header line that says who made the change and when, followed by
2941 descriptions of specific changes. (These examples are drawn from Emacs
2944 1998-08-17 Richard Stallman <rms@gnu.org>
2946 * register.el (insert-register): Return nil.
2947 (jump-to-register): Likewise.
2949 * sort.el (sort-subr): Return nil.
2951 * tex-mode.el (tex-bibtex-file, tex-file, tex-region):
2952 Restart the tex shell if process is gone or stopped.
2953 (tex-shell-running): New function.
2955 * expr.c (store_one_arg): Round size up for move_block_to_reg.
2956 (expand_call): Round up when emitting USE insns.
2957 * stmt.c (assign_parms): Round size up for move_block_from_reg.
2959 It's important to name the changed function or variable in full.
2960 Don't abbreviate function or variable names, and don't combine them.
2961 Subsequent maintainers will often search for a function name to find all
2962 the change log entries that pertain to it; if you abbreviate the name,
2963 they won't find it when they search.
2965 For example, some people are tempted to abbreviate groups of function
2966 names by writing `* register.el ({insert,jump-to}-register)'; this is
2967 not a good idea, since searching for `jump-to-register' or
2968 `insert-register' would not find that entry.
2970 Separate unrelated change log entries with blank lines. When two
2971 entries represent parts of the same change, so that they work together,
2972 then don't put blank lines between them. Then you can omit the file
2973 name and the asterisk when successive entries are in the same file.
2975 Break long lists of function names by closing continued lines with
2976 `)', rather than `,', and opening the continuation with `(' as in this
2979 * keyboard.c (menu_bar_items, tool_bar_items)
2980 (Fexecute_extended_command): Deal with `keymap' property.
2983 File: standards.info, Node: Simple Changes, Next: Conditional Changes, Prev: Style of Change Logs, Up: Change Logs
2985 6.8.3 Simple Changes
2986 --------------------
2988 Certain simple kinds of changes don't need much detail in the change
2991 When you change the calling sequence of a function in a simple
2992 fashion, and you change all the callers of the function to use the new
2993 calling sequence, there is no need to make individual entries for all
2994 the callers that you changed. Just write in the entry for the function
2995 being called, "All callers changed"--like this:
2997 * keyboard.c (Fcommand_execute): New arg SPECIAL.
2998 All callers changed.
3000 When you change just comments or doc strings, it is enough to write
3001 an entry for the file, without mentioning the functions. Just "Doc
3002 fixes" is enough for the change log.
3004 There's no need to make change log entries for documentation files.
3005 This is because documentation is not susceptible to bugs that are hard
3006 to fix. Documentation does not consist of parts that must interact in a
3007 precisely engineered fashion. To correct an error, you need not know
3008 the history of the erroneous passage; it is enough to compare what the
3009 documentation says with the way the program actually works.
3012 File: standards.info, Node: Conditional Changes, Next: Indicating the Part Changed, Prev: Simple Changes, Up: Change Logs
3014 6.8.4 Conditional Changes
3015 -------------------------
3017 C programs often contain compile-time `#if' conditionals. Many changes
3018 are conditional; sometimes you add a new definition which is entirely
3019 contained in a conditional. It is very useful to indicate in the
3020 change log the conditions for which the change applies.
3022 Our convention for indicating conditional changes is to use square
3023 brackets around the name of the condition.
3025 Here is a simple example, describing a change which is conditional
3026 but does not have a function or entity name associated with it:
3028 * xterm.c [SOLARIS2]: Include string.h.
3030 Here is an entry describing a new definition which is entirely
3031 conditional. This new definition for the macro `FRAME_WINDOW_P' is
3032 used only when `HAVE_X_WINDOWS' is defined:
3034 * frame.h [HAVE_X_WINDOWS] (FRAME_WINDOW_P): Macro defined.
3036 Here is an entry for a change within the function `init_display',
3037 whose definition as a whole is unconditional, but the changes themselves
3038 are contained in a `#ifdef HAVE_LIBNCURSES' conditional:
3040 * dispnew.c (init_display) [HAVE_LIBNCURSES]: If X, call tgetent.
3042 Here is an entry for a change that takes affect only when a certain
3043 macro is _not_ defined:
3045 (gethostname) [!HAVE_SOCKETS]: Replace with winsock version.
3048 File: standards.info, Node: Indicating the Part Changed, Prev: Conditional Changes, Up: Change Logs
3050 6.8.5 Indicating the Part Changed
3051 ---------------------------------
3053 Indicate the part of a function which changed by using angle brackets
3054 enclosing an indication of what the changed part does. Here is an entry
3055 for a change in the part of the function `sh-while-getopts' that deals
3058 * progmodes/sh-script.el (sh-while-getopts) <sh>: Handle case that
3059 user-specified option string is empty.
3062 File: standards.info, Node: Man Pages, Next: Reading other Manuals, Prev: Change Logs, Up: Documentation
3067 In the GNU project, man pages are secondary. It is not necessary or
3068 expected for every GNU program to have a man page, but some of them do.
3069 It's your choice whether to include a man page in your program.
3071 When you make this decision, consider that supporting a man page
3072 requires continual effort each time the program is changed. The time
3073 you spend on the man page is time taken away from more useful work.
3075 For a simple program which changes little, updating the man page may
3076 be a small job. Then there is little reason not to include a man page,
3079 For a large program that changes a great deal, updating a man page
3080 may be a substantial burden. If a user offers to donate a man page,
3081 you may find this gift costly to accept. It may be better to refuse
3082 the man page unless the same person agrees to take full responsibility
3083 for maintaining it--so that you can wash your hands of it entirely. If
3084 this volunteer later ceases to do the job, then don't feel obliged to
3085 pick it up yourself; it may be better to withdraw the man page from the
3086 distribution until someone else agrees to update it.
3088 When a program changes only a little, you may feel that the
3089 discrepancies are small enough that the man page remains useful without
3090 updating. If so, put a prominent note near the beginning of the man
3091 page explaining that you don't maintain it and that the Texinfo manual
3092 is more authoritative. The note should say how to access the Texinfo
3096 File: standards.info, Node: Reading other Manuals, Prev: Man Pages, Up: Documentation
3098 6.10 Reading other Manuals
3099 ==========================
3101 There may be non-free books or documentation files that describe the
3102 program you are documenting.
3104 It is ok to use these documents for reference, just as the author of
3105 a new algebra textbook can read other books on algebra. A large portion
3106 of any non-fiction book consists of facts, in this case facts about how
3107 a certain program works, and these facts are necessarily the same for
3108 everyone who writes about the subject. But be careful not to copy your
3109 outline structure, wording, tables or examples from preexisting non-free
3110 documentation. Copying from free documentation may be ok; please check
3111 with the FSF about the individual case.
3114 File: standards.info, Node: Managing Releases, Next: References, Prev: Documentation, Up: Top
3116 7 The Release Process
3117 *********************
3119 Making a release is more than just bundling up your source files in a
3120 tar file and putting it up for FTP. You should set up your software so
3121 that it can be configured to run on a variety of systems. Your Makefile
3122 should conform to the GNU standards described below, and your directory
3123 layout should also conform to the standards discussed below. Doing so
3124 makes it easy to include your package into the larger framework of all
3129 * Configuration:: How Configuration Should Work
3130 * Makefile Conventions:: Makefile Conventions
3131 * Releases:: Making Releases
3134 File: standards.info, Node: Configuration, Next: Makefile Conventions, Up: Managing Releases
3136 7.1 How Configuration Should Work
3137 =================================
3139 Each GNU distribution should come with a shell script named
3140 `configure'. This script is given arguments which describe the kind of
3141 machine and system you want to compile the program for.
3143 The `configure' script must record the configuration options so that
3144 they affect compilation.
3146 One way to do this is to make a link from a standard name such as
3147 `config.h' to the proper configuration file for the chosen system. If
3148 you use this technique, the distribution should _not_ contain a file
3149 named `config.h'. This is so that people won't be able to build the
3150 program without configuring it first.
3152 Another thing that `configure' can do is to edit the Makefile. If
3153 you do this, the distribution should _not_ contain a file named
3154 `Makefile'. Instead, it should include a file `Makefile.in' which
3155 contains the input used for editing. Once again, this is so that people
3156 won't be able to build the program without configuring it first.
3158 If `configure' does write the `Makefile', then `Makefile' should
3159 have a target named `Makefile' which causes `configure' to be rerun,
3160 setting up the same configuration that was set up last time. The files
3161 that `configure' reads should be listed as dependencies of `Makefile'.
3163 All the files which are output from the `configure' script should
3164 have comments at the beginning explaining that they were generated
3165 automatically using `configure'. This is so that users won't think of
3166 trying to edit them by hand.
3168 The `configure' script should write a file named `config.status'
3169 which describes which configuration options were specified when the
3170 program was last configured. This file should be a shell script which,
3171 if run, will recreate the same configuration.
3173 The `configure' script should accept an option of the form
3174 `--srcdir=DIRNAME' to specify the directory where sources are found (if
3175 it is not the current directory). This makes it possible to build the
3176 program in a separate directory, so that the actual source directory is
3179 If the user does not specify `--srcdir', then `configure' should
3180 check both `.' and `..' to see if it can find the sources. If it finds
3181 the sources in one of these places, it should use them from there.
3182 Otherwise, it should report that it cannot find the sources, and should
3183 exit with nonzero status.
3185 Usually the easy way to support `--srcdir' is by editing a
3186 definition of `VPATH' into the Makefile. Some rules may need to refer
3187 explicitly to the specified source directory. To make this possible,
3188 `configure' can add to the Makefile a variable named `srcdir' whose
3189 value is precisely the specified directory.
3191 The `configure' script should also take an argument which specifies
3192 the type of system to build the program for. This argument should look
3197 For example, a Sun 3 might be `m68k-sun-sunos4.1'.
3199 The `configure' script needs to be able to decode all plausible
3200 alternatives for how to describe a machine. Thus, `sun3-sunos4.1'
3201 would be a valid alias. For many programs, `vax-dec-ultrix' would be
3202 an alias for `vax-dec-bsd', simply because the differences between
3203 Ultrix and BSD are rarely noticeable, but a few programs might need to
3206 There is a shell script called `config.sub' that you can use as a
3207 subroutine to validate system types and canonicalize aliases.
3209 Other options are permitted to specify in more detail the software
3210 or hardware present on the machine, and include or exclude optional
3211 parts of the package:
3213 `--enable-FEATURE[=PARAMETER]'
3214 Configure the package to build and install an optional user-level
3215 facility called FEATURE. This allows users to choose which
3216 optional features to include. Giving an optional PARAMETER of
3217 `no' should omit FEATURE, if it is built by default.
3219 No `--enable' option should *ever* cause one feature to replace
3220 another. No `--enable' option should ever substitute one useful
3221 behavior for another useful behavior. The only proper use for
3222 `--enable' is for questions of whether to build part of the program
3226 The package PACKAGE will be installed, so configure this package
3227 to work with PACKAGE.
3229 Possible values of PACKAGE include `gnu-as' (or `gas'), `gnu-ld',
3230 `gnu-libc', `gdb', `x', and `x-toolkit'.
3232 Do not use a `--with' option to specify the file name to use to
3233 find certain files. That is outside the scope of what `--with'
3236 All `configure' scripts should accept all of these "detail" options,
3237 whether or not they make any difference to the particular package at
3238 hand. In particular, they should accept any option that starts with
3239 `--with-' or `--enable-'. This is so users will be able to configure
3240 an entire GNU source tree at once with a single set of options.
3242 You will note that the categories `--with-' and `--enable-' are
3243 narrow: they *do not* provide a place for any sort of option you might
3244 think of. That is deliberate. We want to limit the possible
3245 configuration options in GNU software. We do not want GNU programs to
3246 have idiosyncratic configuration options.
3248 Packages that perform part of the compilation process may support
3249 cross-compilation. In such a case, the host and target machines for the
3250 program may be different.
3252 The `configure' script should normally treat the specified type of
3253 system as both the host and the target, thus producing a program which
3254 works for the same type of machine that it runs on.
3256 To configure a cross-compiler, cross-assembler, or what have you, you
3257 should specify a target different from the host, using the configure
3258 option `--target=TARGETTYPE'. The syntax for TARGETTYPE is the same as
3259 for the host type. So the command would look like this:
3261 ./configure HOSTTYPE --target=TARGETTYPE
3263 Programs for which cross-operation is not meaningful need not accept
3264 the `--target' option, because configuring an entire operating system
3265 for cross-operation is not a meaningful operation.
3267 Bootstrapping a cross-compiler requires compiling it on a machine
3268 other than the host it will run on. Compilation packages accept a
3269 configuration option `--build=BUILDTYPE' for specifying the
3270 configuration on which you will compile them, but the configure script
3271 should normally guess the build machine type (using `config.guess'), so
3272 this option is probably not necessary. The host and target types
3273 normally default from the build type, so in bootstrapping a
3274 cross-compiler you must specify them both explicitly.
3276 Some programs have ways of configuring themselves automatically. If
3277 your program is set up to do this, your `configure' script can simply
3278 ignore most of its arguments.
3281 File: standards.info, Node: Makefile Conventions, Next: Releases, Prev: Configuration, Up: Managing Releases
3283 7.2 Makefile Conventions
3284 ========================
3286 This node describes conventions for writing the Makefiles for GNU
3287 programs. Using Automake will help you write a Makefile that follows
3292 * Makefile Basics:: General Conventions for Makefiles
3293 * Utilities in Makefiles:: Utilities in Makefiles
3294 * Command Variables:: Variables for Specifying Commands
3295 * Directory Variables:: Variables for Installation Directories
3296 * Standard Targets:: Standard Targets for Users
3297 * Install Command Categories:: Three categories of commands in the `install'
3298 rule: normal, pre-install and post-install.
3301 File: standards.info, Node: Makefile Basics, Next: Utilities in Makefiles, Up: Makefile Conventions
3303 7.2.1 General Conventions for Makefiles
3304 ---------------------------------------
3306 Every Makefile should contain this line:
3310 to avoid trouble on systems where the `SHELL' variable might be
3311 inherited from the environment. (This is never a problem with GNU
3314 Different `make' programs have incompatible suffix lists and
3315 implicit rules, and this sometimes creates confusion or misbehavior. So
3316 it is a good idea to set the suffix list explicitly using only the
3317 suffixes you need in the particular Makefile, like this:
3322 The first line clears out the suffix list, the second introduces all
3323 suffixes which may be subject to implicit rules in this Makefile.
3325 Don't assume that `.' is in the path for command execution. When
3326 you need to run programs that are a part of your package during the
3327 make, please make sure that it uses `./' if the program is built as
3328 part of the make or `$(srcdir)/' if the file is an unchanging part of
3329 the source code. Without one of these prefixes, the current search
3332 The distinction between `./' (the "build directory") and
3333 `$(srcdir)/' (the "source directory") is important because users can
3334 build in a separate directory using the `--srcdir' option to
3335 `configure'. A rule of the form:
3337 foo.1 : foo.man sedscript
3338 sed -e sedscript foo.man > foo.1
3340 will fail when the build directory is not the source directory, because
3341 `foo.man' and `sedscript' are in the source directory.
3343 When using GNU `make', relying on `VPATH' to find the source file
3344 will work in the case where there is a single dependency file, since
3345 the `make' automatic variable `$<' will represent the source file
3346 wherever it is. (Many versions of `make' set `$<' only in implicit
3347 rules.) A Makefile target like
3350 $(CC) -I. -I$(srcdir) $(CFLAGS) -c bar.c -o foo.o
3352 should instead be written as
3355 $(CC) -I. -I$(srcdir) $(CFLAGS) -c $< -o $@
3357 in order to allow `VPATH' to work correctly. When the target has
3358 multiple dependencies, using an explicit `$(srcdir)' is the easiest way
3359 to make the rule work well. For example, the target above for `foo.1'
3362 foo.1 : foo.man sedscript
3363 sed -e $(srcdir)/sedscript $(srcdir)/foo.man > $@
3365 GNU distributions usually contain some files which are not source
3366 files--for example, Info files, and the output from Autoconf, Automake,
3367 Bison or Flex. Since these files normally appear in the source
3368 directory, they should always appear in the source directory, not in the
3369 build directory. So Makefile rules to update them should put the
3370 updated files in the source directory.
3372 However, if a file does not appear in the distribution, then the
3373 Makefile should not put it in the source directory, because building a
3374 program in ordinary circumstances should not modify the source directory
3377 Try to make the build and installation targets, at least (and all
3378 their subtargets) work correctly with a parallel `make'.
3381 File: standards.info, Node: Utilities in Makefiles, Next: Command Variables, Prev: Makefile Basics, Up: Makefile Conventions
3383 7.2.2 Utilities in Makefiles
3384 ----------------------------
3386 Write the Makefile commands (and any shell scripts, such as
3387 `configure') to run in `sh', not in `csh'. Don't use any special
3388 features of `ksh' or `bash'.
3390 The `configure' script and the Makefile rules for building and
3391 installation should not use any utilities directly except these:
3393 cat cmp cp diff echo egrep expr false grep install-info
3394 ln ls mkdir mv pwd rm rmdir sed sleep sort tar test touch true
3396 The compression program `gzip' can be used in the `dist' rule.
3398 Stick to the generally supported options for these programs. For
3399 example, don't use `mkdir -p', convenient as it may be, because most
3400 systems don't support it.
3402 It is a good idea to avoid creating symbolic links in makefiles,
3403 since a few systems don't support them.
3405 The Makefile rules for building and installation can also use
3406 compilers and related programs, but should do so via `make' variables
3407 so that the user can substitute alternatives. Here are some of the
3410 ar bison cc flex install ld ldconfig lex
3411 make makeinfo ranlib texi2dvi yacc
3413 Use the following `make' variables to run those programs:
3415 $(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LDCONFIG) $(LEX)
3416 $(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC)
3418 When you use `ranlib' or `ldconfig', you should make sure nothing
3419 bad happens if the system does not have the program in question.
3420 Arrange to ignore an error from that command, and print a message before
3421 the command to tell the user that failure of this command does not mean
3422 a problem. (The Autoconf `AC_PROG_RANLIB' macro can help with this.)
3424 If you use symbolic links, you should implement a fallback for
3425 systems that don't have symbolic links.
3427 Additional utilities that can be used via Make variables are:
3429 chgrp chmod chown mknod
3431 It is ok to use other utilities in Makefile portions (or scripts)
3432 intended only for particular systems where you know those utilities
3436 File: standards.info, Node: Command Variables, Next: Directory Variables, Prev: Utilities in Makefiles, Up: Makefile Conventions
3438 7.2.3 Variables for Specifying Commands
3439 ---------------------------------------
3441 Makefiles should provide variables for overriding certain commands,
3444 In particular, you should run most utility programs via variables.
3445 Thus, if you use Bison, have a variable named `BISON' whose default
3446 value is set with `BISON = bison', and refer to it with `$(BISON)'
3447 whenever you need to use Bison.
3449 File management utilities such as `ln', `rm', `mv', and so on, need
3450 not be referred to through variables in this way, since users don't
3451 need to replace them with other programs.
3453 Each program-name variable should come with an options variable that
3454 is used to supply options to the program. Append `FLAGS' to the
3455 program-name variable name to get the options variable name--for
3456 example, `BISONFLAGS'. (The names `CFLAGS' for the C compiler,
3457 `YFLAGS' for yacc, and `LFLAGS' for lex, are exceptions to this rule,
3458 but we keep them because they are standard.) Use `CPPFLAGS' in any
3459 compilation command that runs the preprocessor, and use `LDFLAGS' in
3460 any compilation command that does linking as well as in any direct use
3463 If there are C compiler options that _must_ be used for proper
3464 compilation of certain files, do not include them in `CFLAGS'. Users
3465 expect to be able to specify `CFLAGS' freely themselves. Instead,
3466 arrange to pass the necessary options to the C compiler independently
3467 of `CFLAGS', by writing them explicitly in the compilation commands or
3468 by defining an implicit rule, like this:
3471 ALL_CFLAGS = -I. $(CFLAGS)
3473 $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
3475 Do include the `-g' option in `CFLAGS', because that is not
3476 _required_ for proper compilation. You can consider it a default that
3477 is only recommended. If the package is set up so that it is compiled
3478 with GCC by default, then you might as well include `-O' in the default
3479 value of `CFLAGS' as well.
3481 Put `CFLAGS' last in the compilation command, after other variables
3482 containing compiler options, so the user can use `CFLAGS' to override
3485 `CFLAGS' should be used in every invocation of the C compiler, both
3486 those which do compilation and those which do linking.
3488 Every Makefile should define the variable `INSTALL', which is the
3489 basic command for installing a file into the system.
3491 Every Makefile should also define the variables `INSTALL_PROGRAM'
3492 and `INSTALL_DATA'. (The default for `INSTALL_PROGRAM' should be
3493 `$(INSTALL)'; the default for `INSTALL_DATA' should be `${INSTALL} -m
3494 644'.) Then it should use those variables as the commands for actual
3495 installation, for executables and nonexecutables respectively. Use
3496 these variables as follows:
3498 $(INSTALL_PROGRAM) foo $(bindir)/foo
3499 $(INSTALL_DATA) libfoo.a $(libdir)/libfoo.a
3501 Optionally, you may prepend the value of `DESTDIR' to the target
3502 filename. Doing this allows the installer to create a snapshot of the
3503 installation to be copied onto the real target filesystem later. Do not
3504 set the value of `DESTDIR' in your Makefile, and do not include it in
3505 any installed files. With support for `DESTDIR', the above examples
3508 $(INSTALL_PROGRAM) foo $(DESTDIR)$(bindir)/foo
3509 $(INSTALL_DATA) libfoo.a $(DESTDIR)$(libdir)/libfoo.a
3511 Always use a file name, not a directory name, as the second argument of
3512 the installation commands. Use a separate command for each file to be
3516 File: standards.info, Node: Directory Variables, Next: Standard Targets, Prev: Command Variables, Up: Makefile Conventions
3518 7.2.4 Variables for Installation Directories
3519 --------------------------------------------
3521 Installation directories should always be named by variables, so it is
3522 easy to install in a nonstandard place. The standard names for these
3523 variables are described below. They are based on a standard filesystem
3524 layout; variants of it are used in SVR4, 4.4BSD, GNU/Linux, Ultrix v4,
3525 and other modern operating systems.
3527 These two variables set the root for the installation. All the other
3528 installation directories should be subdirectories of one of these two,
3529 and nothing should be directly installed into these two directories.
3532 A prefix used in constructing the default values of the variables
3533 listed below. The default value of `prefix' should be
3534 `/usr/local'. When building the complete GNU system, the prefix
3535 will be empty and `/usr' will be a symbolic link to `/'. (If you
3536 are using Autoconf, write it as `@prefix@'.)
3538 Running `make install' with a different value of `prefix' from the
3539 one used to build the program should _not_ recompile the program.
3542 A prefix used in constructing the default values of some of the
3543 variables listed below. The default value of `exec_prefix' should
3544 be `$(prefix)'. (If you are using Autoconf, write it as
3547 Generally, `$(exec_prefix)' is used for directories that contain
3548 machine-specific files (such as executables and subroutine
3549 libraries), while `$(prefix)' is used directly for other
3552 Running `make install' with a different value of `exec_prefix'
3553 from the one used to build the program should _not_ recompile the
3556 Executable programs are installed in one of the following
3560 The directory for installing executable programs that users can
3561 run. This should normally be `/usr/local/bin', but write it as
3562 `$(exec_prefix)/bin'. (If you are using Autoconf, write it as
3566 The directory for installing executable programs that can be run
3567 from the shell, but are only generally useful to system
3568 administrators. This should normally be `/usr/local/sbin', but
3569 write it as `$(exec_prefix)/sbin'. (If you are using Autoconf,
3570 write it as `@sbindir@'.)
3573 The directory for installing executable programs to be run by other
3574 programs rather than by users. This directory should normally be
3575 `/usr/local/libexec', but write it as `$(exec_prefix)/libexec'.
3576 (If you are using Autoconf, write it as `@libexecdir@'.)
3578 Data files used by the program during its execution are divided into
3579 categories in two ways.
3581 * Some files are normally modified by programs; others are never
3582 normally modified (though users may edit some of these).
3584 * Some files are architecture-independent and can be shared by all
3585 machines at a site; some are architecture-dependent and can be
3586 shared only by machines of the same kind and operating system;
3587 others may never be shared between two machines.
3589 This makes for six different possibilities. However, we want to
3590 discourage the use of architecture-dependent files, aside from object
3591 files and libraries. It is much cleaner to make other data files
3592 architecture-independent, and it is generally not hard.
3594 Therefore, here are the variables Makefiles should use to specify
3598 The directory for installing read-only architecture independent
3599 data files. This should normally be `/usr/local/share', but write
3600 it as `$(prefix)/share'. (If you are using Autoconf, write it as
3601 `@datadir@'.) As a special exception, see `$(infodir)' and
3602 `$(includedir)' below.
3605 The directory for installing read-only data files that pertain to a
3606 single machine-that is to say, files for configuring a host.
3607 Mailer and network configuration files, `/etc/passwd', and so
3608 forth belong here. All the files in this directory should be
3609 ordinary ASCII text files. This directory should normally be
3610 `/usr/local/etc', but write it as `$(prefix)/etc'. (If you are
3611 using Autoconf, write it as `@sysconfdir@'.)
3613 Do not install executables here in this directory (they probably
3614 belong in `$(libexecdir)' or `$(sbindir)'). Also do not install
3615 files that are modified in the normal course of their use (programs
3616 whose purpose is to change the configuration of the system
3617 excluded). Those probably belong in `$(localstatedir)'.
3620 The directory for installing architecture-independent data files
3621 which the programs modify while they run. This should normally be
3622 `/usr/local/com', but write it as `$(prefix)/com'. (If you are
3623 using Autoconf, write it as `@sharedstatedir@'.)
3626 The directory for installing data files which the programs modify
3627 while they run, and that pertain to one specific machine. Users
3628 should never need to modify files in this directory to configure
3629 the package's operation; put such configuration information in
3630 separate files that go in `$(datadir)' or `$(sysconfdir)'.
3631 `$(localstatedir)' should normally be `/usr/local/var', but write
3632 it as `$(prefix)/var'. (If you are using Autoconf, write it as
3636 The directory for object files and libraries of object code. Do
3637 not install executables here, they probably ought to go in
3638 `$(libexecdir)' instead. The value of `libdir' should normally be
3639 `/usr/local/lib', but write it as `$(exec_prefix)/lib'. (If you
3640 are using Autoconf, write it as `@libdir@'.)
3643 The directory for installing the Info files for this package. By
3644 default, it should be `/usr/local/info', but it should be written
3645 as `$(prefix)/info'. (If you are using Autoconf, write it as
3649 The directory for installing any Emacs Lisp files in this package.
3650 By default, it should be `/usr/local/share/emacs/site-lisp', but
3651 it should be written as `$(prefix)/share/emacs/site-lisp'.
3653 If you are using Autoconf, write the default as `@lispdir@'. In
3654 order to make `@lispdir@' work, you need the following lines in
3655 your `configure.in' file:
3657 lispdir='${datadir}/emacs/site-lisp'
3661 The directory for installing header files to be included by user
3662 programs with the C `#include' preprocessor directive. This
3663 should normally be `/usr/local/include', but write it as
3664 `$(prefix)/include'. (If you are using Autoconf, write it as
3667 Most compilers other than GCC do not look for header files in
3668 directory `/usr/local/include'. So installing the header files
3669 this way is only useful with GCC. Sometimes this is not a problem
3670 because some libraries are only really intended to work with GCC.
3671 But some libraries are intended to work with other compilers.
3672 They should install their header files in two places, one
3673 specified by `includedir' and one specified by `oldincludedir'.
3676 The directory for installing `#include' header files for use with
3677 compilers other than GCC. This should normally be `/usr/include'.
3678 (If you are using Autoconf, you can write it as `@oldincludedir@'.)
3680 The Makefile commands should check whether the value of
3681 `oldincludedir' is empty. If it is, they should not try to use
3682 it; they should cancel the second installation of the header files.
3684 A package should not replace an existing header in this directory
3685 unless the header came from the same package. Thus, if your Foo
3686 package provides a header file `foo.h', then it should install the
3687 header file in the `oldincludedir' directory if either (1) there
3688 is no `foo.h' there or (2) the `foo.h' that exists came from the
3691 To tell whether `foo.h' came from the Foo package, put a magic
3692 string in the file--part of a comment--and `grep' for that string.
3694 Unix-style man pages are installed in one of the following:
3697 The top-level directory for installing the man pages (if any) for
3698 this package. It will normally be `/usr/local/man', but you should
3699 write it as `$(prefix)/man'. (If you are using Autoconf, write it
3703 The directory for installing section 1 man pages. Write it as
3707 The directory for installing section 2 man pages. Write it as
3711 *Don't make the primary documentation for any GNU software be a
3712 man page. Write a manual in Texinfo instead. Man pages are just
3713 for the sake of people running GNU software on Unix, which is a
3714 secondary application only.*
3717 The file name extension for the installed man page. This should
3718 contain a period followed by the appropriate digit; it should
3722 The file name extension for installed section 1 man pages.
3725 The file name extension for installed section 2 man pages.
3728 Use these names instead of `manext' if the package needs to
3729 install man pages in more than one section of the manual.
3731 And finally, you should set the following variable:
3734 The directory for the sources being compiled. The value of this
3735 variable is normally inserted by the `configure' shell script.
3736 (If you are using Autconf, use `srcdir = @srcdir@'.)
3740 # Common prefix for installation directories.
3741 # NOTE: This directory must exist when you start the install.
3743 exec_prefix = $(prefix)
3744 # Where to put the executable for the command `gcc'.
3745 bindir = $(exec_prefix)/bin
3746 # Where to put the directories used by the compiler.
3747 libexecdir = $(exec_prefix)/libexec
3748 # Where to put the Info files.
3749 infodir = $(prefix)/info
3751 If your program installs a large number of files into one of the
3752 standard user-specified directories, it might be useful to group them
3753 into a subdirectory particular to that program. If you do this, you
3754 should write the `install' rule to create these subdirectories.
3756 Do not expect the user to include the subdirectory name in the value
3757 of any of the variables listed above. The idea of having a uniform set
3758 of variable names for installation directories is to enable the user to
3759 specify the exact same values for several different GNU packages. In
3760 order for this to be useful, all the packages must be designed so that
3761 they will work sensibly when the user does so.
3764 File: standards.info, Node: Standard Targets, Next: Install Command Categories, Prev: Directory Variables, Up: Makefile Conventions
3766 7.2.5 Standard Targets for Users
3767 --------------------------------
3769 All GNU programs should have the following targets in their Makefiles:
3772 Compile the entire program. This should be the default target.
3773 This target need not rebuild any documentation files; Info files
3774 should normally be included in the distribution, and DVI files
3775 should be made only when explicitly asked for.
3777 By default, the Make rules should compile and link with `-g', so
3778 that executable programs have debugging symbols. Users who don't
3779 mind being helpless can strip the executables later if they wish.
3782 Compile the program and copy the executables, libraries, and so on
3783 to the file names where they should reside for actual use. If
3784 there is a simple test to verify that a program is properly
3785 installed, this target should run that test.
3787 Do not strip executables when installing them. Devil-may-care
3788 users can use the `install-strip' target to do that.
3790 If possible, write the `install' target rule so that it does not
3791 modify anything in the directory where the program was built,
3792 provided `make all' has just been done. This is convenient for
3793 building the program under one user name and installing it under
3796 The commands should create all the directories in which files are
3797 to be installed, if they don't already exist. This includes the
3798 directories specified as the values of the variables `prefix' and
3799 `exec_prefix', as well as all subdirectories that are needed. One
3800 way to do this is by means of an `installdirs' target as described
3803 Use `-' before any command for installing a man page, so that
3804 `make' will ignore any errors. This is in case there are systems
3805 that don't have the Unix man page documentation system installed.
3807 The way to install Info files is to copy them into `$(infodir)'
3808 with `$(INSTALL_DATA)' (*note Command Variables::), and then run
3809 the `install-info' program if it is present. `install-info' is a
3810 program that edits the Info `dir' file to add or update the menu
3811 entry for the given Info file; it is part of the Texinfo package.
3812 Here is a sample rule to install an Info file:
3814 $(DESTDIR)$(infodir)/foo.info: foo.info
3816 # There may be a newer info file in . than in srcdir.
3817 -if test -f foo.info; then d=.; \
3818 else d=$(srcdir); fi; \
3819 $(INSTALL_DATA) $$d/foo.info $(DESTDIR)$@; \
3820 # Run install-info only if it exists.
3821 # Use `if' instead of just prepending `-' to the
3822 # line so we notice real errors from install-info.
3823 # We use `$(SHELL) -c' because some shells do not
3824 # fail gracefully when there is an unknown command.
3825 if $(SHELL) -c 'install-info --version' \
3826 >/dev/null 2>&1; then \
3827 install-info --dir-file=$(DESTDIR)$(infodir)/dir \
3828 $(DESTDIR)$(infodir)/foo.info; \
3831 When writing the `install' target, you must classify all the
3832 commands into three categories: normal ones, "pre-installation"
3833 commands and "post-installation" commands. *Note Install Command
3837 Delete all the installed files--the copies that the `install'
3840 This rule should not modify the directories where compilation is
3841 done, only the directories where files are installed.
3843 The uninstallation commands are divided into three categories,
3844 just like the installation commands. *Note Install Command
3848 Like `install', but strip the executable files while installing
3849 them. In simple cases, this target can use the `install' target in
3853 $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \
3856 But if the package installs scripts as well as real executables,
3857 the `install-strip' target can't just refer to the `install'
3858 target; it has to strip the executables but not the scripts.
3860 `install-strip' should not strip the executables in the build
3861 directory which are being copied for installation. It should only
3862 strip the copies that are installed.
3864 Normally we do not recommend stripping an executable unless you
3865 are sure the program has no bugs. However, it can be reasonable
3866 to install a stripped executable for actual execution while saving
3867 the unstripped executable elsewhere in case there is a bug.
3870 Delete all files from the current directory that are normally
3871 created by building the program. Don't delete the files that
3872 record the configuration. Also preserve files that could be made
3873 by building, but normally aren't because the distribution comes
3876 Delete `.dvi' files here if they are not part of the distribution.
3879 Delete all files from the current directory that are created by
3880 configuring or building the program. If you have unpacked the
3881 source and built the program without creating any other files,
3882 `make distclean' should leave only the files that were in the
3886 Like `clean', but may refrain from deleting a few files that people
3887 normally don't want to recompile. For example, the `mostlyclean'
3888 target for GCC does not delete `libgcc.a', because recompiling it
3889 is rarely necessary and takes a lot of time.
3892 Delete almost everything from the current directory that can be
3893 reconstructed with this Makefile. This typically includes
3894 everything deleted by `distclean', plus more: C source files
3895 produced by Bison, tags tables, Info files, and so on.
3897 The reason we say "almost everything" is that running the command
3898 `make maintainer-clean' should not delete `configure' even if
3899 `configure' can be remade using a rule in the Makefile. More
3900 generally, `make maintainer-clean' should not delete anything that
3901 needs to exist in order to run `configure' and then begin to build
3902 the program. This is the only exception; `maintainer-clean' should
3903 delete everything else that can be rebuilt.
3905 The `maintainer-clean' target is intended to be used by a
3906 maintainer of the package, not by ordinary users. You may need
3907 special tools to reconstruct some of the files that `make
3908 maintainer-clean' deletes. Since these files are normally
3909 included in the distribution, we don't take care to make them easy
3910 to reconstruct. If you find you need to unpack the full
3911 distribution again, don't blame us.
3913 To help make users aware of this, the commands for the special
3914 `maintainer-clean' target should start with these two:
3916 @echo 'This command is intended for maintainers to use; it'
3917 @echo 'deletes files that may need special tools to rebuild.'
3920 Update a tags table for this program.
3923 Generate any Info files needed. The best way to write the rules
3928 foo.info: foo.texi chap1.texi chap2.texi
3929 $(MAKEINFO) $(srcdir)/foo.texi
3931 You must define the variable `MAKEINFO' in the Makefile. It should
3932 run the `makeinfo' program, which is part of the Texinfo
3935 Normally a GNU distribution comes with Info files, and that means
3936 the Info files are present in the source directory. Therefore,
3937 the Make rule for an info file should update it in the source
3938 directory. When users build the package, ordinarily Make will not
3939 update the Info files because they will already be up to date.
3942 Generate DVI files for all Texinfo documentation. For example:
3946 foo.dvi: foo.texi chap1.texi chap2.texi
3947 $(TEXI2DVI) $(srcdir)/foo.texi
3949 You must define the variable `TEXI2DVI' in the Makefile. It should
3950 run the program `texi2dvi', which is part of the Texinfo
3951 distribution.(1) Alternatively, write just the dependencies, and
3952 allow GNU `make' to provide the command.
3955 Create a distribution tar file for this program. The tar file
3956 should be set up so that the file names in the tar file start with
3957 a subdirectory name which is the name of the package it is a
3958 distribution for. This name can include the version number.
3960 For example, the distribution tar file of GCC version 1.40 unpacks
3961 into a subdirectory named `gcc-1.40'.
3963 The easiest way to do this is to create a subdirectory
3964 appropriately named, use `ln' or `cp' to install the proper files
3965 in it, and then `tar' that subdirectory.
3967 Compress the tar file with `gzip'. For example, the actual
3968 distribution file for GCC version 1.40 is called `gcc-1.40.tar.gz'.
3970 The `dist' target should explicitly depend on all non-source files
3971 that are in the distribution, to make sure they are up to date in
3972 the distribution. *Note Making Releases: Releases.
3975 Perform self-tests (if any). The user must build the program
3976 before running the tests, but need not install the program; you
3977 should write the self-tests so that they work when the program is
3978 built but not installed.
3980 The following targets are suggested as conventional names, for
3981 programs in which they are useful.
3984 Perform installation tests (if any). The user must build and
3985 install the program before running the tests. You should not
3986 assume that `$(bindir)' is in the search path.
3989 It's useful to add a target named `installdirs' to create the
3990 directories where files are installed, and their parent
3991 directories. There is a script called `mkinstalldirs' which is
3992 convenient for this; you can find it in the Texinfo package. You
3993 can use a rule like this:
3995 # Make sure all installation directories (e.g. $(bindir))
3996 # actually exist by making them if necessary.
3997 installdirs: mkinstalldirs
3998 $(srcdir)/mkinstalldirs $(bindir) $(datadir) \
3999 $(libdir) $(infodir) \
4002 or, if you wish to support `DESTDIR',
4004 # Make sure all installation directories (e.g. $(bindir))
4005 # actually exist by making them if necessary.
4006 installdirs: mkinstalldirs
4007 $(srcdir)/mkinstalldirs \
4008 $(DESTDIR)$(bindir) $(DESTDIR)$(datadir) \
4009 $(DESTDIR)$(libdir) $(DESTDIR)$(infodir) \
4012 This rule should not modify the directories where compilation is
4013 done. It should do nothing but create installation directories.
4015 ---------- Footnotes ----------
4017 (1) `texi2dvi' uses TeX to do the real work of formatting. TeX is
4018 not distributed with Texinfo.
4021 File: standards.info, Node: Install Command Categories, Prev: Standard Targets, Up: Makefile Conventions
4023 7.2.6 Install Command Categories
4024 --------------------------------
4026 When writing the `install' target, you must classify all the commands
4027 into three categories: normal ones, "pre-installation" commands and
4028 "post-installation" commands.
4030 Normal commands move files into their proper places, and set their
4031 modes. They may not alter any files except the ones that come entirely
4032 from the package they belong to.
4034 Pre-installation and post-installation commands may alter other
4035 files; in particular, they can edit global configuration files or data
4038 Pre-installation commands are typically executed before the normal
4039 commands, and post-installation commands are typically run after the
4042 The most common use for a post-installation command is to run
4043 `install-info'. This cannot be done with a normal command, since it
4044 alters a file (the Info directory) which does not come entirely and
4045 solely from the package being installed. It is a post-installation
4046 command because it needs to be done after the normal command which
4047 installs the package's Info files.
4049 Most programs don't need any pre-installation commands, but we have
4050 the feature just in case it is needed.
4052 To classify the commands in the `install' rule into these three
4053 categories, insert "category lines" among them. A category line
4054 specifies the category for the commands that follow.
4056 A category line consists of a tab and a reference to a special Make
4057 variable, plus an optional comment at the end. There are three
4058 variables you can use, one for each category; the variable name
4059 specifies the category. Category lines are no-ops in ordinary execution
4060 because these three Make variables are normally undefined (and you
4061 _should not_ define them in the makefile).
4063 Here are the three possible category lines, each with a comment that
4064 explains what it means:
4066 $(PRE_INSTALL) # Pre-install commands follow.
4067 $(POST_INSTALL) # Post-install commands follow.
4068 $(NORMAL_INSTALL) # Normal commands follow.
4070 If you don't use a category line at the beginning of the `install'
4071 rule, all the commands are classified as normal until the first category
4072 line. If you don't use any category lines, all the commands are
4073 classified as normal.
4075 These are the category lines for `uninstall':
4077 $(PRE_UNINSTALL) # Pre-uninstall commands follow.
4078 $(POST_UNINSTALL) # Post-uninstall commands follow.
4079 $(NORMAL_UNINSTALL) # Normal commands follow.
4081 Typically, a pre-uninstall command would be used for deleting entries
4082 from the Info directory.
4084 If the `install' or `uninstall' target has any dependencies which
4085 act as subroutines of installation, then you should start _each_
4086 dependency's commands with a category line, and start the main target's
4087 commands with a category line also. This way, you can ensure that each
4088 command is placed in the right category regardless of which of the
4089 dependencies actually run.
4091 Pre-installation and post-installation commands should not run any
4092 programs except for these:
4094 [ basename bash cat chgrp chmod chown cmp cp dd diff echo
4095 egrep expand expr false fgrep find getopt grep gunzip gzip
4096 hostname install install-info kill ldconfig ln ls md5sum
4097 mkdir mkfifo mknod mv printenv pwd rm rmdir sed sort tee
4098 test touch true uname xargs yes
4100 The reason for distinguishing the commands in this way is for the
4101 sake of making binary packages. Typically a binary package contains
4102 all the executables and other files that need to be installed, and has
4103 its own method of installing them--so it does not need to run the normal
4104 installation commands. But installing the binary package does need to
4105 execute the pre-installation and post-installation commands.
4107 Programs to build binary packages work by extracting the
4108 pre-installation and post-installation commands. Here is one way of
4109 extracting the pre-installation commands:
4111 make -n install -o all \
4112 PRE_INSTALL=pre-install \
4113 POST_INSTALL=post-install \
4114 NORMAL_INSTALL=normal-install \
4115 | gawk -f pre-install.awk
4117 where the file `pre-install.awk' could contain this:
4119 $0 ~ /^\t[ \t]*(normal_install|post_install)[ \t]*$/ {on = 0}
4121 $0 ~ /^\t[ \t]*pre_install[ \t]*$/ {on = 1}
4123 The resulting file of pre-installation commands is executed as a
4124 shell script as part of installing the binary package.
4127 File: standards.info, Node: Releases, Prev: Makefile Conventions, Up: Managing Releases
4132 Package the distribution of `Foo version 69.96' up in a gzipped tar
4133 file with the name `foo-69.96.tar.gz'. It should unpack into a
4134 subdirectory named `foo-69.96'.
4136 Building and installing the program should never modify any of the
4137 files contained in the distribution. This means that all the files
4138 that form part of the program in any way must be classified into "source
4139 files" and "non-source files". Source files are written by humans and
4140 never changed automatically; non-source files are produced from source
4141 files by programs under the control of the Makefile.
4143 The distribution should contain a file named `README' which gives
4144 the name of the package, and a general description of what it does. It
4145 is also good to explain the purpose of each of the first-level
4146 subdirectories in the package, if there are any. The `README' file
4147 should either state the version number of the package, or refer to where
4148 in the package it can be found.
4150 The `README' file should refer to the file `INSTALL', which should
4151 contain an explanation of the installation procedure.
4153 The `README' file should also refer to the file which contains the
4154 copying conditions. The GNU GPL, if used, should be in a file called
4155 `COPYING'. If the GNU LGPL is used, it should be in a file called
4158 Naturally, all the source files must be in the distribution. It is
4159 okay to include non-source files in the distribution, provided they are
4160 up-to-date and machine-independent, so that building the distribution
4161 normally will never modify them. We commonly include non-source files
4162 produced by Bison, `lex', TeX, and `makeinfo'; this helps avoid
4163 unnecessary dependencies between our distributions, so that users can
4164 install whichever packages they want to install.
4166 Non-source files that might actually be modified by building and
4167 installing the program should *never* be included in the distribution.
4168 So if you do distribute non-source files, always make sure they are up
4169 to date when you make a new distribution.
4171 Make sure that the directory into which the distribution unpacks (as
4172 well as any subdirectories) are all world-writable (octal mode 777).
4173 This is so that old versions of `tar' which preserve the ownership and
4174 permissions of the files from the tar archive will be able to extract
4175 all the files even if the user is unprivileged.
4177 Make sure that all the files in the distribution are world-readable.
4179 Make sure that no file name in the distribution is more than 14
4180 characters long. Likewise, no file created by building the program
4181 should have a name longer than 14 characters. The reason for this is
4182 that some systems adhere to a foolish interpretation of the POSIX
4183 standard, and refuse to open a longer name, rather than truncating as
4184 they did in the past.
4186 Don't include any symbolic links in the distribution itself. If the
4187 tar file contains symbolic links, then people cannot even unpack it on
4188 systems that don't support symbolic links. Also, don't use multiple
4189 names for one file in different directories, because certain file
4190 systems cannot handle this and that prevents unpacking the distribution.
4192 Try to make sure that all the file names will be unique on MS-DOS. A
4193 name on MS-DOS consists of up to 8 characters, optionally followed by a
4194 period and up to three characters. MS-DOS will truncate extra
4195 characters both before and after the period. Thus, `foobarhacker.c'
4196 and `foobarhacker.o' are not ambiguous; they are truncated to
4197 `foobarha.c' and `foobarha.o', which are distinct.
4199 Include in your distribution a copy of the `texinfo.tex' you used to
4200 test print any `*.texinfo' or `*.texi' files.
4202 Likewise, if your program uses small GNU software packages like
4203 regex, getopt, obstack, or termcap, include them in the distribution
4204 file. Leaving them out would make the distribution file a little
4205 smaller at the expense of possible inconvenience to a user who doesn't
4206 know what other files to get.
4209 File: standards.info, Node: References, Next: Index, Prev: Managing Releases, Up: Top
4211 8 References to Non-Free Software and Documentation
4212 ***************************************************
4214 A GNU program should not recommend use of any non-free program. We
4215 can't stop some people from writing proprietary programs, or stop other
4216 people from using them. But we can and should avoid helping to
4217 advertise them to new customers.
4219 Sometimes it is important to mention how to build your package on
4220 top of some non-free operating system or other non-free base package.
4221 In such cases, please mention the name of the non-free package or
4222 system in the briefest possible way. Don't include any references for
4223 where to find more information about the proprietary program. The goal
4224 should be that people already using the proprietary program will get
4225 the advice they need about how to use your free program, while people
4226 who don't already use the proprietary program will not see anything to
4227 encourage them to take an interest in it.
4229 Likewise, a GNU package should not refer the user to any non-free
4230 documentation for free software. The need for free documentation to go
4231 with free software is now a major focus of the GNU project; to show that
4232 we are serious about the need for free documentation, we must not
4233 undermine our position by recommending use of documentation that isn't
4237 File: standards.info, Node: Index, Prev: References, Up: Top
4245 * #endif, commenting: Comments. (line 54)
4246 * --help option: Command-Line Interfaces.
4248 * --version option: Command-Line Interfaces.
4250 * -Wall compiler option: Syntactic Conventions.
4252 * accepting contributions: Contributions. (line 6)
4253 * address for bug reports: Command-Line Interfaces.
4255 * ANSI C standard: Standard C. (line 6)
4256 * arbitrary limits on data: Semantics. (line 6)
4257 * autoconf: System Portability. (line 23)
4258 * avoiding proprietary code: Reading Non-Free Code.
4260 * behavior, dependent on program's name: User Interfaces. (line 6)
4261 * binary packages: Install Command Categories.
4263 * bindir: Directory Variables. (line 45)
4264 * braces, in C source: Formatting. (line 6)
4265 * bug reports: Command-Line Interfaces.
4267 * canonical name of a program: Command-Line Interfaces.
4269 * casting pointers to integers: CPU Portability. (line 67)
4270 * change logs: Change Logs. (line 6)
4271 * change logs, conditional changes: Conditional Changes. (line 6)
4272 * change logs, style: Style of Change Logs.
4274 * command-line arguments, decoding: Semantics. (line 46)
4275 * command-line interface: Command-Line Interfaces.
4277 * commenting: Comments. (line 6)
4278 * compatibility with C and POSIX standards: Compatibility. (line 6)
4279 * compiler warnings: Syntactic Conventions.
4281 * conditional changes, and change logs: Conditional Changes. (line 6)
4282 * conditionals, comments for: Comments. (line 54)
4283 * configure: Configuration. (line 6)
4284 * control-L: Formatting. (line 114)
4285 * conventions for makefiles: Makefile Conventions.
4287 * corba: Graphical Interfaces.
4289 * credits for manuals: Manual Credits. (line 6)
4290 * data types, and portability: CPU Portability. (line 6)
4291 * declaration for system functions: System Functions. (line 21)
4292 * documentation: Documentation. (line 6)
4293 * doschk: Names. (line 38)
4294 * downloading this manual: Preface. (line 23)
4295 * error messages: Semantics. (line 19)
4296 * error messages, formatting: Errors. (line 6)
4297 * exec_prefix: Directory Variables. (line 27)
4298 * expressions, splitting: Formatting. (line 77)
4299 * file usage: File Usage. (line 6)
4300 * file-name limitations: Names. (line 38)
4301 * formatting error messages: Errors. (line 6)
4302 * formatting source code: Formatting. (line 6)
4303 * formfeed: Formatting. (line 114)
4304 * function argument, declaring: Syntactic Conventions.
4306 * function prototypes: Standard C. (line 17)
4307 * getopt: Command-Line Interfaces.
4309 * gettext: Internationalization.
4311 * gnome: Graphical Interfaces.
4313 * graphical user interface: Graphical Interfaces.
4315 * gtk: Graphical Interfaces.
4317 * GUILE: Source Language. (line 38)
4318 * implicit int: Syntactic Conventions.
4320 * impossible conditions: Semantics. (line 70)
4321 * internationalization: Internationalization.
4323 * legal aspects: Legal Issues. (line 6)
4324 * legal papers: Contributions. (line 6)
4325 * libexecdir: Directory Variables. (line 58)
4326 * libraries: Libraries. (line 6)
4327 * library functions, and portability: System Functions. (line 6)
4328 * license for manuals: License for Manuals. (line 6)
4329 * lint: Syntactic Conventions.
4331 * long option names: Option Table. (line 6)
4332 * long-named options: Command-Line Interfaces.
4334 * makefile, conventions for: Makefile Conventions.
4336 * malloc return value: Semantics. (line 25)
4337 * man pages: Man Pages. (line 6)
4338 * manual structure: Manual Structure Details.
4340 * memory allocation failure: Semantics. (line 25)
4341 * memory usage: Memory Usage. (line 6)
4342 * message text, and internationalization: Internationalization.
4344 * mmap: Mmap. (line 6)
4345 * multiple variables in a line: Syntactic Conventions.
4347 * names of variables and functions: Names. (line 6)
4348 * NEWS file: NEWS File. (line 6)
4349 * non-POSIX systems, and portability: System Portability. (line 32)
4350 * non-standard extensions: Using Extensions. (line 6)
4351 * NUL characters: Semantics. (line 11)
4352 * open brace: Formatting. (line 6)
4353 * optional features, configure-time: Configuration. (line 76)
4354 * options for compatibility: Compatibility. (line 14)
4355 * output device and program's behavior: User Interfaces. (line 13)
4356 * packaging: Releases. (line 6)
4357 * portability, and data types: CPU Portability. (line 6)
4358 * portability, and library functions: System Functions. (line 6)
4359 * portability, between system types: System Portability. (line 6)
4360 * POSIX compatibility: Compatibility. (line 6)
4361 * POSIXLY_CORRECT, environment variable: Compatibility. (line 21)
4362 * post-installation commands: Install Command Categories.
4364 * pre-installation commands: Install Command Categories.
4366 * prefix: Directory Variables. (line 17)
4367 * program configuration: Configuration. (line 6)
4368 * program design: Design Advice. (line 6)
4369 * program name and its behavior: User Interfaces. (line 6)
4370 * program's canonical name: Command-Line Interfaces.
4372 * programming languges: Source Language. (line 6)
4373 * proprietary programs: Reading Non-Free Code.
4375 * README file: Releases. (line 17)
4376 * references to non-free material: References. (line 6)
4377 * releasing: Managing Releases. (line 6)
4378 * sbindir: Directory Variables. (line 51)
4379 * signal handling: Semantics. (line 59)
4380 * spaces before open-paren: Formatting. (line 71)
4381 * standard command-line options: Command-Line Interfaces.
4383 * standards for makefiles: Makefile Conventions.
4385 * string library functions: System Functions. (line 55)
4386 * syntactic conventions: Syntactic Conventions.
4388 * table of long options: Option Table. (line 6)
4389 * temporary files: Semantics. (line 84)
4390 * temporary variables: Syntactic Conventions.
4392 * texinfo.tex, in a distribution: Releases. (line 73)
4393 * TMPDIR environment variable: Semantics. (line 84)
4394 * trademarks: Trademarks. (line 6)
4395 * where to obtain standards.texi: Preface. (line 23)
4401 Node: Preface
\7f1582
4402 Node: Legal Issues
\7f3103
4403 Node: Reading Non-Free Code
\7f3567
4404 Node: Contributions
\7f5295
4405 Node: Trademarks
\7f7449
4406 Node: Design Advice
\7f8512
4407 Node: Source Language
\7f9019
4408 Node: Compatibility
\7f11031
4409 Node: Using Extensions
\7f12659
4410 Node: Standard C
\7f14235
4411 Node: Program Behavior
\7f16606
4412 Node: Semantics
\7f17525
4413 Node: Libraries
\7f22218
4414 Node: Errors
\7f23463
4415 Node: User Interfaces
\7f25244
4416 Node: Graphical Interfaces
\7f26849
4417 Node: Command-Line Interfaces
\7f27884
4418 Node: Option Table
\7f33374
4419 Node: Memory Usage
\7f48383
4420 Node: File Usage
\7f49408
4421 Node: Writing C
\7f50156
4422 Node: Formatting
\7f50998
4423 Node: Comments
\7f55061
4424 Node: Syntactic Conventions
\7f58363
4426 Node: System Portability
\7f63968
4427 Node: CPU Portability
\7f66353
4428 Node: System Functions
\7f69609
4429 Node: Internationalization
\7f74806
4431 Node: Documentation
\7f78669
4432 Node: GNU Manuals
\7f79774
4433 Node: Doc Strings and Manuals
\7f84831
4434 Node: Manual Structure Details
\7f86384
4435 Node: License for Manuals
\7f87802
4436 Node: Manual Credits
\7f88776
4437 Node: Printed Manuals
\7f89169
4438 Node: NEWS File
\7f89855
4439 Node: Change Logs
\7f90533
4440 Node: Change Log Concepts
\7f91287
4441 Node: Style of Change Logs
\7f93151
4442 Node: Simple Changes
\7f95186
4443 Node: Conditional Changes
\7f96430
4444 Node: Indicating the Part Changed
\7f97852
4445 Node: Man Pages
\7f98379
4446 Node: Reading other Manuals
\7f100003
4447 Node: Managing Releases
\7f100794
4448 Node: Configuration
\7f101550
4449 Node: Makefile Conventions
\7f108455
4450 Node: Makefile Basics
\7f109219
4451 Node: Utilities in Makefiles
\7f112393
4452 Node: Command Variables
\7f114538
4453 Node: Directory Variables
\7f118115
4454 Node: Standard Targets
\7f129009
4455 Ref: Standard Targets-Footnote-1
\7f140249
4456 Node: Install Command Categories
\7f140349
4457 Node: Releases
\7f144931
4458 Node: References
\7f149019
4459 Node: Index
\7f150414