1@echo off
2REM // Copyright (c) 2020, Intel Corporation
3REM //
4REM // Redistribution and use in source and binary forms, with or without
5REM // modification, are permitted provided that the following conditions are met:
6REM //
7REM //     * Redistributions of source code must retain the above copyright notice,
8REM //       this list of conditions and the following disclaimer.
9REM //     * Redistributions in binary form must reproduce the above copyright
10REM //       notice, this list of conditions and the following disclaimer in the
11REM //       documentation and/or other materials provided with the distribution.
12REM //     * Neither the name of Intel Corporation nor the names of its contributors
13REM //       may be used to endorse or promote products derived from this software
14REM //       without specific prior written permission.
15REM //
16REM // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17REM // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18REM // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19REM // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
20REM // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21REM // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22REM // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23REM // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24REM // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25REM // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
27REM //
28REM // Script to produce C/C++ dependencies based using CL compiler
29REM //
30REM // Using: deps.bat arg1 arg2 arg3
31REM //
32REM // arg1 - C/C++ file name to produce dependecies for
33REM // arg2 - object file corresponding to the C/C++ file name
34REM // arg3 - include switches for the compiler
35REM //
36REM // Notes:
37REM //   - 'cl' command is hardcoded below
38REM //
39
40@echo %1 : \
41@for /f "tokens=1,2,3,*" %%g in ('cl /Zs /showIncludes /nologo %~3 /c %1') do @if not "%%j"=="" echo   "%%j" \
42@echo.
43@echo %2 : %1
44