summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-07-15 11:42:28 -0400
committerJakob Kaivo <jkk@ung.org>2019-07-15 11:42:28 -0400
commitd3986037daa387f1001f66ed7d74010291d527bb (patch)
tree5003477cb52b0e9c0106ed7ff937080d7c1e3a44
parentf43c3e9e2d68f8a4229eee32146b7b85062fa8b9 (diff)
logic to make strerror.h from errlist
-rw-r--r--Makefile8
1 files changed, 8 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..a5faec4
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,8 @@
+strerror: strerror.c strerror.h
+ $(CC) $(CFLAGS) -o $@ strerror.c
+
+strerror.h: errlist Makefile
+ printf '#ifndef STRERROR_H\n#define STRERROR_H 1\n\n' > $@
+ printf 'struct { int number; char *name; } errlist[] = {\n' >> $@
+ awk '{printf("#ifdef %s\n\t{ %s,\t\"%s\" },\n#endif\n", $$0, $$0, $$0);}' errlist >> $@
+ printf '};\n\n#endif\n' >> $@