function replaceRuleCommandsInTarget(h, inTarget, allowedTargetType, newCommand)
%replaceRuleCommandsInTarget replaces the command of the rule with the
%newCommand for allowedTargetType.

% inTarget: 'coder.make.IntermediateTarget' type.
% allowedTargetType: cell array containing allowed Target Type strings.
% newCommand: the new command.

%   Copyright 2015 The MathWorks, Inc.

    if ismember(inTarget.TargetType, allowedTargetType)
        iter = coder.make.util.ListIterator(inTarget.Rules);
        while ~iter.endOf()
            rule = iter.next();
            rule.FullCommand = newCommand;
        end
    end
    
end