Check-in [55084356ba]
Overview
Comment:Updated Makefile to support better testing and using user-defined tclConfig.sh
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 55084356ba0b2abed5bdd6afd2a7571ae1b8cadbc7419989f63897fc20aa05f3
User & Date: rkeene on 2019-09-17 19:13:18
Other Links: manifest | tags
Context
2019-09-17
19:58
Renamed the standalone mode to be standalone check-in: d09edad10f user: rkeene tags: trunk
19:13
Updated Makefile to support better testing and using user-defined tclConfig.sh check-in: 55084356ba user: rkeene tags: trunk
19:04
Supress a warning check-in: d058c6c7f8 user: rkeene tags: trunk
Changes

Modified Makefile from [4d994959ca] to [0ebaabe34e].


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
28
29
30
31
32
33
34
35
36
37
38
39
40
41





42
43
44
45

46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

64
65
66
67
68
69
70
71

CPPFLAGS := -I. -DUSE_TCL_STUBS=1 -DXVFS_DEBUG $(XVFS_ADD_CPPFLAGS)
CFLAGS   := -fPIC -g3 -ggdb3 -Wall $(XVFS_ADD_CFLAGS)
LDFLAGS  := $(XVFS_ADD_LDFLAGS)
LIBS     := -ltclstub8.6
TCLSH    := tclsh


all: example.so example-client.so xvfs.so

example.c: $(shell find example -type f) $(shell find lib -type f) xvfs.c.rvt xvfs-create Makefile
	./xvfs-create --directory example --name example > example.c.new
	mv example.c.new example.c

example.o: example.c xvfs-core.h xvfs-core.c Makefile
	$(CC) $(CPPFLAGS) -DXVFS_MODE_FLEXIBLE $(CFLAGS) -o example.o -c example.c

example.so: example.o Makefile
	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o example.so example.o $(LIBS)

example-client.o: example.c xvfs-core.h Makefile






	$(CC) $(CPPFLAGS) -DXVFS_MODE_FLEXIBLE $(CFLAGS) -o example-client.o -c example.c

example-client.so: example-client.o Makefile
	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o example-client.so example-client.o $(LIBS)

xvfs.o: xvfs-core.h xvfs-core.c Makefile
	$(CC) $(CPPFLAGS) -DXVFS_MODE_SERVER $(CFLAGS) -o xvfs.o -c xvfs-core.c

xvfs.so: xvfs.o Makefile
	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o xvfs.so xvfs.o $(LIBS)

# xvfs-create-standalone is a standalone (i.e., no external dependencies
# 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 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

test: example.so xvfs.so example-client.so Makefile
	rm -f __test__.tcl
	echo 'if {[catch { load ./example.so Xvfs_example; source //xvfs:/example/main.tcl }]} { puts stderr $$::errorInfo; exit 1 }; exit 0' > __test__.tcl





	$(GDB) $(TCLSH) __test__.tcl $(TCL_TEST_ARGS)
	rm -f __test__.tcl
	echo 'if {[catch { load ./xvfs.so; load ./example-client.so Xvfs_example; source //xvfs:/example/main.tcl }]} { puts stderr $$::errorInfo; exit 1 }; exit 0' > __test__.tcl
	$(GDB) $(TCLSH) __test__.tcl $(TCL_TEST_ARGS)

	rm -f __test__.tcl

coverage:
	$(MAKE) clean
	$(MAKE) example.so XVFS_ADD_CFLAGS=-coverage XVFS_ADD_LDFLAGS=-coverage
	$(MAKE) test XVFS_TEST_EXIT_ON_FAILURE=0
	rm -f xvfs-test-coverage.info
	lcov --capture --directory . --output-file xvfs-test-coverage.info
	rm -rf xvfs-test-coverage
	mkdir xvfs-test-coverage
	genhtml xvfs-test-coverage.info --output-directory xvfs-test-coverage
	rm -f xvfs-test-coverage.info

clean:
	rm -f xvfs-create-standalone.new xvfs-create-standalone
	rm -f example.c example.c.new
	rm -f example.so example.o
	rm -f example-client.o example-client.so

	rm -f xvfs.o xvfs.so
	rm -f example.gcda example.gcno
	rm -f __test__.tcl
	rm -f xvfs-test-coverage.info
	rm -rf xvfs-test-coverage

