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