-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile_win.bat
127 lines (109 loc) · 3.52 KB
/
Makefile_win.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
:: Makefile_win.bat
:: Manual compile on Win10:
:: This will compile and build the cli terminal app on Win10.
:: This script must be run within Visual Studio's Developer CommandPrompt.
:: silence terminal while the script loads
@echo off
::@cls
:: Input external arguments, global var
SET userinput=%1
::::::::::::::::::: main menu function :::::::::::::::::::
:about
IF "%userinput%"=="clean" GOTO menuOptions
IF "%userinput%"=="build" GOTO menuOptions
IF "%userinput%"=="buildBashrc" GOTO menuOptions
IF "%userinput%"=="run" GOTO menuOptions
:: splash screen and instructions
ECHO.
ECHO ---------------------------------------------------
ECHO Compile and build a CLI scripture Rosary on Win10.
ECHO ---------------------------------------------------
ECHO.
ECHO About:
ECHO This script is a DIY Makefile. Select from the following option.
ECHO clean, build, run
ECHO.
ECHO Important:
ECHO This script must run within: Developer Command Prompt for VS 2019
ECHO The executable will be mainTTY.exe
ECHO.
ECHO Run from terminal:
ECHO .\Makefile_win.bat clean
ECHO .\Makefile_win.bat build
ECHO .\Makefile_win.bat run
ECHO.
ECHO Options:
ECHO clean:
ECHO clear previous builds
ECHO build:
ECHO clear previous builds
ECHO compile and build
ECHO run:
ECHO clear previous builds
ECHO compile and build
ECHO run the compile executable 'mainTTY.exe'
ECHO quit:
ECHO do nothing, abort script
ECHO ---------------------------------------------------
ECHO.
SET /P userinput=" Type selection option [ clean, build, run ]: "
:menuOptions
IF "%userinput%"=="quit" (
GOTO EOF
)
IF "%userinput%"=="clean" (
CALL :makeClean EOF
)
IF "%userinput%"=="build" (
CALL :makeClean EOF
CALL :makeBuild EOF
CALL :makeBashrc EOF
)
IF "%userinput%"=="run" (
CALL :makeClean EOF
CALL :makeBuild EOF
CALL :makeRun EOF
)
:: Terminate script
EXIT /B 0
::::::::::::::::::::: menu functions :::::::::::::::::::::
:makeClean
ECHO Cleaning ...
:: clean previous builds
IF EXIST *.obj DEL /F *.obj
IF EXIST *.exe DEL /F *.exe
:: vscode generated stuff
IF EXIST *.ilk DEL /F *.ilk
IF EXIST *.pdb DEL /F *.pdb
GOTO %~1
:makeBuild
ECHO Building ...
:: Compile and build object modules
cl /c sources\my_calendar.c
cl /c sources\my_csv_structs.c
cl /c sources\my_tty_ui.c
cl /c sources\my_tty_ui_win.c
:: Build the executable file
:: cl mainTTY.c my_calendar.obj my_csv_structs.obj my_tty_ui.obj /o "ttyRosary.exe"
cl mainTTY.c my_calendar.obj my_csv_structs.obj my_tty_ui.obj my_tty_ui_win.obj /Fe"ttyRosary.exe"
GOTO %~1
:makeBashrc
ECHO Building ...
:: Compile and build object modules
::cl /c sources\my_calendar.c
::cl /c sources\my_csv_structs.c
::cl /c sources\my_tty_ui.c
::cl /c sources\my_tty_ui_win.c
:: Build the executable file
:: cl mainBashrc.c my_calendar.obj my_csv_structs.obj my_tty_ui.obj /o "ttyBashrc.exe"
cl mainBashrc.c my_calendar.obj my_csv_structs.obj my_tty_ui.obj my_tty_ui_win.obj /Fe"ttyBashrc.exe"
GOTO %~1
:makeRun
ECHO Running ...
:: Run
IF EXIST .\ttyRosary.exe CALL .\ttyRosary.exe
GOTO %~1
@echo on
:EOF
:: End of file marker
ECHO Done.