Created
February 4, 2012 12:36
-
-
Save jfthuong/1737592 to your computer and use it in GitHub Desktop.
Batch file to run or compile the argument file based on the extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM ---------------------- | |
REM ----- ARGUMENTS ------ | |
REM ---------------------- | |
set PATH=%~1 | |
set FILE=%~n1 | |
set DIR=%~dp1 | |
set EXTENSION=%~x1 | |
REM ---------------------- | |
REM ---------------------- | |
REM ------- CONFIG ------- | |
REM ---------------------- | |
set SH_DIR=C:\MinGW\msys\1.0\bin | |
set PERL_DIR=D:\Perl\bin\ | |
set TCL_DIR=D:\Tcl\bin\ | |
set CL_compilo="C:\Program Files\Microsoft Visual Studio\VC98\Bin\cl.exe" | |
set CFLAGS=-c %PATH% | |
set GNU_make="C:\MinGW\msys\1.0\bin\make.exe" | |
REM ---------------------- | |
IF /I %FILE%==Makefile GOTO _MAKEFILE | |
IF /I %EXTENSION%==.bat GOTO _BAT | |
IF /I %EXTENSION%==.sh GOTO _SH | |
IF /I %EXTENSION%==.pl GOTO _PL | |
IF /I %EXTENSION%==.tcl GOTO _TCL | |
IF /I %EXTENSION%==.c GOTO _C | |
IF /I %EXTENSION%==.ml GOTO _OCAML | |
IF /I %EXTENSION%==.mak GOTO _MAKEFILE | |
IF /I %EXTENSION%==.mk GOTO _MAKEFILE | |
echo Format of argument (%PATH%) not supported! | |
GOTO END | |
REM Batch shell files (bat) | |
:_BAT | |
call %PATH% | |
goto END | |
REM Linux shell scripts (sh) | |
:_SH | |
call %SH_DIR%/sh.exe %PATH% | |
goto END | |
REM Perl Script files (pl) | |
:_PL | |
call %PERL_DIR%/perl.exe %PATH% | |
goto END | |
REM Tcl Script files (tcl) | |
:_TCL | |
call %TCL_DIR%/tclsh.exe %PATH% | |
goto END | |
REM Compile C Source files (C) | |
:_C | |
call "%CL_compilo%" %CFLAGS% | |
REM call "%CL_compilo%" /? | |
REM call %CL_compilo% -c %PATH% | |
REM call %CL_compilo% -o"%DIR%\%FILE%.exe" "%DIR%\%FILE%.obj" | |
del "%DIR%\%FILE%.obj" | |
goto END | |
REM Compile OCAML Source files (ml) | |
:_OCAML | |
ocamlc -c -g %PATH% | |
ocamlc -g -o "%DIR%\%FILE%.exe" "%DIR%\%FILE%.cmo" | |
del "%DIR%\%FILE%.cmo" "%DIR%\%FILE%.cmi" | |
goto END | |
REM Compile OCAML Source files (ml) | |
:_MAKEFILE | |
call %GNU_make% -f %PATH% | |
goto END | |
REM ... END ... | |
:END | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment