Make System for BBC BASIC for Windows ===================================== Version 0.19 01-Mar-2009 J.G.Harston mdfs.net/Software/BBCBasic/Windows/Make Introduction ------------ This is a 'make' system for Richard Russell's BBC BASIC for Windows (BBFW). A make system allows a programmer to develop an application in several smaller source files instead of a single large source file. These small component files can then be glued together to create the final executable file. An initial advantage of this is that each component can be developed and tested seperately. A much greater advantage is that it allows the easy building up of a 'library' of useful pieces of code that can be stored centrally and automatically re-used in other applications. This concept will be familiar to anybody who has developed with 'C'. Installation ------------ To install the make system, simply copy the 'Make.exe' file into your BBFW application directory. To uninstall, simply delete the 'Make.exe' file. Use --- A makefile is simply a DOS batchfile with a list of makefile entries in it. An example makefile is the supplied Make1.bat which contains: @REM Make Demo1 as a Windows GUI application @"C:\Program Files\BBC BASIC for Windows\Make" %0 @exit @ Demo1 Shared Lib\DateLib -window 320 256 1 0 -out Demo1.exe Double-clicking on the makefile will run the make program following the instructions in the makefile. The first few lines must be as above, with '@' at the beginning of the lines, and '%0' at the end of the line before 'exit'. The path to Make in this line can be changed to point to where-ever BBFW is installed on your system, eg '@H:\Apps\BBFW\Make.exe %0' Each line can be either a filename or an option. If it is a filename, it is searched for first in the same directory as the makefile, and then in the directory that Make.exe is in (ie, the BBFW directory). The above example joins together 'Demo1.bbc' and 'Shared.bbc' in the 'Examples' directory and 'Lib\DateLib.bbc' in the BBFW directory. Files are joined together in the order they appear in the makefile. Source filenames do not need to have extensions specified. If there is no extension, a file is searched for with extensions in the following order: '.bbc', '.bas', '.txt', '.'. Source files can be tokenised in Russell or Acorn/Wilson format, or can be plain text. The file format is detected automatically regardless of filename or extension. The following options are supported: -out The output filename. There must be an output filename! If the name ends with ".exe" (case is ignored), then an executable will be created, as though the 'Compile' option was used from the BBFW editor. If you are using the demo version of BBFW this will not be possible as the demo is supplied with no compile support. -window The window settings. can be 0, 1, 2, 3 for Hidden, Normal, Minimised and Maximised. can be 0 for entire window or 8 for client window. -text Text/Console/Non-GUI application. This option overrides any -window settings and make the resulting program a text console application. The program itself must make appropriate API calls to attach to the console I/O. The BASIC library 'TextIO' is supplied with Make which can be used for this. 'TextIO' must be the first item included in any Make list, before the main program code. -icon Includes the specified icon file in the output executable file, and sets the icon displayed by the file. The file is searched for in the same manner as program files. -crunch The BASIC code will be crunched in a simple manner. All REMs are removed, all colons and spaces at the end of a line are removed, and all resulting empty lines are removed. (Not yet implemented) -link This removes from the BASIC code DEFPROCs and DEFFNs that are not called by the program anywhere. Using -link and -crunch will produce the smallest possible output file. Be careful with this option. If you call functions using EVAL then this option has no way of knowing this. Also, subroutines with multiple entries are not delinked correctly. (Not yet implemented) Notes ----- Joining source files together in this manner is different from the use of the BBFW INSTALL command. INSTALL requires the file it loads to be present on the system the program is running on, and PROCs and FNs are searched for in reverse order of INSTALLed files. Using Make only requires the source files to be present on the development system. Included in the ZIP file is WinMake, a RISC OS BASIC program that performs the same functions as Make.exe, using the same makefile and source files, but for RISC OS. This is not documented here. Testing ------- Make v0.18 has been tested with: BBFW v3.00 BBFW v3.12 BBFW v4.r3 BBFW v5.01a BBFW v5.10b BBFW v5.21a BBFW v5.50a BBFW v5.80a BBFW v5.90a BBFW v5.90b BBFW v5.91a Version History --------------- 0.10 Initial development. -icon option unimplemented. 0.11 Deals with spaces in pathnames correctly. 0.12 Deals with quoted pathnames. 0.13 18-Jul-2005 Works with BBFW v4.00. 0.14 07-Nov-2005 Patched to fix output length. 0.15 20-Feb-2006 Final output length now corrected. 0.16 20-May-2006 -text option implemented. 0.17 18-Jun-2006 Will include Wilson/Acorn and text files. 0.18 04-Jul-2006 Wilson/Acorn format conversion outputs correct length byte. 0.19 01-Mar-2009 -icon option implemented. References ---------- Richard Russell - www.rtrussell.co.uk, code for including icon file. Jon Ripley - jonripley.com, code for setting application mode.