mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-23 19:42:08 +00:00
Add RGBASM -MC flag to continue -MG after missing dependency files (#1687)
This commit is contained in:
@@ -312,7 +312,7 @@ void fstk_RunInclude(std::string const &path, bool preInclude) {
|
||||
if (!fullPath) {
|
||||
if (generatedMissingIncludes && !preInclude) {
|
||||
// LCOV_EXCL_START
|
||||
if (verbose) {
|
||||
if (verbose && !continueAfterMissingIncludes) {
|
||||
printf("Aborting (-MG) on INCLUDE file '%s' (%s)\n", path.c_str(), strerror(errno));
|
||||
}
|
||||
// LCOV_EXCL_STOP
|
||||
|
||||
@@ -24,10 +24,11 @@
|
||||
#include "asm/symbol.hpp"
|
||||
#include "asm/warning.hpp"
|
||||
|
||||
FILE *dependFile = nullptr; // -M
|
||||
bool generatedMissingIncludes = false; // -MG
|
||||
bool generatePhonyDeps = false; // -MP
|
||||
std::string targetFileName; // -MQ, -MT
|
||||
FILE *dependFile = nullptr; // -M
|
||||
bool continueAfterMissingIncludes = false; // -MC
|
||||
bool generatedMissingIncludes = false; // -MG
|
||||
bool generatePhonyDeps = false; // -MP
|
||||
std::string targetFileName; // -MQ, -MT
|
||||
bool failedOnMissingInclude = false;
|
||||
bool verbose = false; // -v
|
||||
|
||||
@@ -70,6 +71,7 @@ static option const longopts[] = {
|
||||
{"help", no_argument, nullptr, 'h'},
|
||||
{"include", required_argument, nullptr, 'I'},
|
||||
{"dependfile", required_argument, nullptr, 'M'},
|
||||
{"MC", no_argument, &depType, 'C'},
|
||||
{"MG", no_argument, &depType, 'G'},
|
||||
{"MP", no_argument, &depType, 'P'},
|
||||
{"MQ", required_argument, &depType, 'Q'},
|
||||
@@ -91,7 +93,7 @@ static option const longopts[] = {
|
||||
static void printUsage() {
|
||||
fputs(
|
||||
"Usage: rgbasm [-EhVvw] [-b chars] [-D name[=value]] [-g chars] [-I path]\n"
|
||||
" [-M depend_file] [-MG] [-MP] [-MT target_file] [-MQ target_file]\n"
|
||||
" [-M depend_file] [-MC] [-MG] [-MP] [-MT target_file] [-MQ target_file]\n"
|
||||
" [-o out_file] [-P include_file] [-p pad_value] [-Q precision]\n"
|
||||
" [-r depth] [-s features:state_file] [-W warning] [-X max_errors]\n"
|
||||
" <file>\n"
|
||||
@@ -372,6 +374,10 @@ int main(int argc, char *argv[]) {
|
||||
// Long-only options
|
||||
case 0:
|
||||
switch (depType) {
|
||||
case 'C':
|
||||
continueAfterMissingIncludes = true;
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
generatedMissingIncludes = true;
|
||||
break;
|
||||
|
||||
@@ -1137,7 +1137,7 @@ export_def:
|
||||
include:
|
||||
label POP_INCLUDE string endofline {
|
||||
fstk_RunInclude($3, false);
|
||||
if (failedOnMissingInclude) {
|
||||
if (failedOnMissingInclude && !continueAfterMissingIncludes) {
|
||||
YYACCEPT;
|
||||
}
|
||||
}
|
||||
@@ -1146,19 +1146,19 @@ include:
|
||||
incbin:
|
||||
POP_INCBIN string {
|
||||
sect_BinaryFile($2, 0);
|
||||
if (failedOnMissingInclude) {
|
||||
if (failedOnMissingInclude && !continueAfterMissingIncludes) {
|
||||
YYACCEPT;
|
||||
}
|
||||
}
|
||||
| POP_INCBIN string COMMA iconst {
|
||||
sect_BinaryFile($2, $4);
|
||||
if (failedOnMissingInclude) {
|
||||
if (failedOnMissingInclude && !continueAfterMissingIncludes) {
|
||||
YYACCEPT;
|
||||
}
|
||||
}
|
||||
| POP_INCBIN string COMMA iconst COMMA iconst {
|
||||
sect_BinaryFileSlice($2, $4, $6);
|
||||
if (failedOnMissingInclude) {
|
||||
if (failedOnMissingInclude && !continueAfterMissingIncludes) {
|
||||
YYACCEPT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -911,7 +911,7 @@ void sect_BinaryFile(std::string const &name, int32_t startPos) {
|
||||
if (!file) {
|
||||
if (generatedMissingIncludes) {
|
||||
// LCOV_EXCL_START
|
||||
if (verbose) {
|
||||
if (verbose && !continueAfterMissingIncludes) {
|
||||
printf("Aborting (-MG) on INCBIN file '%s' (%s)\n", name.c_str(), strerror(errno));
|
||||
}
|
||||
// LCOV_EXCL_STOP
|
||||
@@ -976,7 +976,7 @@ void sect_BinaryFileSlice(std::string const &name, int32_t startPos, int32_t len
|
||||
if (!file) {
|
||||
if (generatedMissingIncludes) {
|
||||
// LCOV_EXCL_START
|
||||
if (verbose) {
|
||||
if (verbose && !continueAfterMissingIncludes) {
|
||||
printf("Aborting (-MG) on INCBIN file '%s' (%s)\n", name.c_str(), strerror(errno));
|
||||
}
|
||||
// LCOV_EXCL_STOP
|
||||
|
||||
Reference in New Issue
Block a user