-
Notifications
You must be signed in to change notification settings - Fork 200
/
build.bat
74 lines (43 loc) · 1.68 KB
/
build.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
@echo off
set "HOME=%HOMEDRIVE%%HOMEPATH%"
echo Installation Path: [%HOME%/libmelon]
echo Generating files and directories ...
setlocal enabledelayedexpansion
set "old=MLN_ROOT"
set "new=!%HOME%!\libmelon"
set "new=%new:\=\\%"
set "file=src/mln_path.c"
powershell -Command "(Get-Content '%file%') -replace '%old%', '\"%new%\"' | Set-Content '%file%'"
set "old=MLN_NULL"
set "new=!%HOME%!\libmelon\null"
set "new=%new:\=\\%"
set "file=src/mln_path.c"
powershell -Command "(Get-Content '%file%') -replace '%old%', '\"%new%\"' | Set-Content '%file%'"
set "old=MLN_LANG_LIB"
set "new=!%HOME%!\libmelon\lang\lib"
set "new=%new:\=\\%"
set "file=src/mln_path.c"
powershell -Command "(Get-Content '%file%') -replace '%old%', '\"%new%\"' | Set-Content '%file%'"
set "old=MLN_LANG_DYLIB"
set "new=!%HOME%!\libmelon\lang\dylib"
set "new=%new:\=\\%"
set "file=src/mln_path.c"
powershell -Command "(Get-Content '%file%') -replace '%old%', '\"%new%\"' | Set-Content '%file%'"
set "old={{ROOT}}"
set "new=!%HOME%!\libmelon"
set "new=%new:\=\\%"
set "file=conf/melon.conf.msvc.template"
powershell -Command "(Get-Content '%file%') -replace '%old%', '%new%' | Set-Content 'conf/melon.conf'"
endlocal
mkdir lib objs\src "%HOME%\libmelon\logs" "%HOME%\libmelon\lang\lib" "%HOME%\libmelon\lang\dylib" "%HOME%\libmelon\include" "%HOME%\libmelon\conf" "%HOME%\libmelon\lib" "%HOME%\libmelon\tmp"
echo "" > "%HOME%\libmelon\null"
for %%f in (src\*.c) do (
cl /c /DMSVC /I include "%%f" /Fo:objs\%%f.o /O2
)
lib /OUT:lib\libmelon_static.lib objs\src\*.o
setlocal
xcopy include "%HOME%/libmelon/include" /E /I /Y
xcopy lib "%HOME%/libmelon/lib" /E /I /Y
xcopy conf "%HOME%/libmelon/conf" /E /I /Y
endlocal
echo Done