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