Skip to content

Commit

Permalink
Поддержка скриптов srefc и srmake (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mazdaywik committed Feb 5, 2016
1 parent 86dc3ab commit 618b142
Show file tree
Hide file tree
Showing 21 changed files with 114 additions and 34 deletions.
4 changes: 2 additions & 2 deletions autotests/run.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ setlocal
set CPP=%~n1.cpp
set EXE=%~n1.exe

..\bin\srefc %1 2> __error.txt
..\bin\srefc-core %1 2> __error.txt
if errorlevel 1 (
echo COMPILER ON %1 FAILS, SEE __error.txt
exit
Expand Down Expand Up @@ -65,7 +65,7 @@ setlocal
set SREF=%1
set CPP=%~n1.cpp

..\bin\srefc %1 2> __error.txt
..\bin\srefc-core %1 2> __error.txt
if errorlevel 1 (
echo COMPILER ON %1 FAILS, SEE __error.txt
exit
Expand Down
4 changes: 2 additions & 2 deletions autotests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ run_test_aux() {
CPP=${SREF%%.sref}.cpp
EXE=${SREF%%.sref}

../bin/srefc $SREF 2>__error.txt
../bin/srefc-core $SREF 2>__error.txt
if [ $? -gt 0 ]; then
echo COMPILER ON $SREF FAILS, SEE __error.txt
exit
Expand Down Expand Up @@ -42,7 +42,7 @@ run_test_aux.BAD-SYNTAX() {
CPP=${SREF%%.sref}.cpp
EXE=${SREF%%.sref}

../bin/srefc $SREF 2>__error.txt
../bin/srefc-core $SREF 2>__error.txt
if [ $? -gt 0 ]; then
echo COMPILER ON $SREF FAILS, SEE __error.txt
exit
Expand Down
1 change: 0 additions & 1 deletion bootstrap.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ cd distrib
call bootstrap.bat
cd ..
if not exist bin\nul mkdir bin
copy distrib\bin\*.exe bin

cd src
call make.bat
Expand Down
1 change: 0 additions & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ fi

( cd distrib && ./bootstrap.sh )
mkdir -p bin
cp distrib/bin/* bin

( cd src && ./make.sh )

Expand Down
2 changes: 1 addition & 1 deletion distrib
4 changes: 2 additions & 2 deletions src/compiler/makeself-s.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@echo off
..\..\bin\lexgen Lexer.sref
call ..\make compiler srefc srefc "" ..\..\distrib
..\..\distrib\bin\lexgen Lexer.sref
call ..\make compiler srefc-core srefc "" ..\..\distrib
4 changes: 2 additions & 2 deletions src/compiler/makeself-s.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
../../bin/lexgen Lexer.sref
source ../make.sh compiler srefc srefc "" ../../distrib
../../distrib/bin/lexgen Lexer.sref
source ../make.sh compiler srefc-core srefc "" ../../distrib
2 changes: 1 addition & 1 deletion src/compiler/makeself.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@echo off
..\..\bin\lexgen Lexer.sref
call ..\make compiler srefc srefc
call ..\make compiler srefc-core srefc
2 changes: 1 addition & 1 deletion src/compiler/makeself.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
../../bin/lexgen Lexer.sref
source ../make.sh compiler srefc srefc
source ../make.sh compiler srefc-core srefc
14 changes: 6 additions & 8 deletions src/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,27 @@
setlocal
if not {%1}=={} goto :MAKE_PROJECT

call :MAKE_SUBDIR scripts install-scripts.bat
call :MAKE_SUBDIR compiler makeself-s.bat
copy ..\distrib\bin\srmake-core.exe ..\bin
call :MAKE_SUBDIR srmake make.bat
call :MAKE_SUBDIR srlib make.bat
call :MAKE_SUBDIR compiler makeself.bat
call :MAKE_SUBDIR lexgen make.bat
call :MAKE_SUBDIR srmake make.bat
call :MAKE_SUBDIR compiler makeself.bat

goto :END

:MAKE_PROJECT
call ..\..\c-plus-plus.conf.bat
set DIR=%1
set TARGET=%2
set MAINSRC=%~n3
set FLAGS=%4
set CPPLINE-FLAGS=%4
set PATH_TO_SREFC=%5
if {%PATH_TO_SREFC%}=={} (
set PATH_TO_SREFC=..\..
)
if not exist ..\..\build\%DIR%\nul mkdir ..\..\build\%DIR%
%PATH_TO_SREFC%\bin\srmake ^
-s %PATH_TO_SREFC%\bin\srefc ^
-c "%CPPLINE% -I%PATH_TO_SREFC%\srlib %FLAGS%" ^
-d ..\common -d %PATH_TO_SREFC%\srlib %MAINSRC%
call %PATH_TO_SREFC%\bin\srmake -d ..\common %MAINSRC%
if exist a.exe move a.exe ..\..\bin\%TARGET%.exe
if exist %MAINSRC%.exe move %MAINSRC%.exe ..\..\bin\%TARGET%.exe
if exist *.obj erase *.obj
Expand Down
18 changes: 9 additions & 9 deletions src/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@ make_subdir() {
}

if [ -z "$1" ]; then
make_subdir scripts install-scripts.sh
make_subdir compiler makeself-s.sh
cp ../distrib/bin/srmake-core ../bin
make_subdir srmake make.sh
make_subdir srlib make.sh
make_subdir compiler makeself.sh
make_subdir lexgen make.sh
make_subdir srmake make.sh
make_subdir compiler makeself.sh
else
source ../../c-plus-plus.conf.sh

DIR=$1
TARGET=$2
MAINSRC=$3
FLAGS=$4
CPPLINE_FLAGS=$4
PATH_TO_SREFC=$5

if [ -z "$PATH_TO_SREFC" ]; then
PATH_TO_SREFC=../..
fi

mkdir -p $PATH_TO_SREFC/bin
$PATH_TO_SREFC/bin/srmake \
-s $PATH_TO_SREFC/bin/srefc \
-c "$CPPLINE -I$PATH_TO_SREFC/srlib -o../../bin/$TARGET" \
-d ../common -d $PATH_TO_SREFC/srlib $MAINSRC
(
export CPPLINE_FLAGS="$CPPLINE_FLAGS -o../../bin/$TARGET"
$PATH_TO_SREFC/bin/srmake -d ../common $MAINSRC
)

mkdir -p ../../build/$DIR
mv *.cpp ../../build/$DIR
Expand Down
3 changes: 3 additions & 0 deletions src/scripts/install-scripts.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off
copy srefc.bat ..\..\bin
copy srmake.bat ..\..\bin
3 changes: 3 additions & 0 deletions src/scripts/install-scripts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
cp srefc.sh ../../bin/srefc
cp srmake.sh ../../bin/srmake
19 changes: 19 additions & 0 deletions src/scripts/srefc.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@echo off

:: Получаем путь к папке bin, удаляем концевой \
set BINDIR=%~dp0
set BINDIR=%BINDIR:~0,-1%

:: Получаем путь к дистрибутиву, удаяем концевой \
for %%d in ("%BINDIR%") do set DISTRDIR=%%~dpd
set DISTRDIR=%DISTRDIR:~0,-1%

:: Путь к папке srlib
set LIBDIR=%DISTRDIR%\srlib

:: Запуск
setlocal
call "%DISTRDIR%\c-plus-plus.conf.bat"
set PATH=%BINDIR%;%PATH%
srefc-core -c "%CPPLINE% %CPPLINE-FLAGS% -I\"%LIBDIR%\"" %* -d "%LIBDIR%"
endlocal
17 changes: 17 additions & 0 deletions src/scripts/srefc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Получаем путь к папке bin
BINDIR=$(dirname $0)

# Получаем путь к дистрибутиву
DISTRDIR=$(dirname $BINDIR)

# Путь к папке srlib
LIBDIR=$DISTRDIR/srlib

# Запуск
(
source $DISTRDIR/c-plus-plus.conf.sh
PATH=$BINDIR:$PATH
srefc-core -c "$CPPLINE $CPPLINE_FLAGS -I\"$LIBDIR\"" $* -d "$LIBDIR"
)
22 changes: 22 additions & 0 deletions src/scripts/srmake.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@echo off

:: Получаем путь к папке bin, удаляем концевой \
set BINDIR=%~dp0
set BINDIR=%BINDIR:~0,-1%

:: Получаем путь к дистрибутиву, удаяем концевой \
for %%d in ("%BINDIR%") do set DISTRDIR=%%~dpd
set DISTRDIR=%DISTRDIR:~0,-1%

:: Путь к папке srlib
set LIBDIR=%DISTRDIR%\srlib

:: Запуск
setlocal
call "%DISTRDIR%\c-plus-plus.conf.bat"
set PATH=%BINDIR%;%PATH%
srmake-core ^
-s srefc-core.exe ^
-c "%CPPLINE% %CPPLINE-FLAGS% -I\\"%LIBDIR%\\"" ^
%* -d "%LIBDIR%"
endlocal
20 changes: 20 additions & 0 deletions src/scripts/srmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Получаем путь к папке bin
BINDIR=$(dirname $0)

# Получаем путь к дистрибутиву
DISTRDIR=$(dirname $BINDIR)

# Путь к папке srlib
LIBDIR=$DISTRDIR/srlib

# Запуск
(
source $DISTRDIR/c-plus-plus.conf.sh
PATH=$BINDIR:$PATH
srmake-core \
-s srefc-core \
-c "$CPPLINE $CPPLINE_FLAGS -I\"$LIBDIR\"" \
$* -d "$LIBDIR"
)
2 changes: 1 addition & 1 deletion src/srlib/make.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
..\..\bin\srefc LibraryEx
..\..\bin\srefc-core LibraryEx

if not exist ..\..\srlib\src\nul (
mkdir ..\..\srlib
Expand Down
2 changes: 1 addition & 1 deletion src/srlib/make.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
../../bin/srefc LibraryEx
../../bin/srefc-core LibraryEx

mkdir -p ../../srlib/src
cp LICENSE *.h *.cpp ../../srlib
Expand Down
2 changes: 1 addition & 1 deletion src/srmake/make.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@echo off
call ..\make srmake srmake SRMake -DDONT_PRINT_STATISTICS
call ..\make srmake srmake-core SRMake -DDONT_PRINT_STATISTICS
2 changes: 1 addition & 1 deletion src/srmake/make.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
source ../make.sh srmake srmake SRMake -DDONT_PRINT_STATISTICS
source ../make.sh srmake srmake-core SRMake -DDONT_PRINT_STATISTICS

0 comments on commit 618b142

Please sign in to comment.