3DO ZONE Forums

The Only R.E.A.L. 3DO Experience.
It is currently Sun May 28, 2017 4:09 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Mon Feb 24, 2014 7:31 pm 
Offline
Jaguar MOD
User avatar

Joined: Mon Apr 01, 2013 7:09 am
Posts: 820
For the new dev kits from Hillsoftware all references to ALN(Atari's Linker) and MAC or MADMAC should be replaced with SLN(SubQMods Linker) and SMAC(SubQMods Macro Assembler)

Belboz wrote:
Code:
OFILES = \
startup.o \
jag.o


OFILES is a definition that is a list of all the object files needed for this project. The \ is used to denote that the definition isn't finished (normally the carriage return would mark the end of it). You can see we don't have a \ after jag.o

So basically we have two object files in our project. statup.o and jag.o

Code:

jag : $(OFILES)
    aln -c jag.lnk


This tells us in order to build jag we need all the object files defined above. If they all exist then the linker (aln) is called as noted.

Code:
GAS2OBJ = mac -i/jaguar/include -fb -g $?
C2OBJ = gccjag -b m68k -B/jaguar/bin/ -V2.6 -Wall -DJAGUAR -O2 -c -o $@ $?


These two lines define command line parameters for generating object files from c and assembly source.

GAS2OBJ tell how to use the assembler "mac" to assemble and assembly source code into and object file.

C2OBJ tells how to compile a C file into an object file.

Code:
startup.o : startup.s
    $(GAS2OBJ)


These two lines show how to build startup.o

If the make utility doesn't see a startup.o file in the project (or the source code file is newer than the .o file denoting changes were made) it assembles the file into an object file.

So if startup.o is missing the makefile executes the GAS2OBJ command with startup.s as the source file. This will generate the startup.o if the assembly is ok (i.e. no errors in the code). This is what the make utility would do if it needed to generate the startup.o file

mac -i/jaguar/include -fb -g startup.s

Code:
jag.o : jag.c
    $(C2OBJ)


This is the same as the above example but tells the make utility how to build jag.o . If jag.o doesn't exist the C2OBJ command line is executed with jag.c as a parameter.

Code:
clean :
    rm *.o
    rm *.abs


this is what happens if you type "make clean" from the command line.

It removes all the *.o and *.abs files. This will probably fail on DOS systems since the rm command doesn't exist. So you should edit and change the rm to del.

That is a quick run through. Please ask if you have more questions.

A makefile greatly simplifies building a project. Especially with large numbers of files.

You can see it basically tells how to build the program in stages. I.E.

In order to build jag I need object files I will link with aln

In order to build object files I need to either assemble or compile the .s and .c files into object files

It is also nice because the make utility looks at whatever it is building (and object file, the abs file) and it compares the file date of the two items.

So if the jag.abs is older than the object files, it knows it has to re-link.

If an assembly file is newer than its object file, it knows it has to re-assemble that file

So if you have a large project with lots of C and assembly files and you make a change to one file it will only recompile or assemble that file, and relink the project. It wont recompile and re-assemble all the other source files.

_________________
What came after the Jaguar was the PS1 which for all it's greatness, ushered in corporate development and with it the bleached, repetitive, bland titles which for the most part we're still playing today. - David Wightman


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group