1
/*******************************************************************************
2
* Copyright (c) 2000, 2006 QNX Software Systems and others.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* QNX Software Systems - Initial API and implementation
10
*******************************************************************************/
11
package org.eclipse.cdt.make.internal.core.makefile;
13
import org.eclipse.cdt.make.core.makefile.ICommand;
14
import org.eclipse.cdt.make.core.makefile.ITargetRule;
17
* Makefile : ( statement ) *
18
* statement : rule | macro_definition | comments | empty
19
* rule : inference_rule | target_rule
20
* inference_rule : target ':' <nl> ( <tab> command <nl> ) +
21
* target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
22
[ ( <tab> prefix_command command ) * ]
23
* macro_definition : string '=' (string)*
24
* comments : '#' (string) *
26
* command : string <nl>
28
* prefix_command : '-' | '@' | '+'
29
* internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
32
public class TargetRule extends Rule implements ITargetRule {
34
String[] prerequisites;
36
public TargetRule(Directive parent, Target target) {
37
this(parent, target, new String[0], new Command[0]);
40
public TargetRule(Directive parent, Target target, String[] deps) {
41
this(parent, target, deps, new Command[0]);
44
public TargetRule(Directive parent, Target target, String[] reqs, Command[] commands) {
45
super(parent, target, commands);
49
public String[] getPrerequisites() {
53
public void setDependecies(String[] reqs) {
58
* @see java.lang.Object#toString()
60
public String toString() {
61
StringBuffer buffer = new StringBuffer();
62
buffer.append(getTarget().toString());
64
String[] reqs = getPrerequisites();
65
for (int i = 0; i < reqs.length; i++) {
66
buffer.append(' ').append(reqs[i]);
69
ICommand[] cmds = getCommands();
70
for (int i = 0; i < cmds.length; i++) {
71
buffer.append(cmds[i].toString());
73
return buffer.toString();