maketab: support build systems with read-only source.
If your generated files are considered outputs that live elsewhere, you
need a way to tell maketab where ytab.h actually is.
Specifically, I'm trying to avoid checking in generated files in
Android's AOSP tree's copy of one-true-awk.
diff --git a/maketab.c b/maketab.c
index bb8e317..dbe3d24 100644
--- a/maketab.c
+++ b/maketab.c
@@ -125,8 +125,12 @@
for (i = SIZE; --i >= 0; )
names[i] = "";
- if ((fp = fopen("ytab.h", "r")) == NULL) {
- fprintf(stderr, "maketab can't open ytab.h!\n");
+ if (argc != 2) {
+ fprintf(stderr, "usage: maketab YTAB_H\n");
+ exit(1);
+ }
+ if ((fp = fopen(argv[1], "r")) == NULL) {
+ fprintf(stderr, "maketab can't open %s!\n", argv[1]);
exit(1);
}
printf("static char *printname[%d] = {\n", SIZE);