forked from arm-developer-tools/windowsperf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
179 lines (159 loc) · 6.04 KB
/
Makefile
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# BSD 3-Clause License
#
# Copyright (c) 2024, Arm Limited
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Makefile (GNU Make 3.81)
#
.PHONY: all clean docs test wperf wperf-driver wperf-test wperf-lib package regenerate
#
# *** INTRODUCTION ***
#
# Now when we have unit testing project `wperf-test` we depend on x64
# wperf build to link tests with unit test project. This change makes sure
# we build `wperf-test` for arch=x64. This will build `wperf` and
# `wperf-test` (later depends on `wperf`).
#
# So `make all` will:
#
# 1) Build `wperf` arch=x64
# 2) Build `wperf-test` arch=x64
# 3) Rebuild solution for `config` and `arch` (default ARM64)
#
# Please note we are building:
#
# * cross x64 -> ARM64 for WindowsPerf suite and
# * x64 -> x64 `wperf` and its unit tests.
#
# *** HOW TO SWITCH BETWEEN Debug/Release AND ARM64/x64 ***
#
# Use 'config' to switch between `Debug` and `Release`.
# Use 'arch' to switch between `ARM64` and `x64`.
#
# Note: `wperf-test` project require `wperf` project to be built first.
# Currently WindowsPerf solution defines this build dependency and you can
# just straight build `make ... wperf-test` and dependencies will build.
#
# Examples:
#
# make config=Release all
# make config=Debug all
#
# make config=Release arch=x64 wperf-test
# make config=Debug arch=x64 wperf-test
#
# *** BUILDING UNIT TESTS ***
#
# Note: You can currently build unit tests only on x64 host!
#
# make test (Default Debug/x64)
# make config=Release test (Release/x64)
#
# or more verbose version of above:
#
# make wperf-test wperf-test-run (Default Debug/x64)
# make config=Release wperf-test wperf-test-run (Release/x64)
#
# *** RELEASE BINARY PACKAGING ***
#
# Use `make config=Release release` to package `wperf` and `wperf-driver`.
#
# By default we build for ARM64 target. Define arch variable to change default
# value.
make_arch=ARM64
# By default we build with Debug configuration. Define config variable to change default
# value.
make_config=Debug
ifdef arch
make_arch=$(arch)
endif
ifdef config
make_config=$(config)
endif
#
# Building rules
#
all: wperf-test
devenv windowsperf.sln /Rebuild "$(make_config)|$(make_arch)" 2>&1
wperf:
devenv windowsperf.sln /Rebuild "$(make_config)|${make_arch}" /Project wperf\wperf.vcxproj 2>&1
wperf-driver:
devenv windowsperf.sln /Rebuild "$(make_config)|$(make_arch)" /Project wperf-driver\wperf-driver.vcxproj 2>&1
wperf-test:
devenv windowsperf.sln /Rebuild "$(make_config)|x64" /Project wperf-test\wperf-test.vcxproj 2>&1
wperf-test-run:
vstest.console wperf-test\x64\$(make_config)\wperf-test.dll
wperf-lib:
devenv windowsperf.sln /Rebuild "$(make_config)|${make_arch}" /Project wperf-lib\wperf-lib.vcxproj 2>&1
test: wperf-test wperf-test-run
#
# Regenerate .def files
#
regenerate:
# Regenerate Telemetry-Solution .def file (Add LICENSE and add meta-data)
sed -e 's#^#\/\/ #' LICENSE > wperf-common/telemetry-solution-data.def
sed -i 's#[[:space:]]*$$##' wperf-common/telemetry-solution-data.def
python wperf-scripts/telemetry_events_update.py >> wperf-common/telemetry-solution-data.def
#
# Simple mechanism to "flat" package build artifacts in one directory
#
package:
rm -rf release
mkdir release
#
# wperf and wperf-devgen. files
#
cp -p "./wperf/$(make_arch)/$(make_config)/wperf.exe" release/
cp -p "./wperf-devgen/$(make_arch)/$(make_config)/wperf-devgen.exe" release/
#
# wperf-lib files
#
cp -p "./wperf-lib/$(make_arch)/$(make_config)/wperf-lib.dll" release/
cp -p "./wperf-lib-app/$(make_arch)/$(make_config)/wperf-lib-app.exe" release/
cp -p "./wperf-lib-app/wperf-lib-c-compat/$(make_arch)/$(make_config)/wperf-lib-c-compat.exe" release/
cp -p "./wperf-lib-app/wperf-lib-timeline/$(make_arch)/$(make_config)/wperf-lib-timeline.exe" release/
#
# Driver files
#
cp -p "./wperf-driver/$(make_arch)/$(make_config)/wperf-driver/wperf-driver.sys" release/
cp -p "./wperf-driver/$(make_arch)/$(make_config)/wperf-driver/wperf-driver.cat" release/
cp -p "./wperf-driver/$(make_arch)/$(make_config)/wperf-driver/wperf-driver.inf" release/
cp -p "./wperf-driver/$(make_arch)/$(make_config)/wperf-driver.pdb" release/
clean:
devenv windowsperf.sln /Clean "$(make_config)|$(make_arch)" 2>&1
purge:
rm -rf wperf/ARM64 wperf/ARM64EC wperf/x64
rm -rf wperf-driver/ARM64 wperf-driver/ARM64EC wperf-driver/x64
rm -rf wperf-test/ARM64 wperf-test/ARM64EC wperf-test/x64
rm -rf wperf-lib/ARM64 wperf-lib/ARM64EC wperf-lib/x64
rm -rf wperf-devgen/ARM64 wperf-devgen/x64
rm -rf ARM64/ ARM64EC/ x64/
docs:
doxygen
docs-clean:
rm -rf docs/ html/ latex/