2006-12-14 05:42:42 +01:00
|
|
|
@echo off
|
2006-12-24 02:01:00 +01:00
|
|
|
echo ####################################################
|
|
|
|
echo # Melibc builder #
|
|
|
|
echo # usage: build [clean] #
|
|
|
|
echo ####################################################
|
2006-12-14 05:42:42 +01:00
|
|
|
rem #### CONFIG SECTION ####
|
2007-10-15 11:42:17 +02:00
|
|
|
set LIBNAME=libck.a
|
2006-12-14 05:42:42 +01:00
|
|
|
set INCLUDE=include
|
2020-04-30 10:47:52 +02:00
|
|
|
set CC=kos32-tcc
|
2016-04-30 15:50:04 +02:00
|
|
|
set CFLAGS=-c -nostdinc -DGNUC -I"%cd%\%INCLUDE%" -Wall
|
2016-04-27 21:59:20 +02:00
|
|
|
set AR=kos32-ar
|
|
|
|
set ASM=fasm
|
2020-04-30 10:47:52 +02:00
|
|
|
set dirs=stdio memory kolibrisys string stdlib math dlfcn
|
2006-12-14 05:42:42 +01:00
|
|
|
rem #### END OF CONFIG SECTION ####
|
|
|
|
|
|
|
|
set objs=
|
|
|
|
set target=%1
|
|
|
|
if not "%1"=="clean" set target=all
|
|
|
|
|
2006-12-14 05:51:41 +01:00
|
|
|
set INCLUDE="%cd%"
|
2006-12-14 05:42:42 +01: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
|
2018-09-25 13:52:22 +02:00
|
|
|
echo compile .c %1
|
2006-12-14 05:51:41 +01:00
|
|
|
%CC% %CFLAGS% %1 -o "%~dpn1.o"
|
2006-12-14 05:42:42 +01:00
|
|
|
if not %errorlevel%==0 goto Error_Failed
|
2006-12-14 05:51:41 +01:00
|
|
|
set objs=%objs% "%~dpn1.o"
|
2006-12-14 05:42:42 +01:00
|
|
|
goto :eof
|
|
|
|
|
|
|
|
:Compile_Asm
|
2018-09-25 13:52:22 +02:00
|
|
|
echo compile .asm %1
|
2006-12-14 05:51:41 +01:00
|
|
|
%ASM% %1 "%~dpn1.o"
|
2006-12-14 05:42:42 +01:00
|
|
|
if not %errorlevel%==0 goto Error_Failed
|
2006-12-14 05:51:41 +01:00
|
|
|
set objs=%objs% "%~dpn1.o"
|
2006-12-14 05:42:42 +01:00
|
|
|
goto :eof
|
|
|
|
|
|
|
|
:Target_clean
|
|
|
|
echo cleaning ...
|
2006-12-14 05:51:41 +01:00
|
|
|
for %%a in (%dirs%) do del /Q "%%a\*.o"
|
2006-12-14 05:42:42 +01:00
|
|
|
goto :Exit_OK
|
|
|
|
|
|
|
|
:Target_all
|
|
|
|
echo building all ...
|
|
|
|
for %%a in (%dirs%) do (
|
2006-12-14 05:51:41 +01:00
|
|
|
for %%f in ("%%a\*.asm") do call :Compile_Asm "%%f"
|
|
|
|
for %%f in ("%%a\*.c") do call :Compile_C "%%f"
|
2006-12-14 05:42:42 +01:00
|
|
|
)
|
2018-09-25 13:52:22 +02:00
|
|
|
echo calling AR
|
2006-12-14 05:42:42 +01: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 02:01:00 +01:00
|
|
|
echo ####################################################
|
|
|
|
echo # All operations has been done... #
|
|
|
|
echo # For cleaning run this script with param " clean" #
|
|
|
|
echo ####################################################
|
2006-12-14 05:42:42 +01:00
|
|
|
pause
|
|
|
|
exit 0
|