Next: , Previous: , Up: Top   [Contents]


1.5 Global Variables (GNUmakefile.preamble)

GNUmakefile.preamble is an optional file that may be put within the package for declaring global makefile variables for the package. The filename, GNUmakefile.preamble, is just a convention; likewise, the variables defined within it can be put in the normal GNUmakefile versus in this special file. However, the reason for this convention is that the GNUmakefile may be automatically maintained by a project management system, like Project Center, so any changes made to GNUmakefile may be discarded by that project management system.

The file, GNUmakefile.preamble, in the Makefile Package is a template that can be used the project’s GNUmakefile.preamble. It is not necessary to have a GNUmakefile.preamble with the project unless it is actually needed, the Makefile Package will only include it if it is available, see Makefile Structure for information on how the Makefile Package includes a GNUmakefile.preamble.

The rest of this section describes the individual global variables that the Makefile Package uses which are generally placed in the package’s GNUmakefile.preamble.

Variable: ADDITIONAL_CPPFLAGS

ADDITIONAL_CPPFLAGS are additional flags that will be passed to the compiler preprocessor. Generally any macros to be defined for all files are placed here; the are passed for both Objective-C and C files that are compiled. RUNTIME_DEFINE, FOUNDATION_DEFINE, GUI_DEFINE, and GUI_BACKEND_DEFINE are some makefile variables which define macros that can be assigned to ADDITIONAL_CPPFLAGS. The following example illustrates the use of ADDITIONAL_CPPFLAGS to define a macro for the Objective-C Runtime Library plus an additional macro that is specific to the package.

ADDITIONAL_CPPFLAGS = $(RUNTIME_DEFINE) -DVERBOSE=1
Variable: ADDITIONAL_OBJCFLAGS

ADDITIONAL_OBJCFLAGS are additional flags that will be passed to the compiler when compiling Objective-C files. Adding flags here does not override the default OBJCFLAGS, see OBJCFLAGS, they are in addition to OBJCFLAGS. Generally ADDITIONAL_OBJCFLAGS are placed before OBJCFLAGS when the compiler is executed, but one should avoid having any placement sensitive flags because the order of the flags is not guaranteed. The following example illustrates how you can pass additional Objective-C flags.

ADDITIONAL_OBJCFLAGS = -Wno-protocol
Variable: ADDITIONAL_CFLAGS

ADDITIONAL_CFLAGS are additional flags that will be passed to the compiler when compiling C files. Adding flags here does not override the default CFLAGS, see CFLAGS, they are in addition to CFLAGS. Generally ADDITIONAL_CFLAGS are placed before CFLAGS when the compiler is executed, but one should avoid having any placement sensitive flags because the order of the flags is not guaranteed. The following example illustrates how you can pass additional C flags.

ADDITIONAL_CFLAGS = -finline-functions
Variable: ADDITIONAL_LDFLAGS

ADDITIONAL_LDFLAGS are additional flags that will be passed to the linker when it creates an executable; these flags are passed when linking a command line tool, and application, or an Objective-C program. Adding flags here does not override the default LDFLAGS, see LDFLAGS, they are in addition to LDFLAGS. Generally ADDITIONAL_LDFLAGS are placed before LDFLAGS when the linker is executed, but one should avoid having any placement sensitive flags because the order of the flags is not guaranteed. The following example illustrates how you can pass addition linker flags.

ADDITIONAL_LDFLAGS = -v
Variable: ADDITIONAL_INCLUDE_DIRS

ADDITIONAL_INCLUDE_DIRS is the list of additional directories that the compiler will search when it is looking for include files. The directories should be specified as ‘-I’ flags to the compiler. The additional include directories will be placed before the normal GNUstep and system include directories, so they will always be searched first. The following example illustrates two additional include directories; /usr/local/gnu/include will be searched first, then /usr/gnu/include, and finally the GNUstep and system directories which are automatically defined by the Makefile Package.

ADDITIONAL_INCLUDE_DIRS = -I/usr/local/gnu/include -I/usr/gnu/include
Variable: ADDITIONAL_LIB_DIRS

ADDITIONAL_LIB_DIRS is the list of additional directories that the linker will search when it is looking for library files. The directories should be specified as ‘-L’ flags to the linker. The additional library directories will be placed before the GNUstep and system library directories so that they will be searched first by the linker. The following example illustrates two additional library directories; /usr/local/gnu/lib will be searched first, then /usr/gnu/lib, and finally the GNUstep and system directories which are automatically defined by the Makefile Package.

