blob: f157cf97f2639ffba5fca967da6629a02aa29079 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
.POSIX:
CONFIGFILE = config.mk
include $(CONFIGFILE)
OBJ =\
consts.o\
memory.o\
print.o\
process.o\
sctrace.o\
util.o
HDR =\
linux/os.h\
linux/x86-64.h\
arg.h\
common.h\
list-errnos.h\
list-signums.h
all: sctrace
$(OBJ): $(@:.o=.c) $(HDR)
sctrace: $(OBJ)
$(CC) -o $@ $(OBJ) $(LDFLAGS)
.c.o:
$(CC) -c -o $@ $< $(CPPFLAGS) $(CFLAGS)
list-errnos.h:
printf '#define LIST_ERRNOS(_)\\\n\t' > $@
cat $(ERRNO_HDRS) | 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' >> $@
list-signums.h:
printf '#define LIST_SIGNUMS(_)\\\n\t' > $@
cat $(SIGNUM_HDRS) | 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"
mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man1"
cp -- sctrace "$(DESTDIR)$(PREFIX)/bin"
cp -- sctrace.1 "$(DESTDIR)$(MANPREFIX)/man1"
uninstall:
-rm -f -- "$(DESTDIR)$(PREFIX)/bin/sctrace"
-rm -f -- "$(DESTDIR)$(MANPREFIX)/man1/sctrace.1"
clean:
-rm -f -- *.o list-*.h sctrace
.SUFFIXES:
.SUFFIXES: .c .o
.PHONY: all install uninstall clean
|