13.11.2014 Views

GNUPro® Toolkit GNUPro Development Tools

GNUPro® Toolkit GNUPro Development Tools

GNUPro® Toolkit GNUPro Development Tools

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Utilities in Makefiles<br />

should not modify the source directory in any way.<br />

Try to make the build and installation targets, at least (and all their subtargets) work<br />

correctly with a parallel make.<br />

Utilities in Makefiles<br />

Write the Makefile commands (and any shell scripts, such as configure) to run in sh,<br />

not in csh. Don’t use any special features of ksh or bash.<br />

The configure script and the Makefile rules for building and installation should not<br />

use any utilities directly except the following:<br />

cat cmp cp diff echo egrep expr false grep install-info<br />

ln ls mkdir mv pwd rm rmdir sed sleep sort tar test touch true<br />

The compression program, gzip, can be used in the dist rule.<br />

Stick to the generally supported options for these programs. For example, don’t use<br />

mkdir -p, convenient as it may be, because most systems don’t support it. The<br />

Makefile rules for building and installation can also use compilers and related<br />

programs, but should do so using make variables so that the user can substitute<br />

alternatives.<br />

The following are some of the programs.<br />

ar bison cc flex install ld ldconfig lex<br />

make makeinfo ranlib texi2dvi yacc<br />

Use the following make variables:<br />

$(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LDCONFIG) $(LEX)<br />

$(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC)<br />

When you use ranlib or ldconfig, you should make sure nothing bad happens if the<br />

system does not have the program in question. Arrange to ignore an error from that<br />

command, and print a message before the command to tell the user that failure of this<br />

command does not mean a problem. The AC_PROG_RANLIB autoconf macro can help<br />

with this problem.<br />

If you use symbolic links, you should implement a fallback for systems that don’t<br />

have symbolic links.<br />

The following utilities also use the make variables.<br />

chgrp chmod chown mknod<br />

It is acceptable to use other utilities in Makefile portions (or scripts) intended only for<br />

particular systems where you know those utilities to exist.<br />

Standard Targets for Users<br />

All GNU programs should have the following targets in their Makefiles:<br />

Red Hat <strong>GNUPro</strong> <strong>Toolkit</strong> Using make / <strong>GNUPro</strong> <strong>Development</strong> <strong>Tools</strong> ■ 207

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!