From d3986037daa387f1001f66ed7d74010291d527bb Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Mon, 15 Jul 2019 11:42:28 -0400 Subject: logic to make strerror.h from errlist --- Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Makefile 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' >> $@ -- cgit v1.2.1