2006-12-14 07:42:42 +03:00
|
|
|
@echo off
|
2006-12-24 04:01:00 +03:00
|
|
|
echo ####################################################
|
|
|
|
echo # Melibc builder #
|
|
|
|
echo # usage: build [clean] #
|
|
|
|
echo ####################################################
|
2006-12-14 07:42:42 +03:00
|
|
|
rem #### CONFIG SECTION ####
|
2007-10-15 13:42:17 +04:00
|
|
|
set LIBNAME=libck.a
|
2006-12-14 07:42:42 +03:00
|
|
|
set INCLUDE=include
|
2007-10-15 13:42:17 +04:00
|
|
|
set CC=
|
2006-12-14 07:51:41 +03:00
|
|
|
set CFLAGS=-c -nostdinc -DGNUC -I"%cd%\%INCLUDE%"
|
2007-10-15 13:42:17 +04:00
|
|
|
set AR=
|
|
|
|
set ASM=
|
|
|
|
set dirs=stdio memory kolibrisys string stdlib
|
2006-12-14 07:42:42 +03:00
|
|
|
rem #### END OF CONFIG SECTION ####
|
|
|
|
|
|
|
|
set objs=
|
|
|
|
set target=%1
|
|
|
|
if not "%1"=="clean" set target=all
|
|
|
|
|
2006-12-14 07:51:41 +03:00
|
|
|
set INCLUDE="%cd%"
|
2006-12-14 07:42:42 +03:00
|
|
|
call :Target_%target%
|
|
|
|
|
|
|
|
if ERRORLEVEL 0 goto Exit_OK
|
|
|
|
|
|
|
|
echo Probably at runing has been created error
|
|
|
|
echo For help send a report...
|
|
|
|
pause
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
:Compile_C
|
2006-12-14 07:51:41 +03:00
|
|
|
%CC% %CFLAGS% %1 -o "%~dpn1.o"
|
2006-12-14 07:42:42 +03:00
|
|
|
if not %errorlevel%==0 goto Error_Failed
|
2006-12-14 07:51:41 +03:00
|
|
|
set objs=%objs% "%~dpn1.o"
|
2006-12-14 07:42:42 +03:00
|
|
|
goto :eof
|
|
|
|
|
|
|
|
:Compile_Asm
|
2006-12-14 07:51:41 +03:00
|
|
|
%ASM% %1 "%~dpn1.o"
|
2006-12-14 07:42:42 +03:00
|
|
|
if not %errorlevel%==0 goto Error_Failed
|
2006-12-14 07:51:41 +03:00
|
|
|
set objs=%objs% "%~dpn1.o"
|
2006-12-14 07:42:42 +03:00
|
|
|
goto :eof
|
|
|
|
|
|
|
|
:Target_clean
|
|
|
|
echo cleaning ...
|
2006-12-14 07:51:41 +03:00
|
|
|
for %%a in (%dirs%) do del /Q "%%a\*.o"
|
2006-12-14 07:42:42 +03:00
|
|
|
goto :Exit_OK
|
|
|
|
|
|
|
|
:Target_all
|
|
|
|
echo building all ...
|
|
|
|
for %%a in (%dirs%) do (
|
2006-12-14 07:51:41 +03:00
|
|
|
for %%f in ("%%a\*.asm") do call :Compile_Asm "%%f"
|
|
|
|
for %%f in ("%%a\*.c") do call :Compile_C "%%f"
|
2006-12-14 07:42:42 +03:00
|
|
|
)
|
|
|
|
%AR% -ru %LIBNAME% %objs%
|
|
|
|
if not %errorlevel%==0 goto Error_Failed
|
|
|
|
goto Exit_OK
|
|
|
|
|
|
|
|
:Error_Failed
|
|
|
|
echo error: execution failed
|
|
|
|
pause
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
:Exit_OK
|
2006-12-24 04:01:00 +03:00
|
|
|
echo ####################################################
|
|
|
|
echo # All operations has been done... #
|
|
|
|
echo # For cleaning run this script with param " clean" #
|
|
|
|
echo ####################################################
|
2006-12-14 07:42:42 +03:00
|
|
|
pause
|
|
|
|
exit 0
|