mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-09-22 10:43:39 -04:00
nasm: Handle -MF and -MD options
It's been long time since -MF and -MD options were described in docs but actually -MF was not implemented completely and -MD didn't proceed into normal compilation process. Fix it. Because we use bitmask for operating_mode selection I had to move compilation condition one shift left. http://bugzilla.nasm.us/show_bug.cgi?id=3392280 Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
17
nasm.c
17
nasm.c
@@ -369,7 +369,7 @@ int main(int argc, char **argv)
|
||||
/* define some macros dependent of command-line */
|
||||
define_macros_late();
|
||||
|
||||
depend_ptr = (depend_file || (operating_mode == OP_DEPEND)) ? &depend_list : NULL;
|
||||
depend_ptr = (depend_file || (operating_mode & OP_DEPEND)) ? &depend_list : NULL;
|
||||
if (!depend_target)
|
||||
depend_target = quote_for_make(outname);
|
||||
|
||||
@@ -434,7 +434,9 @@ int main(int argc, char **argv)
|
||||
if (ofile && terminate_after_phase)
|
||||
remove(outname);
|
||||
ofile = NULL;
|
||||
} else if (operating_mode & OP_NORMAL) {
|
||||
}
|
||||
|
||||
if (operating_mode & OP_NORMAL) {
|
||||
/*
|
||||
* We must call ofmt->filename _anyway_, even if the user
|
||||
* has specified their own output file, because some
|
||||
@@ -445,10 +447,9 @@ int main(int argc, char **argv)
|
||||
ofmt->filename(inname, outname);
|
||||
|
||||
ofile = fopen(outname, (ofmt->flags & OFMT_TEXT) ? "w" : "wb");
|
||||
if (!ofile) {
|
||||
if (!ofile)
|
||||
nasm_error(ERR_FATAL | ERR_NOFILE,
|
||||
"unable to open output file `%s'", outname);
|
||||
}
|
||||
|
||||
/*
|
||||
* We must call init_labels() before ofmt->init() since
|
||||
@@ -467,11 +468,10 @@ int main(int argc, char **argv)
|
||||
ofmt->cleanup(using_debug_info);
|
||||
cleanup_labels();
|
||||
fflush(ofile);
|
||||
if (ferror(ofile)) {
|
||||
if (ferror(ofile))
|
||||
nasm_error(ERR_NONFATAL|ERR_NOFILE,
|
||||
"write error on output file `%s'", outname);
|
||||
}
|
||||
}
|
||||
|
||||
if (ofile) {
|
||||
fclose(ofile);
|
||||
@@ -898,6 +898,11 @@ set_warning:
|
||||
depend_emit_phony = true;
|
||||
break;
|
||||
case 'D':
|
||||
operating_mode = OP_DEPEND | OP_NORMAL;
|
||||
depend_file = q;
|
||||
advance = true;
|
||||
break;
|
||||
case 'F':
|
||||
depend_file = q;
|
||||
advance = true;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user