-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintersect.bat
39 lines (34 loc) · 1.75 KB
/
intersect.bat
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
@echo off
:#*****************************************************************************
:# *
:# Filename intersect.bat *
:# *
:# Description Intersect two lists in a make file *
:# *
:# Notes The output is read back by a make file, and so must be *
:# a valid make file itself. For example use # for comments. *
:# *
:# Usage: *
:# *
:# TEMPMAK=$(TMP)\intersect.$(PID).mak *
:# !IF [$(NMINCLUDE)\intersect.bat LIST1 LIST2 OUTVARNAME TEMPMAK] == 0 *
:# !INCLUDE TEMPMAK *
:# !ENDIF *
:# *
:# History *
:# 2024-01-02 JFL [email protected] created this batch. *
:# *
:# (C) Copyright 2024 Jean-Francois Larvoire *
:# Licensed under the Apache 2.0 license: www.apache.org/licenses/LICENSE-2.0 *
:#*****************************************************************************
setlocal EnableExtensions EnableDelayedExpansion
set "LIST=" &:# Output list
for %%a in (%~1) do for %%b in (%~2) do if "%%a"=="%%b" (
if defined LIST set "LIST=!LIST! "
set "LIST=!LIST!%%a"
)
set "EXCL=^!" &:# One exclamation mark
echo !EXCL!UNDEF %~3
if defined LIST echo %~3=!LIST!
echo INTERSECT_MSG=%~3=!LIST! ^^^^# intersect.mak %1 %2
exit /b 0