[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gc makefile



Hallo!

> Ok, I've attached the file in question.  My goal is to add some
> entries so that GC will compile under a Metrowerks compiler using
> BeOS include files for both the PPC and x86 processors.  The PPC
> and Metrowerks additions are already in this file.  What do I have
> to add/change to get it to work on an x86?

Ok, here is my answer (I'll leave out everything not having directly
to with build the gc library itself:

Entry point is the pseudo target all. As with can see, it wants us to
build gc.a.

all: gc.a gctest

gc.a gets build by the following line:

base_lib gc.a: $(OBJS) dyn_load.o $(UTILS)

It tells us, that we first need to build all objects, exspecially
dyn_load.o and all the utils. The lines under this line are for linking
the various object file together and make a library.

Before compiling it is exspecially necessary that the utilities get
build. The utilities are (as one can find near the tip of the
makefile):

UTILS=if_mach if_not_there threadlibs

if_mach checks if the given parameters secribing a OS match the current
one and then executes the rest of the parameters, if_not_there checks for
existing files, threadlibs, I don't know.

Since linking has to be handled differently on different OSs, the code
under "base_lib gc.a: ..." executes different code for different OSs.
You already have supplied the correct call for BeBox. Note that you
check explicitely for POWERPC and BEBOX using if_mach. Thus you must
garantee that if_mach works on your machine correctly. if_mach.c
internally evaluates config.h so this should be the right place to
add your code for checking for BEBOX (set MACH_TYPE and OS_TYPE).
Currently there are checks for POWERPC and I386 but *not* for BEBOX,
so currently the correct linker gets not executed (Note, that the
MACH_TYPE must be handed to if_mach, o you cannot call it like
if_mach "" "BEBOX").

So before your library can get linked, all object files must be
compiled. You may note, that there are explicit generation rules for
most object files. The get compiled by using the makefile internal
default rules. This rules likely simply use CC and CFLAGS to call
the compiler. Check your documentation for details.

Some important objects file are named explicitely: mach_dep.o and
mark_rts.o. Similar to the linking stage, mach_dep.o gets generated
from different sources depending of the current OS and architectur. In
fact there exists a special assembler file for each plattform. If you
cannot adapt one of the existing ones you must generate on yourself,
else mach_dep.c would be used (look at the docu for that may mean).

mark_rts.o will be handled similar, except that mark_rts.c is the
source used for nearlyall systems.

Thats all I can give you as general advice. Feel free to ask more
questions if you want to know about details.

-- 
Gru...
       Tim.