summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2017-08-16 22:08:36 -0700
committerH. Peter Anvin <hpa@zytor.com>2017-08-16 22:09:44 -0700
commitf05034fd5809c88d0a27cd2698e8cccca40f13a8 (patch)
treeb1c545c6f501e4f03470bb17cb7b93e5532a71df
parentff04a9ffe80003fb62d85f50ed44f9404db8109a (diff)
downloadnasm-f05034fd5809c88d0a27cd2698e8cccca40f13a8.tar.gz
nasm: when generating null targets for WMAKE, add %null
WMAKE wants an explicit %null directive; empty is not ok. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--asm/nasm.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/asm/nasm.c b/asm/nasm.c
index 60cd6ea5..213cfffb 100644
--- a/asm/nasm.c
+++ b/asm/nasm.c
@@ -219,9 +219,11 @@ static void emit_dependencies(StrList *list)
FILE *deps;
int linepos, len;
StrList *l, *nl;
- char wrapstr[] = " \\\n ";
+ bool wmake = (quote_for_make == quote_for_wmake);
+ const char *wrapstr, *nulltarget;
- wrapstr[1] = (quote_for_make == quote_for_wmake) ? '&' : '\\';
+ wrapstr = wmake ? " &\n " : " \\\n ";
+ nulltarget = wmake ? "\t%null\n" : "";
if (depend_file && strcmp(depend_file, "-")) {
deps = nasm_open_write(depend_file, NF_TEXT);
@@ -239,7 +241,7 @@ static void emit_dependencies(StrList *list)
char *file = quote_for_make(l->str);
len = strlen(file);
if (linepos + len > 62 && linepos > 1) {
- fwrite(wrapstr, 1, sizeof wrapstr-1, deps);
+ fputs(wrapstr, deps);
linepos = 1;
}
fprintf(deps, " %s", file);
@@ -251,7 +253,7 @@ static void emit_dependencies(StrList *list)
list_for_each_safe(l, nl, list) {
if (depend_emit_phony) {
char *file = quote_for_make(l->str);
- fprintf(deps, "%s :\n\n", file);
+ fprintf(deps, "%s :\n%s\n", file, nulltarget);
nasm_free(file);
}
nasm_free(l);