From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/gnu_make/utilities-in-makefiles.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 devdocs/gnu_make/utilities-in-makefiles.html (limited to 'devdocs/gnu_make/utilities-in-makefiles.html') diff --git a/devdocs/gnu_make/utilities-in-makefiles.html b/devdocs/gnu_make/utilities-in-makefiles.html new file mode 100644 index 00000000..60dd10c0 --- /dev/null +++ b/devdocs/gnu_make/utilities-in-makefiles.html @@ -0,0 +1,17 @@ +

Utilities in Makefiles

Write the Makefile commands (and any shell scripts, such as configure) to run under sh (both the traditional Bourne shell and the POSIX shell), not csh. Don’t use any special features of ksh or bash, or POSIX features not widely supported in traditional Bourne sh.

The configure script and the Makefile rules for building and installation should not use any utilities directly except these:

awk cat cmp cp diff echo egrep expr false grep install-info ln ls
+mkdir mv printf pwd rm rmdir sed sleep sort tar test touch tr true
+
+

Compression programs such as gzip can be used in the dist rule.

Generally, stick to the widely-supported (usually POSIX-specified) options and features of these programs. For example, don’t use ‘mkdir -p’, convenient as it may be, because a few systems don’t support it at all and with others, it is not safe for parallel execution. For a list of known incompatibilities, see Portable Shell Programming in Autoconf.

It is a good idea to avoid creating symbolic links in makefiles, since a few file systems don’t support them.

The Makefile rules for building and installation can also use compilers and related programs, but should do so via make variables so that the user can substitute alternatives. Here are some of the programs we mean:

ar bison cc flex install ld ldconfig lex
+make makeinfo ranlib texi2dvi yacc
+
+

Use the following make variables to run those programs:

$(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LDCONFIG) $(LEX)
+$(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC)
+
+

When you use ranlib or ldconfig, you should make sure nothing bad happens if the system does not have the program in question. Arrange to ignore an error from that command, and print a message before the command to tell the user that failure of this command does not mean a problem. (The Autoconf ‘AC_PROG_RANLIB’ macro can help with this.)

If you use symbolic links, you should implement a fallback for systems that don’t have symbolic links.

Additional utilities that can be used via Make variables are:

chgrp chmod chown mknod
+
+

It is ok to use other utilities in Makefile portions (or scripts) intended only for particular systems where you know those utilities exist.

+

+ Copyright © 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 Free Software Foundation, Inc.
Licensed under the GNU Free Documentation License.
+ https://www.gnu.org/software/make/manual/html_node/Utilities-in-Makefiles.html +

+
-- cgit v1.2.3