distclean: clean

>
|
|
|
|
|
>

|








|
|


>
>
>
>
>
>
|

|
|




|
|









|

|
>
>
>
>
>
|
<
<
|
>




|











|
|
>
|







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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
TCL_CONFIG_SH := /usr/lib64/tclConfig.sh
CPPFLAGS      := -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$(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) xvfs.c.rvt xvfs-create Makefile
	./xvfs-create --directory example --name example > example.c.new
	mv example.c.new example.c

example.o: example.c xvfs-core.h xvfs-core.c Makefile
	$(CC) $(CPPFLAGS) -DXVFS_MODE_FLEXIBLE $(CFLAGS) -o example.o -c example.c

example$(LIB_SUFFIX): example.o Makefile
	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o example$(LIB_SUFFIX) example.o $(LIBS)

example-client.o: example.c xvfs-core.h Makefile
	$(CC) $(CPPFLAGS) -DXVFS_MODE_CLIENT $(CFLAGS) -o example-client.o -c example.c

example-client$(LIB_SUFFIX): example-client.o Makefile
	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o example-client$(LIB_SUFFIX) example-client.o $(LIBS)

example-flexible.o: example.c xvfs-core.h Makefile
	$(CC) $(CPPFLAGS) -DXVFS_MODE_FLEXIBLE $(CFLAGS) -o example-flexible.o -c example.c

example-flexible$(LIB_SUFFIX): example-flexible.o Makefile
	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o example-flexible$(LIB_SUFFIX) example-flexible.o $(LIBS)

xvfs.o: xvfs-core.h xvfs-core.c Makefile
	$(CC) $(CPPFLAGS) -DXVFS_MODE_SERVER $(CFLAGS) -o xvfs.o -c xvfs-core.c

xvfs$(LIB_SUFFIX): xvfs.o Makefile
	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o xvfs$(LIB_SUFFIX) xvfs.o $(LIBS)

# xvfs-create-standalone is a standalone (i.e., no external dependencies
# 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 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

test: example$(LIB_SUFFIX) xvfs$(LIB_SUFFIX) example-client$(LIB_SUFFIX) example-flexible$(LIB_SUFFIX) Makefile
	rm -f __test__.tcl
	echo 'if {[catch { eval $$::env(XVFS_TEST_LOAD_COMMANDS); source //xvfs:/example/main.tcl }]} { puts stderr $$::errorInfo; exit 1 }; exit 0' > __test__.tcl
	@export XVFS_TEST_LOAD_COMMANDS; for XVFS_TEST_LOAD_COMMANDS in \
		'load ./example$(LIB_SUFFIX) Xvfs_example' \
		'load -global ./xvfs$(LIB_SUFFIX); load ./example-client$(LIB_SUFFIX) Xvfs_example' \
		'load ./xvfs$(LIB_SUFFIX); load ./example-flexible$(LIB_SUFFIX) Xvfs_example' \
		'load ./example-flexible$(LIB_SUFFIX) Xvfs_example'; do \
			echo "[$${XVFS_TEST_LOAD_COMMANDS}] $(GDB) $(TCLSH) __test__.tcl $(TCL_TEST_ARGS)"; \


			$(GDB) $(TCLSH) __test__.tcl $(TCL_TEST_ARGS) || exit 1; \
	done
	rm -f __test__.tcl

coverage:
	$(MAKE) clean
	$(MAKE) example$(LIB_SUFFIX) XVFS_ADD_CFLAGS=-coverage XVFS_ADD_LDFLAGS=-coverage
	$(MAKE) test XVFS_TEST_EXIT_ON_FAILURE=0
	rm -f xvfs-test-coverage.info
	lcov --capture --directory . --output-file xvfs-test-coverage.info
	rm -rf xvfs-test-coverage
	mkdir xvfs-test-coverage
	genhtml xvfs-test-coverage.info --output-directory xvfs-test-coverage
	rm -f xvfs-test-coverage.info

clean:
	rm -f xvfs-create-standalone.new xvfs-create-standalone
	rm -f example.c example.c.new
	rm -f example$(LIB_SUFFIX) example.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.gcda example.gcno
	rm -f __test__.tcl
	rm -f xvfs-test-coverage.info
	rm -rf xvfs-test-coverage

distclean: clean