From db545dffccd94782154d01a17430d08576198769 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 4 Feb 1993 00:01:08 +0000 Subject: Formerly read.c.~53~ --- read.c | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/read.c b/read.c index 654f77e..0b032d5 100644 --- a/read.c +++ b/read.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. +/* Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 + Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify @@ -343,6 +344,8 @@ read_makefile (filename, type) p = collapsed; while (isspace (*p)) ++p; + /* We cannot consider a line containing just a tab to be empty + because it might constitute an empty command for a target. */ if (*p == '\0' && lb.buffer[0] != '\t') continue; @@ -418,33 +421,34 @@ read_makefile (filename, type) unsigned int len; if (no_targets) - { - /* Ignore the commands in a rule with no targets. */ - no_targets = 0; - continue; - } + /* Ignore the commands in a rule with no targets. */ + continue; - if (filenames == 0) - makefile_fatal (filename, lineno, - "commands with no associated target"); - - /* Add this command line to end of the line being accumulated. */ - p = lb.buffer; - if (commands_idx == 0) - commands_started = lineno; - len = strlen (p); - if (len + 1 + commands_idx > commands_len) + /* If there is no preceding rule line, don't treat this line + as a command, even though it begins with a tab character. + SunOS 4 make appears to behave this way. */ + + if (filenames != 0) { - commands_len = (len + 1 + commands_idx) * 2; - commands = (char *) xrealloc (commands, commands_len); - } - bcopy (p, &commands[commands_idx], len); - commands_idx += len; - commands[commands_idx++] = '\n'; + /* Append this command line to the line being accumulated. */ + p = lb.buffer; + if (commands_idx == 0) + commands_started = lineno; + len = strlen (p); + if (len + 1 + commands_idx > commands_len) + { + commands_len = (len + 1 + commands_idx) * 2; + commands = (char *) xrealloc (commands, commands_len); + } + bcopy (p, &commands[commands_idx], len); + commands_idx += len; + commands[commands_idx++] = '\n'; - continue; + continue; + } } - else if (word1eq ("export", 6)) + + if (word1eq ("export", 6)) { struct variable *v; p2 = next_token (p + 6); -- cgit v1.2.3