GBDK libraries documentation
PrevNext

Chapter 1. Using GBDK and maccer

Table of Contents
Compiling programs
Using Makefiles

Compiling programs

This section assumes that you have installed GBDK properly and build the libraries as per the instructions on Pascal's homepage.

The program 'lcc' is a front end for the actual compiler, assembler and linker. It works out what you want to do based on command line options and the extensions of the files you give it, computes the order in which the various programs must be called and then executes them in order. Some examples are:

Arguments to the assembler etc can be passed via lcc using -Wp..., -Wf..., -Wa... and -Wl... to pass options to the pre-processor, compiler, assembler and linker respectivly. Some common options are:

For example, to compile the example in the memory section and to generate a listing and map file you would use:
lcc -Wa-l -Wl-m -Wl-g_snd_stat=0xff26 -o image.gb hardware.c
				
Note the leading underscore that C adds to symbol names.

Unfortunatly maccer, Michael Hope's macro preprocessor for the assembler has to be run seperatly as lcc dosnt know about it. To turn the assembler file with macros 'source.ms' into the assembler file 'source.s', use

maccer -o source.s source.ms
				
If the -o source.s option isnt specified then maccer writes to stdout. If source.ms isnt specified then maccer reads from stdin.


PrevHomeNext
Preface Using Makefiles