Merge pull request #782 from bbbbbr/lcc/postproc_detection

lcc: fix sometimes incorrect detection of postproc step
This commit is contained in:
bbbbbr
2025-05-14 15:53:04 -07:00
committed by GitHub
3 changed files with 13 additions and 3 deletions

View File

@@ -120,6 +120,7 @@ jobs:
shell: bash
run: |
export SDCCDIR=`pwd`/sdcc
export GBDK_DEBUG=1
cd gbdk-2020
make
# Now build the examples for all platforms
@@ -147,6 +148,7 @@ jobs:
run: |
# For Windows build Examples is a separate stage due to commands getting skipped(?) after calling msys make
# Now build the examples
set GBDK_DEBUG=1
cd gbdk-2020
cd build
cd gbdk

View File

@@ -3,6 +3,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
#include <ctype.h>
@@ -223,6 +224,7 @@ char *ld[256];
char *bankpack[256];
char *mkbin[256];
char *postproc[256];
bool has_postproc_stage;
char *rom_extension;
arg_entry *llist0_defaults;
int llist0_defaults_len = 0;
@@ -321,7 +323,12 @@ void finalise(void)
buildArgs(ld, _class->ld);
buildArgs(ihxcheck, _class->ihxcheck);
buildArgs(mkbin, _class->mkbin);
if (strlen(_class->postproc) != 0) buildArgs(postproc, _class->postproc); else postproc[0] = '\0';
if (strlen(_class->postproc) != 0) {
buildArgs(postproc, _class->postproc);
has_postproc_stage = true;
} else {
has_postproc_stage = false;
}
rom_extension = strdup(_class->rom_extension);
llist0_defaults = _class->llist0_defaults;
llist0_defaults_len = _class->llist0_defaults_len;

View File

@@ -65,6 +65,7 @@ static void warn_obsolete_option(char * arg);
// These get populated from _class using finalise() in gb.c
extern char *cpp[], *include[], *com[], *as[], *bankpack[], *ld[], *ihxcheck[], *mkbin[], *postproc[], inputs[], *suffixes[], *rom_extension;
extern bool has_postproc_stage;
extern arg_entry *llist0_defaults;
extern int llist0_defaults_len;
@@ -304,7 +305,7 @@ int main(int argc, char *argv[]) {
if(errcnt == 0)
{
// makebin - use output filename unless there is a post-process step
if (strlen(postproc) == 0)
if (has_postproc_stage == false)
sprintf(binFile, "%s", outfile);
else
sprintf(binFile, "%s", path_newext(outfile, EXT_ROM));
@@ -321,7 +322,7 @@ int main(int argc, char *argv[]) {
// Post-process step (such as makecom, makenes), if applicable
// This won't apply if the targets .postproc template entry is empty ("")
if ((strlen(postproc) != 0) && (errcnt == 0)) {
if (has_postproc_stage && (errcnt == 0)) {
compose(postproc, postproclist, append(binFile, 0), append(outfile, 0));
if (callsys(av))
errcnt++;