48
48
49
49
import org .apache .commons .io .FileUtils ;
50
50
import org .eclipse .cdt .core .CCorePlugin ;
51
+ import org .eclipse .cdt .core .model .CoreModel ;
51
52
import org .eclipse .cdt .core .settings .model .CSourceEntry ;
52
53
import org .eclipse .cdt .core .settings .model .ICConfigurationDescription ;
54
+ import org .eclipse .cdt .core .settings .model .ICProjectDescription ;
53
55
import org .eclipse .cdt .core .settings .model .ICSettingEntry ;
54
56
import org .eclipse .cdt .core .settings .model .ICSourceEntry ;
55
57
import org .eclipse .cdt .core .settings .model .util .CDataUtil ;
@@ -906,7 +908,7 @@ public MultiStatus regenerateMakefiles() throws CoreException {
906
908
IFile sizeAwkFile1 = root .getFile (topBuildDir .append ("size.awk" ));
907
909
File sizeAwkFile = sizeAwkFile1 .getLocation ().toFile ();
908
910
String regex = Common .getBuildEnvironmentVariable (confDesc , "recipe.size.regex" , EMPTY );
909
- String awkContent = "/" + regex + "/ {arduino_size += $2 }\n " ;
911
+ String awkContent = "/" + regex + "/ {arduino_size += $2 }\n " ;
910
912
regex = Common .getBuildEnvironmentVariable (confDesc , "recipe.size.regex.data" , EMPTY );
911
913
awkContent += "/" + regex + "/ {arduino_data += $2 }\n " ;
912
914
regex = Common .getBuildEnvironmentVariable (confDesc , "recipe.size.regex.eeprom" , EMPTY );
@@ -1628,7 +1630,7 @@ protected boolean addRuleForTool(ITool tool, StringBuffer buffer, boolean bTarge
1628
1630
String [] cmdInputs = inputs .toArray (new String [inputs .size ()]);
1629
1631
IManagedCommandLineGenerator gen = tool .getCommandLineGenerator ();
1630
1632
IManagedCommandLineInfo cmdLInfo = gen .generateCommandLineInfo (tool , command , flags , outflag , outputPrefix ,
1631
- primaryOutputs , cmdInputs , tool . getCommandLinePattern ( ));
1633
+ primaryOutputs , cmdInputs , getToolCommandLinePattern ( tool ));
1632
1634
// The command to build
1633
1635
String buildCmd = null ;
1634
1636
if (cmdLInfo == null ) {
@@ -1646,6 +1648,17 @@ protected boolean addRuleForTool(ITool tool, StringBuffer buffer, boolean bTarge
1646
1648
// resolve any remaining macros in the command after it has been
1647
1649
// generated
1648
1650
try {
1651
+ //TOFIX JABA heavy hack to get the combiner to work properly
1652
+ //if the command contains ${ARCHIVES}
1653
+ //remove the ${AR}
1654
+ //replace ${ARCHIVES} with ${AR}
1655
+ String ARCHIVES = " ${ARCHIVES} " ;
1656
+ String AR = " $(AR) " ;
1657
+ if (buildCmd .contains (ARCHIVES )) {
1658
+ buildCmd = buildCmd .replace (AR , " " );
1659
+ buildCmd = buildCmd .replace (ARCHIVES , AR );
1660
+ }
1661
+ //end JABA heavy hack
1649
1662
String resolvedCommand = ManagedBuildManager .getBuildMacroProvider ().resolveValueToMakefileFormat (
1650
1663
buildCmd , EMPTY_STRING , WHITESPACE , IBuildMacroProvider .CONTEXT_FILE ,
1651
1664
new FileContextData (null , null , null , tool ));
@@ -2212,7 +2225,7 @@ private IManagedCommandLineInfo generateToolCommandLineInfo(ITool tool, String s
2212
2225
}
2213
2226
IManagedCommandLineGenerator gen = tool .getCommandLineGenerator ();
2214
2227
return gen .generateCommandLineInfo (tool , cmd , flags , outputFlag , outputPrefix , outputName , inputResources ,
2215
- tool . getCommandLinePattern ( ));
2228
+ getToolCommandLinePattern ( tool ));
2216
2229
}
2217
2230
2218
2231
/**
@@ -2577,7 +2590,7 @@ && containsSpecialCharacters(sourceLocation.toOSString()))
2577
2590
// Call the command line generator
2578
2591
IManagedCommandLineGenerator cmdLGen = tool .getCommandLineGenerator ();
2579
2592
cmdLInfo = cmdLGen .generateCommandLineInfo (tool , cmd , flags , outflag , outputPrefix ,
2580
- OUT_MACRO + otherPrimaryOutputs , inputStrings , tool . getCommandLinePattern ( ));
2593
+ OUT_MACRO + otherPrimaryOutputs , inputStrings , getToolCommandLinePattern ( tool ));
2581
2594
} else {
2582
2595
outflag = tool .getOutputFlag ();
2583
2596
outputPrefix = tool .getOutputPrefix ();
@@ -4525,4 +4538,16 @@ private ToolInfoHolder getToolInfo(IPath path, boolean create) {
4525
4538
}
4526
4539
return h ;
4527
4540
}
4541
+
4542
+ private String getToolCommandLinePattern (ITool tool ) {
4543
+ String orgPattern = tool .getCommandLinePattern ();
4544
+ if (orgPattern .contains ("$" )) {
4545
+ //if the pattern contains a space no use to try to expand it
4546
+ return orgPattern ;
4547
+ }
4548
+ ICProjectDescription prjDesc = CoreModel .getDefault ().getProjectDescription (project );
4549
+ ICConfigurationDescription confDesc = prjDesc .getConfigurationByName (config .getName ());
4550
+ return Common .getBuildEnvironmentVariable (confDesc , orgPattern , orgPattern , false );
4551
+
4552
+ }
4528
4553
}
0 commit comments