Created
November 22, 2017 11:33
-
-
Save MightyPork/9b77584d6e1dc04130067bd9d6ff92d2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
$t = file_get_contents('Makefile'); | |
{ | |
$t = str_replace("BINPATH = \r\n", "BINPATH = /usr/bin\r\n", $t); | |
$t = preg_replace_callback('/C_SOURCES =.*?\r\n\r\n/s', function($m) { | |
$x = trim($m[0]); | |
$lines = array_map('trim', explode('\\', $x)); | |
$lines = array_slice($lines, 1); | |
$lines = array_unique($lines); | |
$t2 = "C_SOURCES = \\\r\n" . implode(" \\\r\n", $lines); | |
return $t2."\r\n\r\n"; | |
}, $t); | |
} | |
file_put_contents('Makefile', $t); | |
$t = file_get_contents("Src/freertos.c"); | |
{ | |
$t = str_replace('__weak void', 'void __attribute__((weak))', $t); | |
} | |
file_put_contents("Src/freertos.c", $t); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment