1@c    GNUstep AppKit Guide
2@c
3@c    Copyright (c)  2005-2006  Christopher Armstrong.
4@c
5@c    Permission is granted to copy, distribute and/or modify this document
6@c    under the terms of the GNU Free Documentation License, Version 1.2
7@c    with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
8@c    A copy of the license is included in the section entitled "GNU
9@c    Free Documentation License".
10@c
11@c This documentation is provided on an "AS IS" BASIS, WITHOUT WARRANTY
12@c OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED
13@c TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
14@c PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND USEFULNESS
15@c OF THE DOCUMENTATION IS WITH YOU (THE LICENSEE). IN NO EVENT WILL THE COPYRIGHT
16@c HOLDERS BE LIABLE FOR DAMAGES, INCLUDING ANY DIRECT, INDIRECT,
17@c SPECIAL, GENERAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF
18@c THE USE OR INABILITY TO USE THIS DOCUMENTATION (INCLUDING BUT NOT
19@c LIMITED TO LOSS OF DATA, USE, OR PROFITS; PROCUREMENT OF SUBSTITUTE
20@c GOODS AND SERVICES; OR BUSINESS INTERUPTION) HOWEVER CAUSED, EVEN
21@c IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
23@node applicationmakefiles, interfacefiles, gnustepapplications, Top
24@chapter Application Makefiles
25@anchor{Application Makefiles}
26@cindex makefiles
27
28Application makefiles are very similiar to those used to build Tools and Objective-C programmes, but allow extra specifications to build application wrappers and include their resource files. We assume you are already familiar with the GNUstep Makefile system.
29
30Below is a generic, but complete application makefile, followed by an explanation of the various parameters.
31
32@example
33include $(GNUSTEP_MAKEFILES)/common.make
34
35APP_NAME = ExampleApplication
36PACKAGE_NAME = ExampleApplication
37VERSION = 1.0
38
39ExampleApplication_OBJC_FILES = main.m AppController.m \
40  ExampleClass.m
41
42ExampleApplication_C_FILES = regexp.c fun.c
43
44ExampleApplication_OBJC_LIBS = -lLibNumberOne -lPDFKit -lFunKit
45ExampleApplication_RESOURCE_FILES = \
46  ExampleApplication.gorm \
47  Info-gnustep.plist
48
49-include GNUmakefile.preamble
50include $(GNUSTEP_MAKEFILES)/application.make
51-include GNUmakefile.postamble
52
53@end example
54
55@file{common.make} and @file{application.make} are necessary to build an application, and need to be at the beginning and end respectively to the Makefile to operate properly. The @file{GNUmakefile.preamble} and @file{GNUmakefile.postamble} are optional, and permit you to define extra rules for building your application. You can include those lines without those files containing anything. Templates for those files also exist with the source code for gnustep-gui, which can simply be copied into your project and modified accordingly.
56
57The table below describes the makefile variables that you can set to control the output of the make process. Note that @var{appname} refers to the application name that you set with @code{APP_NAME}. It is case sensistive and so are file names. Also, most of the variables listed below are optional if you wish to get a program to compile, but it is recommend you make use of them where appropriate. Where variables ask for flags and compiler options, they should be in the format that @command{gcc} expects, as it is the only compiler currently used with GNUstep. Many variables also take more than one parameter. They are usually separated by a space, and line breaks with a backslash. Please refer to the @cite{GNUstep Makefile Manual} for more details.
58
59@cindex makefiles, components
60@table @code
61
62@item APP_NAME
63[Required] This is the name of your application, and will be used to generate the name of your application wrapper.
64
65@item PACKAGE_NAME
66This is used to generate a rpm or deb package for distribution of your application. See the @cite{GNUstep Makefile Manual} for more details.
67
68@item VERSION
69A version number for your application.
70
71@item @var{appname}_OBJC_FILES
72[Required] Replacing @var{appname} with the name of your application, you list the Objective-C files (.m), separated by a space. As shown above, you can split it across one or more lines by placing a slash at the end of the line to indicate a split.
73
74@item @var{appname}_APPLICATION_ICON
75[Optional] You can place the name of the image file that will be used as your application icon here.
76
77@item @var{appname}_MAIN_MODEL_FILE
78[Recommended] Put the name of your interface file (@file{.gorm}) here. It will then be placed in the property list of your application.
79
80@item @var{appname}_PRINCIPAL_CLASS
81[Optional] If you subclass @code{NSApplication} with your own application class, you should place it's name here. By default, GNUstep uses @code{NSApplication} as the application class.
82
83@item @var{appname}_C_FILES
84[Optional] This is where you list the C source code files (.c) to be compiled into your programme. It takes the same form as @code{@var{appname}_OBJC_FILES}.
85
86@item @var{appname}_CC_FILES
87[Optional] This is where you list your C++ files (*.cpp, *.cc) to be compiled into your programme. It takes the same form as @code{@var{appname}_OBJC_FILES}.
88
89@item @var{appname}_OBJCC_FILES
90[Optional] This is where you list your Objective-C++ files (*.mm) to be compiled into your programme. It takes the same form as the @code{@var{appname}_OBJC_FILES}.@footnote{You will need gcc 4.1 or higher to compile Objective-C++ programmes. This feature of the gcc compiler is quite new and has not been well tested.}
91
92@item @var{appname}_RESOURCE_FILES
93[Recommended] Here you list the @dfn{resource files} that are to be included with your application, including your application property list, interface file(s) and other images, data, etc. You can also list directories here, which should be added recursively (e.g. @file{.gorm} files are actually a directory containing three files, used to describe your interface).
94
95@item @var{appname}_RESOURCE_DIRS
96[Optional] Here you can list directories that will be copied into your application wrapper as resources.
97
98@item @var{appname}_OBJC_LIBS
99Here you list the names of the libraries you need your application to link against. Each one is prefixed by '-l' e.g. @code{-lMyLib}, separated by a space. You do not need to list the gnustep-gui, gnustep-base and Objective-C runtime, as these are included for you.
100
101@item @var{appname}_C_FLAGS
102@itemx @var{appname}_CC_FLAGS
103@itemx @var{appname}_OBJC_FLAGS
104@itemx @var{appname}_OBJCC_FLAGS
105Here you specify the flags to be passed to the compiler when processing this file type. These included warning flags and macro overrides.
106
107@end table
108
109