Lines of
Makefile
from check-in 36d0805e0e
that are changed by the sequence of edits moving toward
check-in a01594ff30:
1: TCLSH_NATIVE := tclsh
2: TCL_CONFIG_SH_DIR := $(shell echo 'puts [tcl::pkgconfig get libdir,runtime]' | $(TCLSH_NATIVE))
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)
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:
14: example.c: $(shell find example -type f) $(shell find lib -type f) lib/xvfs/xvfs.c.rvt xvfs-create-c xvfs-create Makefile
15: rm -f example.c.new.1 example.c.new.2
16: ./xvfs-create-c --directory example --name example > example.c.new.1
17: ./xvfs-create --directory example --name example > example.c.new.2
18: bash -c "diff -u <(grep -v '^ *$$' example.c.new.1) <(grep -v '^ *$$' example.c.new.2)" || :
19: rm -f example.c.new.2
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
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
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
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
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
53:
54: xvfs-create-c: xvfs-create-c.o
55: $(CC) $(CFLAGS) $(LDFLAGS) -o xvfs-create-c xvfs-create-c.o $(LIBS)
56:
57: xvfs-create-c.o: xvfs-create-c.c
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
114: rm -f xvfs-create-c.o xvfs-create-c
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
123: rm -f xvfs_random$(LIB_SUFFIX) xvfs_synthetic$(LIB_SUFFIX)
124: rm -f xvfs.gcda xvfs.gcno
125: rm -f __test__.tcl
126: rm -f profile-bare profile-gperf
127: rm -f gmon.out
128: rm -f callgrind.out
129: rm -rf oprofile_data
130: rm -f xvfs-test-coverage.info
131: rm -rf xvfs-test-coverage
132:
133: distclean: clean
134:
135: .PHONY: all clean distclean test do-test do-coverage do-benchmark do-profile