Skip to content

Commit

Permalink
Expand $(MAKE) in csc files
Browse files Browse the repository at this point in the history
This makes csc files portable between Linux and
macOS.
  • Loading branch information
pjonsson committed Sep 1, 2023
1 parent 519e540 commit eca8fec
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
10 changes: 10 additions & 0 deletions doc/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Cooja v5.0

## Cooja User Interface Changes

## Cooja Simulation File Changes

### Expand $(MAKE) in csc files

Simulation file version 2023090101 introduces expansion of $(MAKE).

# Cooja v4.9

## Cooja User Interface Changes
Expand Down
2 changes: 1 addition & 1 deletion java/org/contikios/cooja/Cooja.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public class Cooja {
* Version used to detect incompatibility with the Cooja simulation config files.
* The format is <YYYY><MM><DD><2 digit sequence number>.
*/
public static final String SIMULATION_CONFIG_VERSION = "2022112801";
public static final String SIMULATION_CONFIG_VERSION = "2023090101";

/**
* Version used to detect incompatibility with the Contiki-NG
Expand Down
6 changes: 3 additions & 3 deletions java/org/contikios/cooja/dialogs/AbstractCompileDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,11 @@ public void actionPerformed(ActionEvent e1) {
nextCommandAction.actionPerformed(null); /* Recursive calls for all commands */
}
};
cleanButton.setToolTipText("make clean TARGET=" + targetName);
cleanButton.setToolTipText("$(MAKE) clean TARGET=" + targetName);
cleanButton.addActionListener(e -> {
createButton.setEnabled(false);
try {
currentCompilationProcess = BaseContikiMoteType.compile("make clean TARGET=" + targetName,
currentCompilationProcess = BaseContikiMoteType.compile("$(MAKE) clean TARGET=" + targetName,
moteType.getCompilationEnvironment(), new File(contikiField.getText()).getParentFile(),
null, null, new MessageListUI(), true);
} catch (Exception e1) {
Expand Down Expand Up @@ -545,7 +545,7 @@ protected void addMoteInterface(Class<? extends MoteInterface> intfClass, boolea
*/
protected String getDefaultCompileCommands(String name) {
String sourceNoExtension = new File(name.substring(0, name.length() - 2)).getName();
return Cooja.getExternalToolsSetting("PATH_MAKE") + " -j$(CPUS) " +
return "$(MAKE) -j$(CPUS) " +
sourceNoExtension + "." + targetName + " TARGET=" + targetName;
}

Expand Down
3 changes: 2 additions & 1 deletion java/org/contikios/cooja/mote/BaseContikiMoteType.java
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,9 @@ public static Process compile(
throws MoteTypeCreationException {
Pattern p = Pattern.compile("([^\\s\"']+|\"[^\"]*\"|'[^']*')");
// Perform compile command variable expansions.
String make = Cooja.getExternalToolsSetting("PATH_MAKE");
String cpus = Integer.toString(Runtime.getRuntime().availableProcessors());
Matcher m = p.matcher(commandIn.replace("$(CPUS)", cpus));
Matcher m = p.matcher(commandIn.replace("$(MAKE)", make).replace("$(CPUS)", cpus));
ArrayList<String> commandList = new ArrayList<>();
while (m.find()) {
String arg = m.group();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public String getQuickHelp() {
"<br>This plugin shows the source code for MSP430 based motes and can set or remove breakpoints." +
"<br><br>" +
"<b>Note:</b> You must compile the code with <i>DEBUG=1</i> to include information about the source code in the build." +
"<br><br>Example: make TARGET=sky DEBUG=1 hello-world";
"<br><br>Example: $(MAKE) -j$(CPUS) TARGET=sky DEBUG=1 hello-world";
}

private class Rule {
Expand Down

0 comments on commit eca8fec

Please sign in to comment.