1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
TCL_CONFIG_SH := /usr/lib64/tclConfig.sh
XVFS_ROOT_MOUNTPOINT := //xvfs:/
CPPFLAGS := -DXVFS_ROOT_MOUNTPOINT='"$(XVFS_ROOT_MOUNTPOINT)"' -I. -DUSE_TCL_STUBS=1 -DXVFS_DEBUG $(shell . "${TCL_CONFIG_SH}" && echo "$${TCL_INCLUDE_SPEC}") $(XVFS_ADD_CPPFLAGS)
CFLAGS := -fPIC -g3 -ggdb3 -Wall $(XVFS_ADD_CFLAGS)
LDFLAGS := $(XVFS_ADD_LDFLAGS)
LIBS := $(shell . "${TCL_CONFIG_SH}" && echo "$${TCL_STUB_LIB_SPEC}")
TCLSH := tclsh
LIB_SUFFIX := $(shell . "${TCL_CONFIG_SH}"; echo "$${TCL_SHLIB_SUFFIX:-.so}")
all: example-standalone$(LIB_SUFFIX) example-client$(LIB_SUFFIX) example-flexible$(LIB_SUFFIX) xvfs$(LIB_SUFFIX)
example.c: $(shell find example -type f) $(shell find lib -type f) lib/xvfs/xvfs.c.rvt xvfs-create Makefile
./xvfs-create --directory example --name example > example.c.new
mv example.c.new example.c
example-standalone.o: example.c xvfs-core.h xvfs-core.c Makefile
$(CC) $(CPPFLAGS) -DXVFS_MODE_STANDALONE $(CFLAGS) -o example-standalone.o -c example.c
example-standalone$(LIB_SUFFIX): example-standalone.o Makefile
$(CC) $(CFLAGS) $(LDFLAGS) -shared -o example-standalone$(LIB_SUFFIX) example-standalone.o $(LIBS)
|
>
>
|
|
>
>
|
>
>
|
|
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
|
TCLSH_NATIVE := tclsh
TCL_CONFIG_SH_DIR := $(shell echo 'puts [tcl::pkgconfig get libdir,runtime]' | $(TCLSH_NATIVE))
TCL_CONFIG_SH := $(TCL_CONFIG_SH_DIR)/tclConfig.sh
XVFS_ROOT_MOUNTPOINT := //xvfs:/
CPPFLAGS := -DXVFS_ROOT_MOUNTPOINT='"$(XVFS_ROOT_MOUNTPOINT)"' -I. -DUSE_TCL_STUBS=1 -DXVFS_DEBUG $(shell . "${TCL_CONFIG_SH}" && echo "$${TCL_INCLUDE_SPEC}") $(XVFS_ADD_CPPFLAGS)
CFLAGS := -fPIC -g3 -ggdb3 -Wall $(XVFS_ADD_CFLAGS)
LDFLAGS := $(XVFS_ADD_LDFLAGS)
LIBS := $(shell . "${TCL_CONFIG_SH}" && echo "$${TCL_STUB_LIB_SPEC}")
TCLSH := tclsh
LIB_SUFFIX := $(shell . "${TCL_CONFIG_SH}"; echo "$${TCL_SHLIB_SUFFIX:-.so}")
all: example-standalone$(LIB_SUFFIX) example-client$(LIB_SUFFIX) example-flexible$(LIB_SUFFIX) xvfs$(LIB_SUFFIX)
example.c: $(shell find example -type f) $(shell find lib -type f) lib/xvfs/xvfs.c.rvt xvfs-create-c xvfs-create Makefile
rm -f example.c.new.1 example.c.new.2
./xvfs-create-c --directory example --name example > example.c.new.1
./xvfs-create --directory example --name example > example.c.new.2
bash -c "diff -u <(grep -v '^ *$$' example.c.new.1) <(grep -v '^ *$$' example.c.new.2)" || :
rm -f example.c.new.2
mv example.c.new.1 example.c
example-standalone.o: example.c xvfs-core.h xvfs-core.c Makefile
$(CC) $(CPPFLAGS) -DXVFS_MODE_STANDALONE $(CFLAGS) -o example-standalone.o -c example.c
example-standalone$(LIB_SUFFIX): example-standalone.o Makefile
$(CC) $(CFLAGS) $(LDFLAGS) -shared -o example-standalone$(LIB_SUFFIX) example-standalone.o $(LIBS)
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# like lib/minirivet, xvfs-core.c, etc) version of "xvfs-create"
xvfs-create-standalone: $(shell find lib -type f) xvfs-create xvfs-core.c xvfs-core.h lib/xvfs/xvfs.c.rvt Makefile
rm -f xvfs-create-standalone.new xvfs-create-standalone
./xvfs-create --dump-tcl --remove-debug > xvfs-create-standalone.new
chmod +x xvfs-create-standalone.new
mv xvfs-create-standalone.new xvfs-create-standalone
xvfs_random$(LIB_SUFFIX): $(shell find example -type f) $(shell find lib -type f) lib/xvfs/xvfs.c.rvt xvfs-create-random Makefile
./xvfs-create-random | $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DXVFS_MODE_FLEXIBLE -x c - -shared -o xvfs_random$(LIB_SUFFIX) $(LIBS)
xvfs_synthetic$(LIB_SUFFIX): $(shell find lib -type f) lib/xvfs/xvfs.c.rvt xvfs-create-synthetic Makefile
./xvfs-create-synthetic | $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DXVFS_MODE_FLEXIBLE -x c - -shared -o xvfs_synthetic$(LIB_SUFFIX) $(LIBS)
do-benchmark:
|
>
>
>
>
>
>
|
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# like lib/minirivet, xvfs-core.c, etc) version of "xvfs-create"
xvfs-create-standalone: $(shell find lib -type f) xvfs-create xvfs-core.c xvfs-core.h lib/xvfs/xvfs.c.rvt Makefile
rm -f xvfs-create-standalone.new xvfs-create-standalone
./xvfs-create --dump-tcl --remove-debug > xvfs-create-standalone.new
chmod +x xvfs-create-standalone.new
mv xvfs-create-standalone.new xvfs-create-standalone
xvfs-create-c: xvfs-create-c.o
$(CC) $(CFLAGS) $(LDFLAGS) -o xvfs-create-c xvfs-create-c.o $(LIBS)
xvfs-create-c.o: xvfs-create-c.c
$(CC) $(CPPFLAGS) $(CFLAGS) -o xvfs-create-c.o -c xvfs-create-c.c
xvfs_random$(LIB_SUFFIX): $(shell find example -type f) $(shell find lib -type f) lib/xvfs/xvfs.c.rvt xvfs-create-random Makefile
./xvfs-create-random | $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DXVFS_MODE_FLEXIBLE -x c - -shared -o xvfs_random$(LIB_SUFFIX) $(LIBS)
xvfs_synthetic$(LIB_SUFFIX): $(shell find lib -type f) lib/xvfs/xvfs.c.rvt xvfs-create-synthetic Makefile
./xvfs-create-synthetic | $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DXVFS_MODE_FLEXIBLE -x c - -shared -o xvfs_synthetic$(LIB_SUFFIX) $(LIBS)
do-benchmark:
|
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
|
./profile-gperf
gprof ./profile-gperf
valgrind --tool=callgrind --callgrind-out-file=callgrind.out ./profile-bare 10 2
callgrind_annotate callgrind.out
clean:
rm -f xvfs-create-standalone.new xvfs-create-standalone
rm -f example.c example.c.new
rm -f example-standalone$(LIB_SUFFIX) example-standalone.o
rm -f example-client.o example-client$(LIB_SUFFIX)
rm -f example-flexible.o example-flexible$(LIB_SUFFIX)
rm -f xvfs.o xvfs$(LIB_SUFFIX)
rm -f example-standalone.gcda example-standalone.gcno
rm -f example-client.gcda example-client.gcno
rm -f example-flexible.gcda example-flexible.gcno
rm -f xvfs_random$(LIB_SUFFIX) xvfs_synthetic$(LIB_SUFFIX)
rm -f xvfs.gcda xvfs.gcno
rm -f __test__.tcl
rm -f profile-bare profile-gperf
rm -f gmon.out
rm -f callgrind.out
rm -rf oprofile_data
rm -f xvfs-test-coverage.info
rm -rf xvfs-test-coverage
distclean: clean
.PHONY: all clean distclean test do-test do-coverage do-benchmark do-profile
|
>
|
>
|
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
./profile-gperf
gprof ./profile-gperf
valgrind --tool=callgrind --callgrind-out-file=callgrind.out ./profile-bare 10 2
callgrind_annotate callgrind.out
clean:
rm -f xvfs-create-standalone.new xvfs-create-standalone
rm -f xvfs-create-c.o xvfs-create-c
rm -f example.c example.c.new example.c.new.1 example.c.new.2
rm -f example-standalone$(LIB_SUFFIX) example-standalone.o
rm -f example-client.o example-client$(LIB_SUFFIX)
rm -f example-flexible.o example-flexible$(LIB_SUFFIX)
rm -f xvfs.o xvfs$(LIB_SUFFIX)
rm -f example-standalone.gcda example-standalone.gcno
rm -f example-client.gcda example-client.gcno
rm -f example-flexible.gcda example-flexible.gcno
rm -f xvfs-create-c.gcda xvfs-create-c.gcno
rm -f xvfs_random$(LIB_SUFFIX) xvfs_synthetic$(LIB_SUFFIX)
rm -f xvfs.gcda xvfs.gcno
rm -f __test__.tcl
rm -f profile-bare profile-gperf
rm -f gmon.out
rm -f callgrind.out
rm -rf oprofile_data
rm -f xvfs-test-coverage.info
rm -rf xvfs-test-coverage
distclean: clean
.PHONY: all clean distclean test do-test do-coverage do-benchmark do-profile
|