-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile.bat
171 lines (136 loc) · 3.78 KB
/
Makefile.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
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
@echo off
::begin
setlocal
pushd "%~dp0"
::checkenvironment
echo ==== ==== ==== ==== Checking building environment...
perl -h >nul 2>nul
if not %errorlevel%==0 (
echo !!!!!!!! Need ActivePerl, Please install it !!!!!!!!
goto end
)
dmake -h >nul 2>nul
if not %errorlevel%==255 (
echo !!!!!!!! Need ActivePerl with dmake, Please install it !!!!!!!!
echo "set ACTIVEPERL_PPM_HOME=.\Perl\tmp"
echo "ppm install dmake"
goto end
)
::baseconfig
set VCPATH=D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build
set MyPath=%CD%
for /d %%P in (.) do set ProjectName=%%~nP
if "%ProjectName%"=="" (
echo !!!!!!!! Empty project name !!!!!!!!
goto end
)
echo ==== ==== ==== ==== Got project name [ %ProjectName% ]
setlocal enabledelayedexpansion
for %%I in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do set ProjectName=!ProjectName:%%I=%%I!
setlocal disabledelayedexpansion
for /d %%P in ("%MyPath%\\%ProjectName%*") do set VPATH=%%~fP
if "%VPATH%"=="" (
echo !!!!!!!! Src no found !!!!!!!!
goto end
)
echo ==== ==== ==== ==== Got source folder [ %VPATH% ]
echo.
::main
echo.
cl >nul 2>&1
if %errorlevel%==0 (
echo ==== ==== ==== ==== Build %Platform% ==== ==== ==== ====
echo.
call :do || goto end
) else (
echo ==== ==== ==== ==== Build x64 ^& x86 ==== ==== ==== ====
echo.
call :do x64 || goto end
call :do x86 || goto end
)
popd
endlocal
echo.
echo ==== ==== ==== ==== Done ==== ==== ==== ====
cl >nul 2>&1 || pause >nul
exit /B 0
:end
popd
endlocal
echo.
echo ==== ==== ==== ==== Done ==== ==== ==== ====
cl >nul 2>&1 || pause >nul
exit /B 1
:do
setlocal
if "%1"=="" (
set PLAT=%Platform%
set SUF=
) else (
set PLAT=%1
set SUF=^>nul
)
if "%PLAT%"=="" (
echo !!!!!!!! Need arg with x64/x86 !!!!!!!!
goto done
)
set GPATH=%MyPath%\\%PLAT%
echo.
::prepare
if not "%1"=="" (
echo ==== ==== ==== ==== Prepare environment^(%PLAT%^)...
cd /d "%VCPath%"
if "%PLAT%"=="x64" (
call vcvarsall.bat x64 >nul
) else (
call vcvarsall.bat x86 >nul
)
)
echo ==== ==== ==== ==== Prepare dest folder(%PLAT%)...
if exist "%GPATH%" rd /s /q "%GPATH%" >nul
if exist "%GPATH%" (
echo !!!!!!!! Can't clear dest folder !!!!!!!!
goto done
)
md "%GPATH%" >nul
echo.
cd /d "%VPATH%"
::configure
echo ==== ==== ==== ==== Configure(%PLAT%)...
if "%PLAT%"=="x64" (
perl Configure VC-WIN64A shared no-asm no-shared
) else (
perl Configure VC-WIN32 shared no-asm no-shared
)
::buildlibs
echo ==== ==== ==== ==== Building(%PLAT%)...
nmake build_libs
::copylibs
echo ==== ==== ==== ==== Copy libs(%PLAT%)...
copy libcrypto.lib "%GPATH%" >nul
copy libssl.lib "%GPATH%" >nul
copy ossl_static.pdb "%GPATH%" >nul
::makeinclude
if "%1"=="x86" goto clean
echo ==== ==== ==== ==== Prepare include folder ^& files...
set IncludePath=%MyPath%\\include
if exist "%IncludePath%" rd /s /q "%IncludePath%" >nul
if exist "%IncludePath%" (
echo !!!!!!!! Can't clear include folder !!!!!!!!
goto done
)
set IncludePath=%MyPath%\\include\\%ProjectName%
set SIncludePath=%VPATH%\\include\\%ProjectName%
md "%IncludePath%" >nul
copy "%SIncludePath%\\*.h" "%IncludePath%" >nul
:clean
echo ==== ==== ==== ==== Clean(%PLAT%)...
nmake clean
::ok
endlocal
echo.
exit /B 0
:done
endlocal
echo.
exit /B 1