Hi Aaron,
You didn't specify which FOR loop you were having problems with, and didn't specify what the problem was either, so I had to make assumptions and run it as I thought it would run...
Anyway, I think I found your main problem; and that was that you missed the all important SET command to initialise the Command Extensions (assuming these are actually available to you).
i.e. after your "@echo off" command at the top, you should have the following line:
setlocal enabledelayedexpansion
also, I did a little cleanup and reformatting of your code for the last bit, and here is the (hopefully) working section:
REM now, make a list of each object file
set OBJFILES=
for %%o in ("*.o") do set OBJFILES=!OBJFILES! "%OSMAKEDIR%\bin\obj\%1\%%o"
REM finally, link all the object files together into %OSMAKEDIR%\bin\%2
echo attempting to link -!OBJFILES!
echo --[LD] %OSMAKEDIR%\bin\%2
echo %OSMAKEDIR%\tools\djgpp\bin\ld.exe -T"%OSMAKEDIR%\src\%1\link.ld" -o "%OSMAKEDIR%\bin\%2"!OBJFILES!
%OSMAKEDIR%\tools\djgpp\bin\ld.exe -T"%OSMAKEDIR%\src\%1\link.ld" -o "%OSMAKEDIR%\bin\%2"!OBJFILES!
) else (
echo Error! OSMAKEDIR not defined. Make sure you're building with MAKE.BAT
)
should work as expected, or at least point you in the right direction. cheers.