mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Output make-style dependencies with -M.
This commit is contained in:
@@ -36,6 +36,9 @@ ULONG nCurrentREPTBlockCount;
|
|||||||
|
|
||||||
ULONG ulMacroReturnValue;
|
ULONG ulMacroReturnValue;
|
||||||
|
|
||||||
|
extern char *tzObjectname;
|
||||||
|
extern FILE *dependfile;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* defines for nCurrentStatus
|
* defines for nCurrentStatus
|
||||||
*/
|
*/
|
||||||
@@ -190,6 +193,9 @@ fstk_FindFile(char *fname)
|
|||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
if ((f = fopen(fname, "rb")) != NULL || errno != ENOENT) {
|
if ((f = fopen(fname, "rb")) != NULL || errno != ENOENT) {
|
||||||
|
if (dependfile) {
|
||||||
|
fprintf(dependfile, "%s: %s\n", tzObjectname, fname);
|
||||||
|
}
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ ULONG nTotalLines, nPass, nPC, nIFDepth, nErrors;
|
|||||||
|
|
||||||
extern int yydebug;
|
extern int yydebug;
|
||||||
|
|
||||||
|
FILE *dependfile;
|
||||||
|
extern char *tzObjectname;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Option stack
|
* Option stack
|
||||||
*/
|
*/
|
||||||
@@ -258,7 +261,7 @@ usage(void)
|
|||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
"Usage: rgbasm [-hv] [-b chars] [-Dname[=value]] [-g chars] [-i path]\n"
|
"Usage: rgbasm [-hv] [-b chars] [-Dname[=value]] [-g chars] [-i path]\n"
|
||||||
" [-o outfile] [-p pad_value] file.asm\n");
|
" [-M dependfile] [-o outfile] [-p pad_value] file.asm\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,6 +275,8 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
char *tzMainfile;
|
char *tzMainfile;
|
||||||
|
|
||||||
|
dependfile = NULL;
|
||||||
|
|
||||||
cldefines_size = 32;
|
cldefines_size = 32;
|
||||||
cldefines = reallocarray(cldefines, cldefines_size,
|
cldefines = reallocarray(cldefines, cldefines_size,
|
||||||
2 * sizeof(void *));
|
2 * sizeof(void *));
|
||||||
@@ -301,7 +306,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
newopt = CurrentOptions;
|
newopt = CurrentOptions;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "b:D:g:hi:o:p:v")) != -1) {
|
while ((ch = getopt(argc, argv, "b:D:g:hi:M:o:p:v")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'b':
|
case 'b':
|
||||||
if (strlen(optarg) == 2) {
|
if (strlen(optarg) == 2) {
|
||||||
@@ -332,6 +337,11 @@ main(int argc, char *argv[])
|
|||||||
case 'i':
|
case 'i':
|
||||||
fstk_AddIncludePath(optarg);
|
fstk_AddIncludePath(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'M':
|
||||||
|
if ((dependfile = fopen(optarg, "w")) == NULL) {
|
||||||
|
err(1, "Could not open dependfile %s", optarg);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
out_SetFileName(optarg);
|
out_SetFileName(optarg);
|
||||||
break;
|
break;
|
||||||
@@ -370,6 +380,10 @@ main(int argc, char *argv[])
|
|||||||
printf("Assembling %s\n", tzMainfile);
|
printf("Assembling %s\n", tzMainfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dependfile) {
|
||||||
|
fprintf(dependfile, "%s: %s\n", tzObjectname, tzMainfile);
|
||||||
|
}
|
||||||
|
|
||||||
nStartClock = clock();
|
nStartClock = clock();
|
||||||
|
|
||||||
nLineNo = 1;
|
nLineNo = 1;
|
||||||
|
|||||||
@@ -45,6 +45,11 @@ The
|
|||||||
option disables this behavior.
|
option disables this behavior.
|
||||||
.It Fl i Ar path
|
.It Fl i Ar path
|
||||||
Add an include path.
|
Add an include path.
|
||||||
|
.It Fl M Ar dependfile
|
||||||
|
Print
|
||||||
|
.Xr make 1
|
||||||
|
dependencies to
|
||||||
|
.Ar dependfile .
|
||||||
.It Fl o Ar outfile
|
.It Fl o Ar outfile
|
||||||
Write an object file to the given filename.
|
Write an object file to the given filename.
|
||||||
.It Fl p Ar pad_value
|
.It Fl p Ar pad_value
|
||||||
|
|||||||
Reference in New Issue
Block a user