-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.in
127 lines (98 loc) · 3.09 KB
/
Makefile.in
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Makefile for wrap-syscall.
# Copyright (C) 2014 Free Software Foundation, Inc.
#
# This file is part of wrap-syscall.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
srcdir = @srcdir@
VPATH = @srcdir@
SHELL = @SHELL@
GUILE = @GUILE@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
DESTDIR =
CC = @CC@
CFLAGS = @CFLAGS@
GUILE_CPPFLAGS = @GUILE_CPPFLAGS@
GUILE_LIBS = @GUILE_LIBS@
# for off64_t, RTLD_NEXT
EXTRA_FLAGS = -D_LARGEFILE64_SOURCE -D_GNU_SOURCE
ALL_CFLAGS = $(CFLAGS) -I. $(GUILE_CPPFLAGS) $(EXTRA_FLAGS)
CLIBS = $(GUILE_LIBS)
GENFILES = ws-gen.h ws-preload-gen.c ws-gen.c
.PHONY: all
all: wrap-syscall-preload.so wrap-syscall.so \
mock-run.sh mock-strace.sh \
mock-example.x range-step-crash.x
TEST = mock-example
.PHONY: run
run: all
$(SHELL) ./mock-run.sh ./$(TEST).x $(srcdir)/$(TEST).gdb
.PHONY: strace
strace: all
$(SHELL) ./mock-strace.sh
.PHONY: clean
clean:
rm -f *.o *.so
rm -f tmp-*
rm -f *.i *.s *.x
rm -f $(GENFILES)
.PHONY: install
install:
$(INSTALL) wrap-syscall-preload.so $(DESTDIR)$(libdir)/wrap-syscall-preload.so
$(INSTALL) wrap-syscall.so $(DESTDIR)$(libdir)/wrap-syscall.so
wrap-syscall-preload.so: ws.h ws-gen.h ws-preload.c ws-preload-gen.c
$(CC) -o $@ $(ALL_CFLAGS) -fpic -shared $(srcdir)/ws-preload.c
wrap-syscall.so: ws.h ws-gen.h ws.c ws-gen.c
$(CC) -o $@ $(ALL_CFLAGS) -fpic -shared $(srcdir)/ws.c $(CLIBS)
# TODO: use of "stamp" files left for later
ws-gen.h: gen-ws.scm
rm -f $@ tmp-$@
$(GUILE) -e gen-ws-gen-h $(srcdir)/gen-ws.scm > tmp-$@
mv tmp-$@ $@
ws-preload-gen.c: gen-ws.scm
rm -f $@ tmp-$@
$(GUILE) -e gen-ws-preload-gen-c $(srcdir)/gen-ws.scm > tmp-$@
mv tmp-$@ $@
ws-gen.c: gen-ws.scm
rm -f $@ tmp-$@
$(GUILE) -e gen-ws-gen-c $(srcdir)/gen-ws.scm > tmp-$@
mv tmp-$@ $@
Makefile: Makefile.in config.status
CONFIG_FILES="Makefile" \
CONFIG_COMMANDS= \
CONFIG_HEADERS= \
$(SHELL) config.status
.PHONY: genfiles
genfiles: $(GENFILES)
# Always compile this one with -g -O0.
mock-example.x: mock-example.c
$(CC) -o $@ $(ALL_CFLAGS) -g -O0 $(srcdir)/mock-example.c
# Always compile this one with -g -O0.
range-step-crash.x: range-step-crash.c
$(CC) -o $@ $(ALL_CFLAGS) -g -O0 $(srcdir)/range-step-crash.c
mock-run.sh: mock-run.sh.in
CONFIG_FILES="mock-run.sh" \
CONFIG_COMMANDS= \
CONFIG_HEADERS= \
$(SHELL) config.status
mock-strace.sh: mock-strace.sh.in
CONFIG_FILES="mock-strace.sh" \
CONFIG_COMMANDS= \
CONFIG_HEADERS= \
$(SHELL) config.status