File: Test.mk

package info (click to toggle)
zmk 0.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,132 kB
  • sloc: makefile: 1,749; sh: 313; ansic: 42; awk: 12; cpp: 12
file content (107 lines) | stat: -rw-r--r-- 4,995 bytes parent folder | download
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/make -f
# This file is a part of zmk test system.
include zmk/internalTest.mk

t:: all install uninstall clean \
    all-silent-rules install-silent-rules uninstall-silent-rules clean-silent-rules \
    all-destdir install-destdir uninstall-destdir clean-destdir \
    all-enable-static-libs all-disable-static-libs

$(eval $(ZMK.isolateHostToolchain))
# Test logs will contain debugging messages
%.log: ZMK.makeOverrides += DEBUG=library.a
# Some logs have silent rules enabled
%-silent-rules.log: ZMK.makeOverrides += Silent.Active=yes
# Some logs have DESTDIR set to /destdir
%-destdir.log: ZMK.makeOverrides += DESTDIR=/destdir
# Some logs behave as if configure --enable-static was used
%-enable-static-libs.log: ZMK.makeOverrides += Configure.StaticLibraries=yes
# Some logs behave as if configure --disable-static was used
%-disable-static-libs.log: ZMK.makeOverrides += Configure.StaticLibraries=
# Test depends on source files
%.log: foo.c

all: all.log
	# Default target compiles source to object files belonging to the library.
	GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libfoo.a-foo.d) -c -o libfoo.a-foo.o $(ZMK.test.OutOfTreeSourcePath)foo.c' <$<
	# Default target combines object files into an archive
	GREP -qFx 'ar -cr libfoo.a libfoo.a-foo.o' <$<
install: install.log
	# Installing creates the prerequisite directories
	GREP -qFx 'install -d /usr' <$<
	GREP -qFx 'install -d /usr/local' <$<
	# Installing creates the library directory
	GREP -qFx 'install -d /usr/local/lib' <$<
	# Installing copies the library
	GREP -qFx 'install -m 0644 libfoo.a /usr/local/lib/libfoo.a' <$<
uninstall: uninstall.log
	# Uninstalling removes the library
	GREP -qFx 'rm -f /usr/local/lib/libfoo.a' <$<
clean: clean.log
	# Cleaning removes the library
	GREP -qFx 'rm -f libfoo.a' <$<
	# Cleaning removes the object files belonging to the library
	GREP -qFx 'rm -f ./libfoo.a-foo.o' <$<
	# Cleaning removes the dependency files
	GREP -qFx 'rm -f ./libfoo.a-foo.d' <$<

all-silent-rules: all-silent-rules.log
	# Default target compiles source to object files belonging to the library.
	GREP -qFx 'printf "  %-16s %s\n" "CC" "libfoo.a-foo.o"' <$<
	GREP -qFx '#cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libfoo.a-foo.d) -c -o libfoo.a-foo.o $(ZMK.test.OutOfTreeSourcePath)foo.c' <$<
	# Default target combines object files into an archive
	GREP -qFx 'printf "  %-16s %s\n" "AR" "libfoo.a"' <$<
	GREP -qFx '#ar -cr libfoo.a libfoo.a-foo.o' <$<
install-silent-rules: install-silent-rules.log
	# Installing creates the prerequisite directories
	GREP -qFx 'printf "  %-16s %s\n" "MKDIR" "/usr"' <$<
	GREP -qFx '#install -d /usr' <$<
	GREP -qFx 'printf "  %-16s %s\n" "MKDIR" "/usr/local"' <$<
	GREP -qFx '#install -d /usr/local' <$<
	# Installing creates the library directory
	GREP -qFx 'printf "  %-16s %s\n" "MKDIR" "/usr/local/lib"' <$<
	GREP -qFx '#install -d /usr/local/lib' <$<
	# Installing copies the library
	GREP -qFx 'printf "  %-16s %s\n" "INSTALL" "/usr/local/lib/libfoo.a"' <$<
	GREP -qFx '#install -m 0644 libfoo.a /usr/local/lib/libfoo.a' <$<
uninstall-silent-rules: uninstall-silent-rules.log
	GREP -qFx '#rm -f /usr/local/lib/libfoo.a' <$<
clean-silent-rules: clean-silent-rules.log
	# Cleaning removes the library
	GREP -qFx '#rm -f libfoo.a' <$<
	# Cleaning removes the object files belonging to the library
	GREP -qFx '#rm -f ./libfoo.a-foo.o' <$<
	# Cleaning removes the dependency files
	GREP -qFx '#rm -f ./libfoo.a-foo.d' <$<

all-destdir: all-destdir.log
	# Default target compiles source to object files belonging to the library.
	GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libfoo.a-foo.d) -c -o libfoo.a-foo.o $(ZMK.test.OutOfTreeSourcePath)foo.c' <$<
	# Default target combines object files into an archive
	GREP -qFx 'ar -cr libfoo.a libfoo.a-foo.o' <$<
install-destdir: install-destdir.log
	# Installing creates the prerequisite directories
	GREP -qFx 'mkdir -p /destdir' <$<
	GREP -qFx 'install -d /destdir/usr' <$<
	GREP -qFx 'install -d /destdir/usr/local' <$<
	# Installing creates the library directory
	GREP -qFx 'install -d /destdir/usr/local/lib' <$<
	# Installing copies the library
	GREP -qFx 'install -m 0644 libfoo.a /destdir/usr/local/lib/libfoo.a' <$<
uninstall-destdir: uninstall-destdir.log
	# Uninstalling removes the library
	GREP -qFx 'rm -f /destdir/usr/local/lib/libfoo.a' <$<
clean-destdir: clean-destdir.log
	# Cleaning removes the library
	GREP -qFx 'rm -f libfoo.a' <$<
	# Cleaning removes the object files belonging to the library
	GREP -qFx 'rm -f ./libfoo.a-foo.o' <$<
	# Cleaning removes the dependency files
	GREP -qFx 'rm -f ./libfoo.a-foo.d' <$<

all-enable-static-libs: all-enable-static-libs.log
	# Configuring --enable-static enables compilation of static libraries.
	GREP -qFx 'ar -cr libfoo.a libfoo.a-foo.o' <$<
all-disable-static-libs: all-disable-static-libs.log
	# Configuring --disable-static disables compilation of static libraries.
	GREP -v -qFx 'ar -cr libfoo.a libfoo.a-foo.o' <$<