batch file ?

Thread Starter

Mathematics!

Joined Jul 21, 2008
1,036
I am have a little trouble figureing out how to get this batch file to work?

Rich (BB code):
set compiler = gcc
set linker   = ld
set cflags  = -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -c
set lflags   = -T link.ld
set bin      = kernel.bin
 
for /f %%e IN ('dir /b *.c') do %compiler% %cflags% %%e
 
rem for /f %%d IN ('dir /b *.o') do %linker% %lflags% %%d
 
 
echo Cleaning up object files...
rem del *.o
echo Done!
pause
What is not working is after the do command in the for loop I want to use my set varibles to compile all the .c files in the current directory.
I have tried %%var and %var% ...
I know I am missing something curious if anybody knows how to fix it.
It should be a quick fix hopefully.
After I get the compiled for working I want to beable to get the linker for loop working I know their has to be a way to concatenate all the .o files..
Basically this batch file is just for compiling and linking all .c and .o files together into a bin for my os kernel

Thanks for any help
 
Last edited:
Top