2012-11-13 22:10:50 +01:00
|
|
|
@echo off
|
|
|
|
|
2022-11-08 14:53:58 +01:00
|
|
|
rem tools/incdir.bat
|
2012-11-13 22:10:50 +01:00
|
|
|
rem
|
2021-02-18 13:48:10 +01:00
|
|
|
rem Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
rem contributor license agreements. See the NOTICE file distributed with
|
|
|
|
rem this work for additional information regarding copyright ownership. The
|
|
|
|
rem ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
rem "License"); you may not use this file except in compliance with the
|
|
|
|
rem License. You may obtain a copy of the License at
|
2012-11-13 22:10:50 +01:00
|
|
|
rem
|
2021-02-18 13:48:10 +01:00
|
|
|
rem http://www.apache.org/licenses/LICENSE-2.0
|
2012-11-13 22:10:50 +01:00
|
|
|
rem
|
2021-02-18 13:48:10 +01:00
|
|
|
rem Unless required by applicable law or agreed to in writing, software
|
|
|
|
rem distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
rem WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
rem License for the specific language governing permissions and limitations
|
|
|
|
rem under the License.
|
2012-11-13 22:10:50 +01:00
|
|
|
rem
|
|
|
|
|
|
|
|
rem Handle command line options
|
|
|
|
|
|
|
|
set progname=%0
|
2012-11-23 15:13:57 +01:00
|
|
|
set pathtype=user
|
2012-11-13 22:10:50 +01:00
|
|
|
|
|
|
|
:ArgLoop
|
|
|
|
|
2012-11-23 15:13:57 +01:00
|
|
|
rem [-d] [-w] [-s] [-h]. [-w] and [-d] Ignored for compatibility with incdir.sh
|
2012-11-13 22:10:50 +01:00
|
|
|
|
|
|
|
if "%1"=="-d" goto :NextArg
|
|
|
|
if "%1"=="-w" goto :NextArg
|
|
|
|
if "%1"=="-h" goto :Usage
|
2012-11-23 15:13:57 +01:00
|
|
|
|
|
|
|
if "%1"=="-s" (
|
|
|
|
set pathtype=system
|
|
|
|
goto :NextArg
|
|
|
|
)
|
|
|
|
|
2012-11-13 22:10:50 +01:00
|
|
|
goto :CheckCompiler
|
|
|
|
|
|
|
|
:NextArg
|
|
|
|
shift
|
|
|
|
goto :ArgLoop
|
|
|
|
|
|
|
|
:CheckCompiler
|
|
|
|
if "%1"=="" (
|
|
|
|
echo ERROR: Missing compiler name
|
|
|
|
goto :Usage
|
|
|
|
)
|
2012-11-22 22:21:48 +01:00
|
|
|
|
|
|
|
set ccpath=%1
|
2012-11-13 22:10:50 +01:00
|
|
|
shift
|
|
|
|
|
2012-11-22 22:21:48 +01:00
|
|
|
set compiler=
|
|
|
|
for /F %%i in ("%ccpath%") do set compiler=%%~ni
|
2012-11-13 22:10:50 +01:00
|
|
|
|
|
|
|
if "%1"=="" (
|
|
|
|
echo ERROR: Missing directory paths
|
|
|
|
goto :Usage
|
|
|
|
)
|
|
|
|
|
2012-11-22 22:21:48 +01:00
|
|
|
rem Check for some well known, non-GCC Windows native tools that require
|
|
|
|
rem a special output format as well as special paths
|
|
|
|
|
|
|
|
:GetFormat
|
|
|
|
set fmt=std
|
|
|
|
if "%compiler%"=="ez8cc" goto :SetZdsFormt
|
|
|
|
if "%compiler%"=="zneocc" goto :SetZdsFormt
|
|
|
|
if "%compiler%"=="ez80cc" goto :SetZdsFormt
|
|
|
|
goto :GeneratePaths
|
|
|
|
|
|
|
|
:SetZdsFormt
|
|
|
|
set fmt=zds
|
|
|
|
|
|
|
|
rem Generate the compiler include path directives.
|
|
|
|
|
|
|
|
:GeneratePaths
|
2012-11-13 22:10:50 +01:00
|
|
|
set response=
|
|
|
|
|
|
|
|
:DirLoop
|
|
|
|
if "%1" == "" (
|
|
|
|
echo %response%
|
|
|
|
goto :End
|
|
|
|
)
|
|
|
|
|
2012-11-22 22:21:48 +01:00
|
|
|
if "%fmt%"=="zds" goto :GenerateZdsPath
|
2012-11-23 15:13:57 +01:00
|
|
|
if "%response%"=="" goto :FirstStdPath
|
|
|
|
if "%pathtype%"=="system" goto :NextStdSystemPath
|
2012-11-22 22:21:48 +01:00
|
|
|
|
2012-11-23 15:13:57 +01:00
|
|
|
set response=%response% -I "%1"
|
|
|
|
goto :EndOfDirLoop
|
|
|
|
|
|
|
|
:NextStdSystemPath
|
|
|
|
|
|
|
|
set response=%response% -isystem "%1"
|
|
|
|
goto :EndOfDirLoop
|
|
|
|
|
|
|
|
:FirstStdPath
|
|
|
|
|
|
|
|
if "%pathtype%"=="system" goto :FirstStdSystemPath
|
|
|
|
set response=-I "%1"
|
|
|
|
goto :EndOfDirLoop
|
|
|
|
|
|
|
|
:FirstStdSystemPath
|
|
|
|
|
|
|
|
set response=-isystem "%1"
|
2012-11-22 22:21:48 +01:00
|
|
|
goto :EndOfDirLoop
|
|
|
|
|
|
|
|
:GenerateZdsPath
|
|
|
|
|
2012-11-23 15:13:57 +01:00
|
|
|
if "%response%"=="" goto :FirstZdsPath
|
|
|
|
set response=%response%;%1
|
|
|
|
goto :EndOfDirLoop
|
|
|
|
|
|
|
|
:FirstZdsPath
|
|
|
|
|
|
|
|
if "%pathtype%"=="system" goto :FirstZdsSystemPath
|
|
|
|
set response=-usrinc:%1
|
|
|
|
goto :EndOfDirLoop
|
|
|
|
|
|
|
|
:FirstZdsSystemPath
|
|
|
|
|
|
|
|
set response=-stdinc:%1
|
2012-11-22 22:21:48 +01:00
|
|
|
|
|
|
|
:EndOfDirLoop
|
2012-11-13 22:10:50 +01:00
|
|
|
shift
|
|
|
|
goto :DirLoop
|
|
|
|
|
|
|
|
:Usage
|
|
|
|
echo %progname% is a tool for flexible generation of include path arguments for a
|
|
|
|
echo variety of different compilers in a variety of compilation environments
|
2012-11-23 15:13:57 +01:00
|
|
|
echo USAGE: %progname% [-w] [-d] [-s] [-h] ^<compiler-path^> ^<dir1^> [^<dir2^> [^<dir3^> ...]]
|
2012-11-13 22:10:50 +01:00
|
|
|
echo Where:
|
2020-01-05 17:29:59 +01:00
|
|
|
echo ^<compiler-path^>
|
|
|
|
echo The full path to your compiler
|
|
|
|
echo ^<dir1^> [^<dir2^> [^<dir3^> ...]]
|
|
|
|
echo A list of include directories
|
|
|
|
echo -w, -d
|
|
|
|
echo For compatibility with incdir.sh (ignored)
|
|
|
|
echo -s
|
|
|
|
echo Generate standard, system header file paths instead of normal user
|
|
|
|
echo header file paths.
|
|
|
|
echo -h
|
|
|
|
echo Shows this help text and exits.
|
2012-11-13 22:10:50 +01:00
|
|
|
:End
|