rem 使用bat编译C51项目
@echo off&setlocal enabledelayedexpansion
set BIN_PATH=C:\Keil_v5\C51\
set path=%BIN_PATH%BIN; %path%
rem SET TMP=D:\TMP
set C51INC=%BIN_PATH%INC
set C51LIB=%BIN_PATH%LIB
rem a51
for %%a in (%~dp0\src\*.A51) do (
A51.exe %%a
)
rem c51 start.c
for %%a in (%~dp0\src\*.c) do (
C51.exe %%a
)
set CLASSPATH="EMP"
for %%a in (%~dp0\src\*.OBJ) do (
if !CLASSPATH! == "EMP" (
set CLASSPATH="%%a"
) else (
set CLASSPATH=!CLASSPATH!,"%%a"
)
)
if not exist bin mkdir bin
BL51.exe %CLASSPATH% TO "bin\target.tmp" RAMSIZE(256)
OH51.exe bin\target.tmp
rem 删除生成的临时文件
rem for %%a in (%~dp0\src\*.obj) do (
rem del %%a
rem )
rem for %%a in (%~dp0\src\*.lst) do (
rem del %%a
rem )
rem for %%a in (%~dp0\bin\*.tmp) do (
rem del %%a
rem )
rem for %%a in (%~dp0\bin\*.m51) do (
rem del %%a
rem )
pause
示例工程下载:http://download.csdn.net/download/mini92/9941276