Lines of
Makefile
from check-in 22c09ebad1
that are changed by the sequence of edits moving toward
check-in 0ffa676110:
ae8437b96b 2019-12-01 1: TCL_CONFIG_SH := /usr/lib64/tclConfig.sh
2: XVFS_ROOT_MOUNTPOINT := //xvfs:/
3: 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)
4: CFLAGS := -fPIC -g3 -ggdb3 -Wall $(XVFS_ADD_CFLAGS)
5: LDFLAGS := $(XVFS_ADD_LDFLAGS)
6: LIBS := $(shell . "${TCL_CONFIG_SH}" && echo "$${TCL_STUB_LIB_SPEC}")
7: TCLSH := tclsh
8: LIB_SUFFIX := $(shell . "${TCL_CONFIG_SH}"; echo "$${TCL_SHLIB_SUFFIX:-.so}")
9:
10: all: example-standalone$(LIB_SUFFIX) example-client$(LIB_SUFFIX) example-flexible$(LIB_SUFFIX) xvfs$(LIB_SUFFIX)
11:
992994189a 2019-11-14 12: example.c: $(shell find example -type f) $(shell find lib -type f) lib/xvfs/xvfs.c.rvt xvfs-create Makefile
992994189a 2019-11-14 13: ./xvfs-create --directory example --name example > example.c.new
992994189a 2019-11-14 14: mv example.c.new example.c
15:
16: example-standalone.o: example.c xvfs-core.h xvfs-core.c Makefile
17: $(CC) $(CPPFLAGS) -DXVFS_MODE_STANDALONE $(CFLAGS) -o example-standalone.o -c example.c
18:
19: example-standalone$(LIB_SUFFIX): example-standalone.o Makefile
22c09ebad1 2019-09-20 20: $(CC) $(CFLAGS) $(LDFLAGS) -shared -o example-standalone$(LIB_SUFFIX) example-standalone.o $(LIBS)
21:
22: example-client.o: example.c xvfs-core.h Makefile
23: $(CC) $(CPPFLAGS) -DXVFS_MODE_CLIENT $(CFLAGS) -o example-client.o -c example.c
24:
25: example-client$(LIB_SUFFIX): example-client.o Makefile
22c09ebad1 2019-09-20 26: $(CC) $(CFLAGS) $(LDFLAGS) -shared -o example-client$(LIB_SUFFIX) example-client.o $(LIBS)
27:
28: example-flexible.o: example.c xvfs-core.h Makefile
29: $(CC) $(CPPFLAGS) -DXVFS_MODE_FLEXIBLE $(CFLAGS) -o example-flexible.o -c example.c
30:
31: example-flexible$(LIB_SUFFIX): example-flexible.o Makefile
22c09ebad1 2019-09-20 32: $(CC) $(CFLAGS) $(LDFLAGS) -shared -o example-flexible$(LIB_SUFFIX) example-flexible.o $(LIBS)
33:
34: xvfs.o: xvfs-core.h xvfs-core.c Makefile
35: $(CC) $(CPPFLAGS) -DXVFS_MODE_SERVER $(CFLAGS) -o xvfs.o -c xvfs-core.c
36:
37: xvfs$(LIB_SUFFIX): xvfs.o Makefile
22c09ebad1 2019-09-20 38: $(CC) $(CFLAGS) $(LDFLAGS) -shared -o xvfs$(LIB_SUFFIX) xvfs.o $(LIBS)
39:
40: # xvfs-create-standalone is a standalone (i.e., no external dependencies
41: # like lib/minirivet, xvfs-core.c, etc) version of "xvfs-create"
42: xvfs-create-standalone: $(shell find lib -type f) xvfs-create xvfs-core.c xvfs-core.h lib/xvfs/xvfs.c.rvt Makefile
43: rm -f xvfs-create-standalone.new xvfs-create-standalone
44: ./xvfs-create --dump-tcl --remove-debug > xvfs-create-standalone.new
45: chmod +x xvfs-create-standalone.new
46: mv xvfs-create-standalone.new xvfs-create-standalone
47:
48: xvfs_random$(LIB_SUFFIX): $(shell find example -type f) $(shell find lib -type f) lib/xvfs/xvfs.c.rvt xvfs-create-random Makefile
49: ./xvfs-create-random | $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DXVFS_MODE_FLEXIBLE -x c - -shared -o xvfs_random$(LIB_SUFFIX) $(LIBS)
50:
51: xvfs_synthetic$(LIB_SUFFIX): $(shell find lib -type f) lib/xvfs/xvfs.c.rvt xvfs-create-synthetic Makefile
52: ./xvfs-create-synthetic | $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DXVFS_MODE_FLEXIBLE -x c - -shared -o xvfs_synthetic$(LIB_SUFFIX) $(LIBS)
53:
54: do-benchmark:
55: $(MAKE) clean all XVFS_ADD_CPPFLAGS="-UXVFS_DEBUG" XVFS_ADD_CFLAGS="-g0 -ggdb0 -s -O3"
56: ./benchmark.tcl
57:
58: test: example-standalone$(LIB_SUFFIX) xvfs$(LIB_SUFFIX) example-client$(LIB_SUFFIX) example-flexible$(LIB_SUFFIX) Makefile
59: rm -f __test__.tcl
60: echo 'if {[catch { eval $$::env(XVFS_TEST_LOAD_COMMANDS); source $(XVFS_ROOT_MOUNTPOINT)example/main.tcl }]} { puts stderr $$::errorInfo; exit 1 }; exit 0' > __test__.tcl
61: @export XVFS_ROOT_MOUNTPOINT; export XVFS_TEST_LOAD_COMMANDS; for XVFS_TEST_LOAD_COMMANDS in \
62: 'load ./example-standalone$(LIB_SUFFIX) Xvfs_example' \
63: 'load -global ./xvfs$(LIB_SUFFIX); load ./example-client$(LIB_SUFFIX) Xvfs_example' \
64: 'load ./xvfs$(LIB_SUFFIX); load ./example-flexible$(LIB_SUFFIX) Xvfs_example' \
65: 'load ./example-flexible$(LIB_SUFFIX) Xvfs_example'; do \
66: echo "[$${XVFS_TEST_LOAD_COMMANDS}] $(GDB) $(TCLSH) __test__.tcl $(TCL_TEST_ARGS)"; \
67: $(GDB) $(TCLSH) __test__.tcl $(TCL_TEST_ARGS) || exit 1; \
68: done
69: rm -f __test__.tcl
70:
71: do-test: test
72:
73: do-coverage:
74: $(MAKE) clean
75: $(MAKE) XVFS_ADD_CFLAGS=-coverage XVFS_ADD_LDFLAGS=-coverage
76: $(MAKE) test XVFS_TEST_EXIT_ON_FAILURE=0
77: rm -f xvfs-test-coverage.info
78: lcov --capture --directory . --output-file xvfs-test-coverage.info
79: rm -rf xvfs-test-coverage
80: mkdir xvfs-test-coverage
81: genhtml xvfs-test-coverage.info --output-directory xvfs-test-coverage
82: rm -f xvfs-test-coverage.info
83:
84: profile-bare: profile.c example.c xvfs-core.h xvfs-core.c Makefile
85: $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -UUSE_TCL_STUBS -o profile-bare profile.c -ltcl
86:
87: profile-gperf: profile.c example.c xvfs-core.h xvfs-core.c Makefile
88: $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -pg -UUSE_TCL_STUBS -o profile-gperf profile.c -ltcl
89:
90: do-profile: profile-bare profile-gperf Makefile
91: rm -rf oprofile_data
92: rm -f gmon.out callgrind.out
93: operf ./profile-bare
94: opreport
95: ./profile-gperf
96: gprof ./profile-gperf
97: valgrind --tool=callgrind --callgrind-out-file=callgrind.out ./profile-bare 10 2
98: callgrind_annotate callgrind.out
99:
100: clean:
101: rm -f xvfs-create-standalone.new xvfs-create-standalone
992994189a 2019-11-14 102: rm -f example.c example.c.new
103: rm -f example-standalone$(LIB_SUFFIX) example-standalone.o
104: rm -f example-client.o example-client$(LIB_SUFFIX)
105: rm -f example-flexible.o example-flexible$(LIB_SUFFIX)
106: rm -f xvfs.o xvfs$(LIB_SUFFIX)
107: rm -f example-standalone.gcda example-standalone.gcno
108: rm -f example-client.gcda example-client.gcno
109: rm -f example-flexible.gcda example-flexible.gcno
110: rm -f xvfs_random$(LIB_SUFFIX) xvfs_synthetic$(LIB_SUFFIX)
111: rm -f xvfs.gcda xvfs.gcno
112: rm -f __test__.tcl
113: rm -f profile-bare profile-gperf
114: rm -f gmon.out
115: rm -f callgrind.out
116: rm -rf oprofile_data
117: rm -f xvfs-test-coverage.info
118: rm -rf xvfs-test-coverage
119:
120: distclean: clean
121:
122: .PHONY: all clean distclean test do-test do-coverage do-benchmark do-profile