Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!ut-sally!pyramid!decwrl!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.unix Subject: Re: Using sh in makefiles Message-ID: <4611@sun.uucp> Date: Sun, 29-Jun-86 02:43:48 EDT Article-I.D.: sun.4611 Posted: Sun Jun 29 02:43:48 1986 Date-Received: Mon, 30-Jun-86 04:20:27 EDT References: <1991@dalcs.UUCP> Distribution: net Organization: Sun Microsystems, Inc. Lines: 31 > Would like advice on how to use shell commands (such as if...) in > makefiles. I know that it all has to be on one line, but the only way I > can make a command work is through a kludge like: > > test: > echo "if x;then y;fi" | sh > > which seems pretty roundabout. Is this the only way to do it? Nope. If "make" recognizes any of a number of special characters in a command line, it passes that command line to "sh" rather than running the command itself. ";" is one of those characters, so test: if x; then y; fi is sufficient. Furthermore, they must all be on one "line"; however, "make"s idea of a "line" can be altered by using escaped newlines: test: if x; then \ y; \ fi will work. -- Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com (or guy@sun.arpa)