aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2020-05-30 13:51:35 +0200
committerMattias Andrée <maandree@kth.se>2020-05-30 13:51:35 +0200
commitcce6dac16bbbdd3b20203f66f8aa022b46d413ea (patch)
treed9284bd0ea849bd9cd32a4f0f8594a5bcd800a21 /Makefile
parentm (diff)
downloadsctrace-cce6dac16bbbdd3b20203f66f8aa022b46d413ea.tar.gz
sctrace-cce6dac16bbbdd3b20203f66f8aa022b46d413ea.tar.bz2
sctrace-cce6dac16bbbdd3b20203f66f8aa022b46d413ea.tar.xz
Print errno names and strings
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile11
1 files changed, 9 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index f24282a..1d032bc 100644
--- a/Makefile
+++ b/Makefile
@@ -5,9 +5,16 @@ include $(CONFIGFILE)
all: sctrace
-sctrace: sctrace.c arg.h
+sctrace: sctrace.c arg.h list-errnos.h
$(CC) -o $@ $@.c $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
+list-errnos.h:
+ printf '#define LIST_ERRNOS(_)\\\n\t' > $@
+ cat /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \
+ | sed 's/\/\/.*$$//' | tr -d '$$' | sed 's/\*\//\$$/g' | sed 's/\/\*[^$$]*\$$//g' \
+ | sed -n '/^[ \t]*#[ \t]*define[ \t].*[ \t][0-9]*[ \t]*$$/s/^[ \t#]*define[ \t]*\([^ \t]*\).*$$/_(\1)/p' \
+ | sort | uniq | tr '\n' '#' | sed 's/#_/\\\n\t_/g' | tr '#' '\n' >> $@
+
install: sctrace
mkdir -p -- "$(DESTDIR)$(PREFIX)/bin"
cp -- sctrace "$(DESTDIR)$(PREFIX)/bin"
@@ -16,6 +23,6 @@ uninstall:
-rm -f -- "$(DESTDIR)$(PREFIX)/bin/sctrace"
clean:
- -rm -f -- *.o sctrace
+ -rm -f -- *.o list-errnos.h sctrace
.PHONY: all install uninstall clean