home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
215.lha
/
GlueMaker_v1.0
/
gluemaker.doc
< prev
next >
Wrap
Text File
|
1996-02-15
|
8KB
|
199 lines
***************************************************************************
* *
* GlueMaker *
* *
* By Talin *
* *
* Version 1.0 *
* (With some ideas/help from Joe Pearce) *
* *
***************************************************************************
GlueMaker is Copyright (c) 1989 by David Joiner, a.k.a. Talin.
GlueMaker is a utility that greatly simplifies the process of building
shared libraries on the Amiga. It generates, automatically, a link library
of all the 'glue routines' that are needed to access an exec library.
It's input is a '.fd' file.
Distribution information:
This is the latest in a series of "Talin's Tools", basically various
utilities I've developed for my own personal use that I'm releasing for
general distribution.
You can put this on any kind of disk or BBS that you want, as long as
you give proper credit.
I'm trying to develop the concept of 'Trade-Ware', since I don't have
the time or expertise to run a business. So don't send me money, send me
fun software to play with. If you're a developer, send me something you're
working on. If you are a collector, send me some nice PD thingies that
you think are neat. (Whatever you do, be ethical and legal).
Of course, you don't have to send me anything at all if you don't want
to. I get lots and lots of money from things like Faery Tale and such, so
it's not like I need it. But it does make me feel good (One fellow sent me
a copy of JET, still in the shrink wrapped box, because my Sectorama utility
saved his hard disk...).
My Address is:
David Joiner
17428 Chatsworth St.
Granada Hills, CA 91344
Or, you can contact me through MicroIllusions at (818) 360-7124, or
1-800-522-2041.
GlueMaker instructions:
WARNING
Gluemaker produces a file called 'makefile' as one of it's output files.
MAKE SURE YOU DON'T ACCIDENTALLY OVER-WRITE ONE OF YOUR VALUABLE MAKEFILES!!!
I strongly sugggest putting all files related to a particular GlueMaker
library in a directory by themselves. For example, my 'musicx.library'
glue files are all in the file 'mx.glue'.
GlueMaker takes a '.fd' file, such as 'exec_lib.fd' and make all the
requsite files for createing 'glue' subroutines. The files created will be:
1. Assembly Files.
GlueMaker will create an assembly ('.asm') file for each entry point
in the library. The reason for a seperate file for each subroutine is so
that when the library is created, each object module will be independant.
Currently, the conventions for register usage are as follows: (same as
Aztec C):
-- d0-d4 and a0-a1 are scratch - glue routines may modify them.
-- a6 is used as the library base pointer and is changed.
-- all other registers are preserved.
If the 'PROTECT' option is used in the input file, then d2 and d3 are
also preserved, thus following the ROM Kernal register conventions.
Each file has a name of the form '<routine name>.asm'
2. A Makefile.
Currently, the makefile created is in Aztec format, however it is
trivial to convert to other formats with a text editor.
3. A Vector Offset file.
This is a file which defines the Library Vector Offsets (LVO's) for each
entry point in the library. It first defines a macro, LIBVEC, (which
is identical to the 'LIBDEF' macro in exec/libraries.h), and then
includes the Vector Header file, which has a bunch of LIBVECs. The
result, when 'make' is run, is an object module which has all the
Library Vector Offsets declared as external symbols.
The reason I didn't use the action LIBDEF macro (though I do use LIBINIT)
is that LIBVEC will be defined as a different macro when we actually
build the library.
This file has a name of the form '<libname>_lvo.asm'.
3. A Vector Header File.
This is a file of macros used in constructing the library. It consists
of one line of text for each library entry, of the form:
LIBVEC <functionname>
I normally use this in two places:
First, I use it in generating the shared library to create the
vector table. I define the macro 'LIBVEC' as equivalent to 'dc.l',
which allows MakeLibrary to build a library from it.
Second, I use it when generating the link library, to create the
Library Vector Offsets (_LVO's). This is use in conjunction with the
Vector Offset File.
This file has a name of the form '<libname>_lvo.i'.
To run GlueMaker, type:
GlueMaker [input file]
where 'input file' is of the following format:
FDFILE=<path name of fd file>
LIBFILE=<name of resulting link library file>
OUTDIR=<directory to write all output files to>
PROTECT
FDFILE=
indicates the path name of the .fd file to read (not including
the '.fd'), such as "ram:exec_lib".
OUTDIR=
indicates the output directory for all the files that will be produced.
LIBFILE=
indicates the file name of the link library to be produced. Do not
include an extension.
PROTECT
this is an option which causes GlueMaker to preserve registers d2/d3
in all the glue routines.
for example:
FDFILE=df1:fdfiles/exec_lib
OUTDIR=ram:
LIBFILE=exec
See the example .fd file included in the arc file. Note that the
'exec_lib.fd' is not included, since it's copyrighted, but since it can
be found on the Workbench 'Extras' disk, you can experiment with the
examples.
In the above case, the follwing files will be produced:
ram:exec_lvo.i
ram:exec_lvo.asm
ram:makefile
plus a file for each routine, of the form 'ram:xxx.asm' where xxx is the
name of an exec entry point.
After GlueMaker has been run, then you need to run 'make'.
This will assemble all of the file and create a linkable library of
all the object files. In the above example, the files produced would be:
ram:exec_lvo.o
ram:exec.lib
plus a '.o' file for each '.asm' file.
Also, I've made some extensions to the .fd syntax, plus there are some
planned extensions that I plan to do in the future, but haven't gotten around
to yet. Most of them are pretty trivial.
Also note that currently, GlueMaker only supports 32-bit arguments on the
stack - i.e. each argument is assumed to take a long word on the stack, just
like the Amiga ROM Kernal routines.
'&' before a register means use effective address rather than register
for use in things like RawDoFmt that need the address of the stack.
##jump means instead of generating a return, generate a bra to
the given label. Useful for routines that require a common
cleanup routine, or for libs that pass resultsin registers
other than d0.
Planned extensions to .fd format:
.l, .w, or .b before a register means that size argument on stack.
##pre.insert
insert this code before the jsr/jmp
##post.insert
insert this code after the jsr
##*
end of insertion
##savealso
save this reg in addition to the normal ones.
Planned enhancements to GlueMaker (not likely soon, though...!)
1. Lattice C supports direct calling of shared libraries through
#pragma directives, and I know that Jim Goodnow wants to add a similar
capability to Aztec C. It would be nice to generate these files.
2. Specify Glue arguments directly on the command line.
3. Support for Lattice C and other compilers.
4. Support for other 'make' utilities.