diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2017-04-28 04:13:07 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2017-04-28 04:13:07 +0300 |
commit | 93b4a8271a58fa8ee1261d541ae1eeb45a954711 (patch) | |
tree | 7a11756190918aeba473246e135e454577fdbe41 /km | |
parent | README updates (diff) | |
download | windows7-drivers-93b4a8271a58fa8ee1261d541ae1eeb45a954711.tar.gz windows7-drivers-93b4a8271a58fa8ee1261d541ae1eeb45a954711.zip |
build/wdk7.1: refactoring
Diffstat (limited to 'km')
-rw-r--r-- | km/build/wdk7.1/build_driver.bat | 37 | ||||
-rw-r--r-- | km/build/wdk7.1/build_drivers.bat | 8 | ||||
-rw-r--r-- | km/build/wdk7.1/check_ddk.bat | 7 | ||||
-rw-r--r-- | km/build/wdk7.1/check_env.bat | 17 | ||||
-rw-r--r-- | km/build/wdk7.1/clean_driver.bat | 31 | ||||
-rw-r--r-- | km/build/wdk7.1/clean_drivers.bat | 8 | ||||
-rw-r--r-- | km/build/wdk7.1/setenv.bat | 12 |
7 files changed, 61 insertions, 59 deletions
diff --git a/km/build/wdk7.1/build_driver.bat b/km/build/wdk7.1/build_driver.bat index 1cf2a9a..80089b8 100644 --- a/km/build/wdk7.1/build_driver.bat +++ b/km/build/wdk7.1/build_driver.bat @@ -7,34 +7,33 @@ @echo off if "%~1" == "" ( - echo Usage: %~nx0 DRIVER_SRC_ROOT >&2 + echo Usage: %~nx0 DRIVER_SRC_DIR >&2 exit /b 1 ) call check_env.bat || exit /b !errorlevel! -call check_ddk.bat || exit /b !errorlevel! -set "driver_src_root=%~f1" +set "drv_src_dir=%~f1" -for /f %%i in ("%driver_src_root%") do ( - set "driver_name=%%~ni" - set "driver_dist_subdir=%%~dpi" +for /f %%i in ("%drv_src_dir%") do ( + set "drv_name=%%~ni" + set "drv_subdir=%%~dpi" ) -call :make_relative driver_dist_subdir "%src_root%" +call :make_relative drv_subdir "%proj_src_dir%" -set "sys_dist_dir=%bin_root%\%target_platform%\%target_configuration%\%driver_dist_subdir%" -set "pdb_dist_dir=%bin_root%\%target_platform%\%target_configuration%\%driver_dist_subdir%" -set "lib_dist_dir=%lib_root%\%target_platform%\%target_configuration%\%driver_dist_subdir%" +set "sys_dist_dir=%proj_bin_dir%\%target_platform%\%target_configuration%\%drv_subdir%" +set "pdb_dist_dir=%proj_bin_dir%\%target_platform%\%target_configuration%\%drv_subdir%" +set "lib_dist_dir=%proj_lib_dir%\%target_platform%\%target_configuration%\%drv_subdir%" echo =========================== DRIVER INFO =========================== -echo Driver source directory: %driver_src_root% -echo Driver name: %driver_name% +echo Driver source directory: %drv_src_dir% +echo Driver name: %drv_name% echo ========================= END DRIVER INFO ========================= echo. echo ============================== BUILD ============================== set "LIBDISTDIR=%lib_dist_dir%" -pushd "%driver_src_root%" && ( +pushd "%drv_src_dir%" && ( build.exe /cegwZ popd ) @@ -46,18 +45,18 @@ if errorlevel 0 ( ) if "%_BUILDARCH%" == "x86" ( - set buildarch_directory=i386 + set buildarch_dir=i386 ) else ( - set "buildarch_directory=%_BUILDARCH%" + set "buildarch_dir=%_BUILDARCH%" ) -set "sys_path=%driver_src_root%\obj%BUILD_ALT_DIR%\%buildarch_directory%\%driver_name%.sys" -set "pdb_path=%driver_src_root%\obj%BUILD_ALT_DIR%\%buildarch_directory%\%driver_name%.pdb" -set "lib_path=%driver_src_root%\obj%BUILD_ALT_DIR%\%buildarch_directory%\%driver_name%.lib" +set "sys_path=%drv_src_dir%\obj%BUILD_ALT_DIR%\%buildarch_dir%\%drv_name%.sys" +set "pdb_path=%drv_src_dir%\obj%BUILD_ALT_DIR%\%buildarch_dir%\%drv_name%.pdb" +set "lib_path=%drv_src_dir%\obj%BUILD_ALT_DIR%\%buildarch_dir%\%drv_name%.lib" if exist "%sys_path%" ( echo. - call "%build_root%\sign.bat" "%sys_path%" || exit /b !errorlevel! + call "%proj_build_dir%\sign.bat" "%sys_path%" || exit /b !errorlevel! ) echo. diff --git a/km/build/wdk7.1/build_drivers.bat b/km/build/wdk7.1/build_drivers.bat index 35b2867..a08a150 100644 --- a/km/build/wdk7.1/build_drivers.bat +++ b/km/build/wdk7.1/build_drivers.bat @@ -6,8 +6,10 @@ @setlocal enabledelayedexpansion @echo off -for /f "delims=" %%i in ('dir "%src_root%\sources" /b /s') do ( - set "driver_src_root=%%~dpi" +call check_env.bat || exit /b !errorlevel! + +for /f "delims=" %%i in ('dir "%proj_src_dir%\sources" /b /s') do ( + set "drv_src_dir=%%~dpi" echo. - call build_driver.bat "!driver_src_root:~0,-1!" || exit /b !errorlevel! + call build_driver.bat "!drv_src_dir:~0,-1!" || exit /b !errorlevel! ) diff --git a/km/build/wdk7.1/check_ddk.bat b/km/build/wdk7.1/check_ddk.bat index aaabd76..f71e3c4 100644 --- a/km/build/wdk7.1/check_ddk.bat +++ b/km/build/wdk7.1/check_ddk.bat @@ -6,16 +6,9 @@ @setlocal enabledelayedexpansion @echo off -call check_env.bat || exit /b !errorlevel! - if not defined BUILD_ALT_DIR goto :ddk_not_set if not defined _BUILDARCH goto :ddk_not_set -if not exist "%build_root%\sign.bat" ( - echo Error: %build_root%\sign.bat was not found ^(don^'t know how to sign drivers otherwise^) >&2 - exit /b 1 -) - where build.exe >nul 2>&1 || goto :build_not_found where signtool.exe >nul 2>&1 || goto :signtool_not_found where makecert.exe >nul 2>&1 || goto :makecert_not_found diff --git a/km/build/wdk7.1/check_env.bat b/km/build/wdk7.1/check_env.bat index f3cb382..5a73d5f 100644 --- a/km/build/wdk7.1/check_env.bat +++ b/km/build/wdk7.1/check_env.bat @@ -6,13 +6,20 @@ @setlocal enabledelayedexpansion @echo off -if not defined root goto :env_not_set -if not defined bin_root goto :env_not_set -if not defined lib_root goto :env_not_set -if not defined src_root goto :env_not_set +call check_ddk.bat || exit /b !errorlevel! + +if not defined proj_build_dir goto :env_not_set +if not defined proj_bin_dir goto :env_not_set +if not defined proj_lib_dir goto :env_not_set +if not defined proj_src_dir goto :env_not_set + +if not exist "%proj_build_dir%\sign.bat" ( + echo Error: %proj_build_dir%\sign.bat was not found ^(don^'t know how to sign drivers otherwise^) >&2 + exit /b 1 +) exit /b 0 :env_not_set -echo Error: either %%root%%, %%bin_root%%, %%lib_root%% or %%src_root%% are not set ^(have you set up the build environment using setenv.bat?^) >&2 +echo Error: either %%proj_build_dir%%, %%proj_bin_dir%%, %%proj_lib_dir%% or %%proj_src_dir%% are not set ^(have set up the build environment using setenv.bat?^) >&2 exit /b 1 diff --git a/km/build/wdk7.1/clean_driver.bat b/km/build/wdk7.1/clean_driver.bat index 2a98624..36723da 100644 --- a/km/build/wdk7.1/clean_driver.bat +++ b/km/build/wdk7.1/clean_driver.bat @@ -7,30 +7,29 @@ @echo off if "%~1" == "" ( - echo Usage: %~nx0 DRIVER_SRC_ROOT >&2 + echo Usage: %~nx0 DRIVER_SRC_DIR >&2 exit /b 1 ) -call check_ddk.bat || exit /b !errorlevel! call check_env.bat || exit /b !errorlevel! -set "driver_src_root=%~f1" -cd "%driver_src_root%" || exit /b !errorlevel! +set "drv_src_dir=%~f1" +cd "%drv_src_dir%" || exit /b !errorlevel! -for /f %%i in ("%driver_src_root%") do ( - set "driver_name=%%~ni" - set "driver_dist_root=%%~dpi" +for /f %%i in ("%drv_src_dir%") do ( + set "drv_name=%%~ni" + set "drv_subdir=%%~dpi" ) -call :make_relative driver_dist_root "%src_root%" +call :make_relative drv_subdir "%proj_src_dir%" -set "sys_dist_dir=%bin_root%\%target_platform%\%target_configuration%\%driver_dist_root%" -set "pdb_dist_dir=%bin_root%\%target_platform%\%target_configuration%\%driver_dist_root%" -set "lib_dist_dir=%lib_root%\%target_platform%\%target_configuration%\%driver_dist_root%" +set "sys_dist_dir=%proj_bin_dir%\%target_platform%\%target_configuration%\%drv_subdir%" +set "pdb_dist_dir=%proj_bin_dir%\%target_platform%\%target_configuration%\%drv_subdir%" +set "lib_dist_dir=%proj_lib_dir%\%target_platform%\%target_configuration%\%drv_subdir%" echo =========================== DRIVER INFO =========================== -echo Driver source directory: %driver_src_root% -echo Driver name: %driver_name% +echo Driver source directory: %drv_src_dir% +echo Driver name: %drv_name% echo ========================= END DRIVER INFO ========================= echo. echo ============================== CLEAN ============================== @@ -38,9 +37,9 @@ call :clean_rmdir "obj%BUILD_ALT_DIR%" || goto :clean_failure call :clean_del "build%BUILD_ALT_DIR%.err" || goto :clean_failure call :clean_del "build%BUILD_ALT_DIR%.log" || goto :clean_failure call :clean_del "build%BUILD_ALT_DIR%.wrn" || goto :clean_failure -call :clean_del "%sys_dist_dir%%driver_name%.sys" || goto :clean_failure -call :clean_del "%pdb_dist_dir%%driver_name%.pdb" || goto :clean_failure -call :clean_del "%lib_dist_dir%%driver_name%.lib" || goto :clean_failure +call :clean_del "%sys_dist_dir%%drv_name%.sys" || goto :clean_failure +call :clean_del "%pdb_dist_dir%%drv_name%.pdb" || goto :clean_failure +call :clean_del "%lib_dist_dir%%drv_name%.lib" || goto :clean_failure echo ========================== CLEAN SUCCESS ========================== exit /b 0 diff --git a/km/build/wdk7.1/clean_drivers.bat b/km/build/wdk7.1/clean_drivers.bat index 8442c90..100c0da 100644 --- a/km/build/wdk7.1/clean_drivers.bat +++ b/km/build/wdk7.1/clean_drivers.bat @@ -6,8 +6,10 @@ @setlocal enabledelayedexpansion @echo off -for /f "delims=" %%i in ('dir "%src_root%\sources" /b /s') do ( - set "driver_src_root=%%~dpi" +call check_env.bat || exit /b !errorlevel! + +for /f "delims=" %%i in ('dir "%proj_src_dir%\sources" /b /s') do ( + set "drv_src_dir=%%~dpi" echo. - call clean_driver.bat "!driver_src_root:~0,-1!" || exit /b !errorlevel! + call clean_driver.bat "!drv_src_dir:~0,-1!" || exit /b !errorlevel! ) diff --git a/km/build/wdk7.1/setenv.bat b/km/build/wdk7.1/setenv.bat index c77bb92..4d490b3 100644 --- a/km/build/wdk7.1/setenv.bat +++ b/km/build/wdk7.1/setenv.bat @@ -5,14 +5,14 @@ @echo off -set "build_root=%~dp0%" +set "proj_build_dir=%~dp0%" -set "root=%build_root%\..\..\.." -for /f "delims=" %%i in ("%root%") do set "root=%%~fi" +set "proj_dir=%proj_build_dir%\..\..\.." +for /f "delims=" %%i in ("%proj_dir%") do set "proj_dir=%%~fi" -set "src_root=%root%\km\src" -set "bin_root=%root%\km\build\wdk7.1\bin" -set "lib_root=%root%\km\build\wdk7.1\lib" +set "proj_src_dir=%proj_dir%\km\src" +set "proj_bin_dir=%proj_build_dir%\bin" +set "proj_lib_dir=%proj_build_dir%\lib" set target_configuration=Release |