ADDITIONAL_LIB_DIRS = -L/usr/local/gnu/lib -L/usr/gnu/lib
Variable: ADDITIONAL_OBJC_LIBS

ADDITIONAL_OBJC_LIBS is the list of additional libraries that the linker will use when linking command line tools, applications, and Objective-C programs, see tool.make, application.make, and objc.make. For Objective-C programs, ADDITIONAL_OBJC_LIBS is placed before all of the Objective-C Runtime and system libraries so that they will be searched first when linking. For command line tools and applications, ADDITIONAL_OBJC_LIBS is placed before all of the Objective-C Runtime and system libraries but after the Foundation and GUI libraries. Libraries specified with ADDITIONAL_OBJC_LIBS should only depend upon the Objective-C Runtime and/or system functions, not Foundation or GUI classes; Foundation dependent libraries should be specified with ADDITIONAL_TOOL_LIBS and GUI dependent libraries should be specified with ADDITONAL_GUI_LIBS. The additional libraries should be specified as ‘-l’ flags to the linker as the following example illustrates.

ADDITIONAL_OBJC_LIBS = -lSwarm
Variable: ADDITIONAL_TOOL_LIBS

ADDITIONAL_TOOL_LIBS is the list of additional libraries that the linker will use when linking command line tools and applications, see tool.make and application.make. For command line tools, ADDITIONAL_TOOL_LIBS is placed before all of the GNUstep and system libraries so that they will be searched first when linking. For applications, ADDITIONAL_TOOL_LIBS is placed before the Foundation and system libraries but after the GUI libraries. Libraries specified with ADDITIONAL_TOOL_LIBS should only depend upon the Foundation classes and/or system functions, not GUI classes; GUI dependent libraries should be specified with ADDITIONAL_GUI_LIBS. The additional libraries should be specified as ‘-l’ flags to the linker as the following example illustrates.

ADDITIONAL_TOOL_LIBS = -lone -lsimple
Variable: ADDITIONAL_GUI_LIBS

ADDITIONAL_GUI_LIBS is the list of additional libraries that the linker will use when linking applications, see application.make. ADDITIONAL_GUI_LIBS is placed before all of the GUI, Foundation, and system libraries so that they will be searched first when linking. The additional libraries should be specified as ‘-l’ flags to the linker as the following example illustrates.

ADDITIONAL_GUI_LIBS = -lMiscGui
Variable: ADDITIONAL_INSTALL_DIRS

ADDITIONAL_INSTALL_DIRS is the list of additional directories that should be created when the Makefile Package installs the file for the project. These directories are only one that the project needs to be created but that the Makefile Package does not automatically create. The directories should be absolute paths but use the GNUSTEP_LIBRARY variable and other Makefile Package define variables, see Directory Paths, so that the directories get created in the appropriate place relative to the other file installed for the project. The following example illustrates how two additional directories can be created during installation.

ADDITIONAL_INSTALL_DIRS = $(GNUSTEP_RESOURCES)/MyProject
Variable: LIBRARIES_DEPEND_UPON

LIBRARIES_DEPEND_UPON is the set of libraries that the shared library depends upon, see library.make for more information about building shared libraries; this variable is only relevant for library project types. On some platforms when a shared library is built, any libraries which the object code in the shared library depends upon must be linked in the generation of the shared library. This is similar to the process of linking an executable file like a command line tool or Objective-C program except that the result is a shared library. Libraries specified with LIBRARIES_DEPEND_UPON should be listed as ‘-l’ flags to the linker; when possible use variables defined by the Makefile Package to specify GUI, Foundation, or system libraries; like GUI_LIBS, FND_LIBS, OBJC_LIBS, or SYSTEM_LIBS. LIBRARIES_DEPEND_UPON is independent of ADDITIONAL_OBJC_LIBS, ADDITIONAL_TOOL_LIBS, and ADDITIONAL_GUI_LIBS, so any libraries specified there may need to be specified with LIBRARIES_DEPEND_UPON. The following example illustrates the use of LIBRARIES_DEPEND_UPON for a shared library that is depend upon the Foundation, ObjC, system libraries and an additional user library.

LIBRARIES_DEPEND_UPON = -lsimple $(FND_LIBS) $(OBJC_LIBS) $(SYSTEM_LIBS)

Next: , Previous: , Up: Top   [Contents]