Automated Compiling of Libaries in mikroPascal.


1. Introduction.

It can be necessary to re-compile all your libraries at some point in time, e.g. due to a new compiler version that generates .mcl files in a new format. One way is to identify projects which use one or more of your libraries and compile them. Since not all libraries are used in one project this can be a tedious operation.

2. Using dummy projects to do the job.

An easier way to do this is to create "dummy" projects. Those projects have no statements in the main program file, but A problem that can occur here is that some libraries to compile may "bite" each other, e.g. because they generate procedures with the same name. In that case they will have to be moved to a different dummyproject.

2. Using batch files to do the job.

If you have a lot of dummyprojects as described above it can be easier to compile those in one or more batch files (.bat files). Those files contain the command line to start up the compiler with the necessary parameters.
The easiest way is to copy the compiler command from the logfile of each dummy project into the batchfile.
A few things have to be done extra to make it work (user friendly): A batch file (2 "dummy" projects) may look e.g. like this:
@echo off
Echo DummyProject
@echo on
@"C:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for PIC\mPPic.exe" -MSF -DBG -pP16F877 -UICD -LHF -Y -DL -RA -O11111114 -fo8 -N"C:\PIC Projects PRO compiler\Prototyping\__Build_all_P16\DummyProject.mpppi" -SP"C:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for PIC\defs\" -SP"C:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for PIC\Uses\P16\" -SP"C:\PIC Projects PRO compiler\Prototyping\__Build_all_P16\" -SP"C:\PIC Projects PRO compiler\LibraryP16\" "__Lib_Math.mcl" "__Lib_MathDouble.mcl" "__Lib_System.mcl" "__Lib_Delays.mcl" "__Lib_String.mcl" "__Lib_Conversions.mcl" "__Lib_OneWire.mcl" "__Lib_EEPROM.mcl" "__Lib_I2C_c34.mcl" "__Lib_UART_c67.mcl" "DummyProject.mpas" "StrngUtils.mpas" "BitUtils.mpas" "Debug.mpas" "DS1820.mpas" "EepromVariable.mpas" "LCD_4bits.mpas" "PascalFunctions.mpas" "Rc5_Decoder.mpas" "RTC_PCF8583P.mpas" "RTC2_DS1307.mpas" "UsartReceiver.mpas" "Project_Globals.mpas" > "C:\PIC Projects PRO compiler\Prototyping\__Build_all_P16\DummyProject.log"
@Findstr /B /I "145 141 303 304 340 453 356" "C:\PIC Projects PRO compiler\Prototyping\__Build_all_P16\DummyProject.log"
@echo.
@echo off

echo DummyProject2
@echo on
@"C:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for PIC\mPPic.exe" -MSF -DBG -pP16F877 -UICD -LHF -Y -DL -RA -O11111114 -fo8 -N"C:\PIC Projects PRO compiler\Prototyping\__Build_all_P16\DummyProject2.mpppi" -SP"C:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for PIC\defs\" -SP"C:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for PIC\Uses\P16\" -SP"C:\PIC Projects PRO compiler\Prototyping\__Build_all_P16\" -SP"C:\PIC Projects PRO compiler\LibraryP16\" "__Lib_Math.mcl" "__Lib_MathDouble.mcl" "__Lib_System.mcl" "__Lib_Delays.mcl" "__Lib_String.mcl" "__Lib_Conversions.mcl" "__Lib_SoftI2C.mcl" "DummyProject2.mpas" "LCD1602_4bits.mpas" "Rc6_Decoder.mpas" "RTC_PCF8583P_SoftI2c.mpas" "RTC2_DS1307_SoftI2c.mpas"	> "C:\PIC Projects PRO compiler\Prototyping\__Build_all_P16\DummyProject2.log"
@Findstr /B /I "145 141 303 304 340 453 356" "C:\PIC Projects PRO compiler\Prototyping\__Build_all_P16\DummyProject2.log"
@echo off
pause

3. Extensions.

In some cases it is desirable to generate different .mcl files from one source (e.g. with different compiler directives in a .pld file). The way to do this is making a copy of the source file reflecting the desired .mcl filename and compile that one. If necessary add some compiler directives to the head of the copy, e.g.:
echo CF

@echo {$DEFINE CF} > "C:\PIC Projects PRO compiler\LibraryP18\Fat32_cf.mpas"
@echo. >> "C:\PIC Projects PRO compiler\LibraryP18\Fat32_cf.mpas"
@type "C:\PIC Projects PRO compiler\LibraryP18\Fat32.mpas" >> "C:\PIC Projects PRO compiler\LibraryP18\Fat32_cf.mpas" 

@echo on
@"C:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for PIC\mPPic.exe" -MSF -DBG -pP18F4620 -UICD -LHF -Y -DL -RA -O11111114 -fo8 -N"C:\PIC Projects PRO compiler\Prototyping\__Build_all_P18_Fat32_MMC_SDMMC_IDE_CF_related\__Build_all_P18_CF\DummyProject0.mpppi" -SP"C:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for PIC\defs\" -SP"C:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for PIC\uses\P18\" -SP"C:\PIC Projects PRO compiler\Prototyping\__Build_all_P18_Fat32_MMC_SDMMC_IDE_CF_related\__Build_all_P18_CF\" -SP"C:\PIC Projects PRO compiler\LibraryP18\" -SP"C:\PIC Projects PRO compiler\Prototyping\__Build_all_P18\" "__Lib_Math.mcl" "__Lib_MathDouble.mcl" "__Lib_System.mcl" "__Lib_Delays.mcl" "__Lib_CType.mcl" "__Lib_String.mcl" "__Lib_Conversions.mcl" "__Lib_SPI_c345.mcl" "__Lib_CF.mcl" "DummyProject0.mpas" "Fat32_cf.mpas" "__Libs_mE_or_Janni.pld" > "C:\PIC Projects PRO compiler\Prototyping\__Build_all_P18_Fat32_MMC_SDMMC_IDE_CF_related\__Build_all_P18_CF\DummyProject0.log"
@Findstr /B /I "145 141 303 304 340 453 356" "C:\PIC Projects PRO compiler\Prototyping\__Build_all_P18_Fat32_MMC_SDMMC_IDE_CF_related\__Build_all_P18_CF\DummyProject0.log"
@echo.
@echo off
...
pause
The first 3 commands (consider the first "echo" not as a "command") in the above .bat file extract are:


-------------------------------------------