make: Utilities in Makefiles
1
1 16.2 Utilities in Makefiles
1 ===========================
1
1 Write the Makefile commands (and any shell scripts, such as 'configure')
1 to run under 'sh' (both the traditional Bourne shell and the POSIX
1 shell), not 'csh'. Don't use any special features of 'ksh' or 'bash',
1 or POSIX features not widely supported in traditional Bourne 'sh'.
1
1 The 'configure' script and the Makefile rules for building and
1 installation should not use any utilities directly except these:
1
1 awk cat cmp cp diff echo egrep expr false grep install-info ln ls
1 mkdir mv printf pwd rm rmdir sed sleep sort tar test touch tr true
1
1 Compression programs such as 'gzip' can be used in the 'dist' rule.
1
1 Generally, stick to the widely-supported (usually POSIX-specified)
1 options and features of these programs. For example, don't use 'mkdir
1 -p', convenient as it may be, because a few systems don't support it at
1 all and with others, it is not safe for parallel execution. For a list
11 of known incompatibilities, see ⇒Portable Shell Programming
(autoconf)Portable Shell.
1
1 It is a good idea to avoid creating symbolic links in makefiles,
1 since a few file systems don't support them.
1
1 The Makefile rules for building and installation can also use
1 compilers and related programs, but should do so via 'make' variables so
1 that the user can substitute alternatives. Here are some of the
1 programs we mean:
1
1 ar bison cc flex install ld ldconfig lex
1 make makeinfo ranlib texi2dvi yacc
1
1 Use the following 'make' variables to run those programs:
1
1 $(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LDCONFIG) $(LEX)
1 $(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC)
1
1 When you use 'ranlib' or 'ldconfig', you should make sure nothing bad
1 happens if the system does not have the program in question. Arrange to
1 ignore an error from that command, and print a message before the
1 command to tell the user that failure of this command does not mean a
1 problem. (The Autoconf 'AC_PROG_RANLIB' macro can help with this.)
1
1 If you use symbolic links, you should implement a fallback for
1 systems that don't have symbolic links.
1
1 Additional utilities that can be used via Make variables are:
1
1 chgrp chmod chown mknod
1
1 It is ok to use other utilities in Makefile portions (or scripts)
1 intended only for particular systems where you know those utilities
1 exist.
1