Next: 4.10 Controlling the Quick Up: 4. Wrapping Objective-C Libraries Previous: 4.8 Useful Make Options


4.9 Including Special Code in the Wrapper GNUmakefiles

This section describes a feature which is usually not needed, so you may skip it at a first reading. As a prerequisite, you probably need to have read the section 4.1.2 to make any use of this section.

It is possible that you may need/want to insert special code in the GNUmakefile.preamble and GNUmakefile.postamble for the wrappers. For example, some special flags required to compile an Objective-C library (the Objective-C wrapper library for your library) against your Objective-C library.

JIGS itself by default does not generate GNUmakefile.preamble and GNUmakefile.postamble at all; but it will look in the library directory for the files

and, if any of them is present, copy them into the JavaWrapper directory, in the following way:
GNUmakefile.wrapper.objc.preamble --> JavaWrapper/Objc/GNUmakefile.preamble
GNUmakefile.wrapper.objc.postamble --> JavaWrapper/Objc/GNUmakefile.postamble --> JavaWrapper/Java/GNUmakefile.preamble --> JavaWrapper/Java/GNUmakefile.postamble

In this way, by adding one of these files to your library's directory, you can have it copied into the generated wrappers in the appropriate place.

4.9.1 Finding the library

A typical usage of this is to wrap libraries which have not yet been installed. Normally, you create java wrappers for libraries which you have already installed. Sometimes though, you need to create java wrappers for a library before it is installed. In this case, you might need to help the compiler to find your actual library when it links the java wrappers.

You would do so by creating a file called

and adding to this file something like the following line
ADDITIONAL_LIB_DIRS = -L/opt/nicola/MyLibrary/
Please note that you will need to install your library anyway before you can use the java wrappers, because the library must be found at run-time as well!

A classical case in which you need this trick is if you are building the java wrappers with the library itself (that is, if you have a GNUmakefile which includes both library.make and java-wrapper.make and which you use to compile both. In that case, you need to add

to your GNUmakefile.wrapper.objc.preamble to make sure that, when the java wrappers are built, the compiler will find the original library (and you also need to make sure that library.make is included before java-wrapper.make so that the library is compiled before the wrappers.

Next: 4.10 Controlling the Quick Up: 4. Wrapping Objective-C Libraries Previous: 4.8 Useful Make Options
Nicola Pero 2001-07-24