blob: 15cb8bb16d4457ae8ff72014a492cfb1ef4f5244 [file] [log] [blame]
diff --git a/libyasm/genmodule.c b/libyasm/genmodule.c
index 867d93a..027e2fe 100644
--- a/libyasm/genmodule.c
+++ b/libyasm/genmodule.c
@@ -58,9 +58,14 @@ main(int argc, char *argv[])
include *inc;
int isam = 0;
int linecont = 0;
-
- if (argc != 3) {
- fprintf(stderr, "Usage: %s <module.in> <Makefile[.am]>\n", argv[0]);
+ char *outfile;
+
+ if (argc == 3) {
+ outfile = OUTPUT;
+ } else if (argc == 4) {
+ outfile = argv[3];
+ } else {
+ fprintf(stderr, "Usage: %s <module.in> <Makefile[.am]> [<outfile>]\n", argv[0]);
return EXIT_FAILURE;
}
@@ -167,10 +172,10 @@ keepgoing:
fclose(in);
}
- out = fopen(OUTPUT, "wt");
+ out = fopen(outfile, "wt");
if (!out) {
- fprintf(stderr, "Could not open `%s'.\n", OUTPUT);
+ fprintf(stderr, "Could not open `%s'.\n", outfile);
return EXIT_FAILURE;
}
@@ -181,7 +186,7 @@ keepgoing:
if (!in) {
fprintf(stderr, "Could not open `%s'.\n", argv[1]);
fclose(out);
- remove(OUTPUT);
+ remove(outfile);
return EXIT_FAILURE;
}