~ubuntu-branches/ubuntu/edgy/sope/edgy

« back to all changes in this revision

Viewing changes to gnustep-make/Instance/application.make

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Ley
  • Date: 2005-08-19 16:53:31 UTC
  • Revision ID: james.westby@ubuntu.com-20050819165331-hs683wz1osm708pw
Tags: upstream-4.4rc.2
ImportĀ upstreamĀ versionĀ 4.4rc.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#   -*-makefile-*-
 
2
#   application.make
 
3
#
 
4
#   Instance Makefile rules to build GNUstep-based applications.
 
5
#
 
6
#   Copyright (C) 1997, 2001, 2002 Free Software Foundation, Inc.
 
7
#
 
8
#   Author:  Nicola Pero <nicola@brainstorm.co.uk>
 
9
#   Author:  Ovidiu Predescu <ovidiu@net-community.com>
 
10
#   Based on the original version by Scott Christley.
 
11
#
 
12
#   This file is part of the GNUstep Makefile Package.
 
13
#
 
14
#   This library is free software; you can redistribute it and/or
 
15
#   modify it under the terms of the GNU General Public License
 
16
#   as published by the Free Software Foundation; either version 2
 
17
#   of the License, or (at your option) any later version.
 
18
#   
 
19
#   You should have received a copy of the GNU General Public
 
20
#   License along with this library; see the file COPYING.LIB.
 
21
#   If not, write to the Free Software Foundation,
 
22
#   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
23
 
 
24
#
 
25
# Include in the common makefile rules
 
26
#
 
27
ifeq ($(RULES_MAKE_LOADED),)
 
28
  include $(GNUSTEP_MAKEFILES)/rules.make
 
29
endif
 
30
 
 
31
#
 
32
# The name of the application is in the APP_NAME variable.
 
33
# The list of application resource directories is in xxx_RESOURCE_DIRS
 
34
# The list of application resource files is in xxx_RESOURCE_FILES
 
35
# The list of localized resource files is in xxx_LOCALIZED_RESOURCE_FILES
 
36
# The list of supported languages is in xxx_LANGUAGES
 
37
# The name of the application icon (if any) is in xxx_APPLICATION_ICON
 
38
# The name of the app class is xxx_PRINCIPAL_CLASS (defaults to NSApplication).
 
39
# The name of a file containing info.plist entries to be inserted into
 
40
# Info-gnustep.plist (if any) is xxxInfo.plist
 
41
# where xxx is the application name
 
42
#
 
43
 
 
44
.PHONY: internal-app-all_ \
 
45
        internal-app-install_ \
 
46
        internal-app-uninstall_ \
 
47
        internal-app-copy_into_dir \
 
48
        internal-application-build-template
 
49
 
 
50
#
 
51
# Determine where to install.  By default, install into GNUSTEP_APPS.
 
52
#
 
53
ifneq ($($(GNUSTEP_INSTANCE)_INSTALL_DIR),)
 
54
  APP_INSTALL_DIR = $($(GNUSTEP_INSTANCE)_INSTALL_DIR)
 
55
endif
 
56
 
 
57
ifeq ($(APP_INSTALL_DIR),)
 
58
  APP_INSTALL_DIR = $(GNUSTEP_APPS)
 
59
endif
 
60
 
 
61
ALL_GUI_LIBS =                                                               \
 
62
    $(shell $(WHICH_LIB_SCRIPT)                                              \
 
63
     $(ALL_LIB_DIRS)                                                         \
 
64
     $(ADDITIONAL_GUI_LIBS) $(AUXILIARY_GUI_LIBS) $(GUI_LIBS)                \
 
65
     $(BACKEND_LIBS) $(ADDITIONAL_TOOL_LIBS) $(AUXILIARY_TOOL_LIBS)          \
 
66
     $(FND_LIBS) $(ADDITIONAL_OBJC_LIBS) $(AUXILIARY_OBJC_LIBS) $(OBJC_LIBS) \
 
67
     $(SYSTEM_LIBS) $(TARGET_SYSTEM_LIBS)                                    \
 
68
        debug=$(debug) profile=$(profile) shared=$(shared)                   \
 
69
        libext=$(LIBEXT) shared_libext=$(SHARED_LIBEXT))
 
70
 
 
71
APP_DIR_NAME = $(GNUSTEP_INSTANCE:=.$(APP_EXTENSION))
 
72
APP_DIR = $(GNUSTEP_BUILD_DIR)/$(APP_DIR_NAME)
 
73
 
 
74
#
 
75
# Now include the standard resource-bundle routines from Shared/bundle.make
 
76
#
 
77
 
 
78
ifneq ($(FOUNDATION_LIB), apple)
 
79
  # GNUstep bundle
 
80
  GNUSTEP_SHARED_BUNDLE_RESOURCE_PATH = $(APP_DIR)/Resources
 
81
  APP_INFO_PLIST_FILE = $(APP_DIR)/Resources/Info-gnustep.plist
 
82
else
 
83
  # OSX bundle
 
84
  GNUSTEP_SHARED_BUNDLE_RESOURCE_PATH = $(APP_DIR)/Contents/Resources
 
85
  APP_INFO_PLIST_FILE = $(APP_DIR)/Contents/Info.plist
 
86
endif
 
87
GNUSTEP_SHARED_BUNDLE_MAIN_PATH = $(APP_DIR_NAME)
 
88
GNUSTEP_SHARED_BUNDLE_INSTALL_DIR = $(APP_INSTALL_DIR)
 
89
include $(GNUSTEP_MAKEFILES)/Instance/Shared/bundle.make
 
90
 
 
91
ifneq ($(FOUNDATION_LIB), apple)
 
92
APP_FILE_NAME = $(APP_DIR_NAME)/$(GNUSTEP_TARGET_LDIR)/$(GNUSTEP_INSTANCE)$(EXEEXT)
 
93
else
 
94
APP_FILE_NAME = $(APP_DIR_NAME)/Contents/MacOS/$(GNUSTEP_INSTANCE)$(EXEEXT)
 
95
endif
 
96
 
 
97
APP_FILE = $(GNUSTEP_BUILD_DIR)/$(APP_FILE_NAME)
 
98
 
 
99
 
 
100
#
 
101
# Internal targets
 
102
#
 
103
 
 
104
$(APP_FILE): $(OBJ_FILES_TO_LINK)
 
105
        $(ECHO_LINKING)$(LD) $(ALL_LDFLAGS) -o $(LDOUT)$@ $(OBJ_FILES_TO_LINK)\
 
106
              $(ALL_GUI_LIBS)$(END_ECHO)
 
107
ifneq ($(FOUNDATION_LIB), apple)
 
108
        $(ECHO_NOTHING)$(TRANSFORM_PATHS_SCRIPT) $(subst -L,,$(ALL_LIB_DIRS)) \
 
109
                >$(APP_DIR)/$(GNUSTEP_TARGET_LDIR)/library_paths.openapp$(END_ECHO)
 
110
endif
 
111
 
 
112
#
 
113
# Compilation targets
 
114
#
 
115
 
 
116
ifeq ($(FOUNDATION_LIB), apple)
 
117
internal-app-all_:: $(GNUSTEP_OBJ_DIR) \
 
118
                    $(APP_DIR)/Contents/MacOS \
 
119
                    $(APP_FILE) \
 
120
                    shared-instance-bundle-all \
 
121
                    $(APP_INFO_PLIST_FILE)
 
122
 
 
123
$(APP_DIR)/Contents/MacOS:
 
124
        $(ECHO_CREATING)$(MKDIRS) $@$(END_ECHO)
 
125
 
 
126
else
 
127
 
 
128
internal-app-all_:: $(GNUSTEP_OBJ_DIR) \
 
129
                    $(APP_DIR)/$(GNUSTEP_TARGET_LDIR) \
 
130
                    $(APP_FILE) \
 
131
                    internal-application-build-template \
 
132
                    $(APP_DIR)/Resources \
 
133
                    $(APP_INFO_PLIST_FILE) \
 
134
                    $(APP_DIR)/Resources/$(GNUSTEP_INSTANCE).desktop \
 
135
                    shared-instance-bundle-all
 
136
 
 
137
$(APP_DIR)/$(GNUSTEP_TARGET_LDIR):
 
138
        $(ECHO_CREATING)$(MKDIRS) $@$(END_ECHO)
 
139
 
 
140
ifeq ($(GNUSTEP_FLATTENED),)
 
141
internal-application-build-template: $(APP_DIR)/$(GNUSTEP_INSTANCE)
 
142
 
 
143
$(APP_DIR)/$(GNUSTEP_INSTANCE):
 
144
        $(ECHO_NOTHING)cp $(GNUSTEP_MAKEFILES)/executable.template \
 
145
           $(APP_DIR)/$(GNUSTEP_INSTANCE); \
 
146
        chmod a+x $(APP_DIR)/$(GNUSTEP_INSTANCE)$(END_ECHO)
 
147
else
 
148
internal-application-build-template:
 
149
 
 
150
endif
 
151
endif
 
152
 
 
153
PRINCIPAL_CLASS = $(strip $($(GNUSTEP_INSTANCE)_PRINCIPAL_CLASS))
 
154
 
 
155
ifeq ($(PRINCIPAL_CLASS),)
 
156
  PRINCIPAL_CLASS = NSApplication
 
157
endif
 
158
 
 
159
APPLICATION_ICON = $($(GNUSTEP_INSTANCE)_APPLICATION_ICON)
 
160
 
 
161
MAIN_MODEL_FILE = $(strip $(subst .gmodel,,$(subst .gorm,,$(subst .nib,,$($(GNUSTEP_INSTANCE)_MAIN_MODEL_FILE)))))
 
162
 
 
163
MAIN_MARKUP_FILE = $(strip $(subst .gsmarkup,,$($(GNUSTEP_INSTANCE)_MAIN_MARKUP_FILE)))
 
164
 
 
165
# We must recreate Info.plist if PRINCIPAL_CLASS and/or
 
166
# APPLICATION_ICON and/or MAIN_MODEL_FILE and/or MAIN_MARKUP_FILE has
 
167
# changed since last time we built Info.plist.  We use
 
168
# stamp-string.make, which will store the variables in a stamp file
 
169
# inside GNUSTEP_STAMP_DIR, and rebuild Info.plist iff
 
170
# GNUSTEP_STAMP_STRING changes.
 
171
GNUSTEP_STAMP_STRING = $(PRINCIPAL_CLASS)-$(APPLICATION_ICON)-$(MAIN_MODEL_FILE)-$(MAIN_MARKUP_FILE)
 
172
 
 
173
ifneq ($(FOUNDATION_LIB),apple)
 
174
GNUSTEP_STAMP_DIR = $(APP_DIR)
 
175
 
 
176
# Only for efficiency
 
177
$(GNUSTEP_STAMP_DIR): $(APP_DIR)/$(GNUSTEP_TARGET_LDIR)
 
178
else
 
179
# Everything goes in $(APP_DIR)/Contents on Apple
 
180
GNUSTEP_STAMP_DIR = $(APP_DIR)/Contents
 
181
endif
 
182
 
 
183
include $(GNUSTEP_MAKEFILES)/Instance/Shared/stamp-string.make
 
184
 
 
185
# FIXME: Missing dependency on $(GNUSTEP_INSTANCE)Info.plist files
 
186
 
 
187
# You can have a single xxxInfo.plist for both GNUstep and Apple.
 
188
 
 
189
# Often enough, you can just put in it all fields required by both
 
190
# GNUstep and Apple; if there is a conflict, you can add
 
191
# xxx_PREPROCESS_INFO_PLIST = yes to your GNUmakefile, and provide a
 
192
# xxxInfo.cplist (please note the suffix!) - that file is
 
193
# automatically run through the C preprocessor to generate a
 
194
# xxxInfo.plist file from it.  The preprocessor will define GNUSTEP
 
195
# when using gnustep-base, APPLE when using Apple FoundationKit, NEXT
 
196
# when using NeXT/OPENStep FoundationKit, and UNKNOWN when using
 
197
# something else, so you can use
 
198
# #ifdef GNUSTEP
 
199
#   ... some plist code for GNUstep ...
 
200
# #else
 
201
#   ... some plist code for Apple ...
 
202
# #endif
 
203
# to have your .cplist use different code for each.
 
204
#
 
205
 
 
206
# The following is really a hack, but very elegant.  Our problem is
 
207
# that we'd like to always depend on xxxInfo.plist if it's there, and
 
208
# not depend on it if it's not there - but we don't have a solution to
 
209
# this problem at the moment, so we don't depend on it.  Adding
 
210
# xxx_PREPROCESS_INFO_PLIST = yes at the moment just turns on the
 
211
# dependency on xxxInfo.plist, which is then built from xxxInfo.cplist
 
212
# using the %.plist: %.cplist rules.
 
213
ifeq ($($(GNUSTEP_INSTANCE)_PREPROCESS_INFO_PLIST), yes)
 
214
  GNUSTEP_PLIST_DEPEND = $(GNUSTEP_INSTANCE)Info.plist
 
215
else
 
216
  GNUSTEP_PLIST_DEPEND =
 
217
endif
 
218
 
 
219
# On Apple we assume that xxxInfo.plist has a '{' (and nothing else)
 
220
# on the first line, and the rest of the file is a plain property list
 
221
# dictionary.  You must make sure your xxxInfo.plist is in this format
 
222
# to use it on Apple.
 
223
 
 
224
# The problem is, we need to add the automatically generated entries
 
225
# to this custom dictionary on Apple - to do that, we generate '{'
 
226
# followed by the custom entries, followed by xxxInfo.plist (with the
 
227
# first line removed), or by '}'.  NB: "sed '1d' filename" prints out
 
228
# filename, except the first line.
 
229
 
 
230
# On GNUstep we use plmerge which is much slower, but should probably
 
231
# be safer, because as soon as xxxInfo.plist is in plist format, it
 
232
# should always work (even if the first line is not just a '{' and
 
233
# nothing else).
 
234
 
 
235
ifeq ($(FOUNDATION_LIB), apple)
 
236
$(APP_INFO_PLIST_FILE): $(GNUSTEP_STAMP_DEPEND) $(GNUSTEP_PLIST_DEPEND)
 
237
        $(ECHO_CREATING)(echo "{"; echo '  NOTE = "Automatically generated, do not edit!";'; \
 
238
          echo "  NSExecutable = \"$(GNUSTEP_INSTANCE)\";"; \
 
239
          echo "  NSMainNibFile = \"$(MAIN_MODEL_FILE)\";"; \
 
240
          echo "  GSMainMarkupFile = \"$(MAIN_MARKUP_FILE)\";"; \
 
241
          if [ "$(APPLICATION_ICON)" != "" ]; then \
 
242
            echo "  CFBundleIconFile = \"$(APPLICATION_ICON)\";"; \
 
243
          fi; \
 
244
          echo "  NSPrincipalClass = \"$(PRINCIPAL_CLASS)\";"; \
 
245
          if [ -r "$(GNUSTEP_INSTANCE)Info.plist" ]; then \
 
246
            sed '1d' "$(GNUSTEP_INSTANCE)Info.plist"; \
 
247
          else \
 
248
            echo "}"; \
 
249
          fi) > $@$(END_ECHO)
 
250
else
 
251
 
 
252
$(APP_INFO_PLIST_FILE): $(GNUSTEP_STAMP_DEPEND) $(GNUSTEP_PLIST_DEPEND)
 
253
        $(ECHO_CREATING)(echo "{"; echo '  NOTE = "Automatically generated, do not edit!";'; \
 
254
          echo "  NSExecutable = \"$(GNUSTEP_INSTANCE)\";"; \
 
255
          echo "  NSMainNibFile = \"$(MAIN_MODEL_FILE)\";"; \
 
256
          echo "  GSMainMarkupFile = \"$(MAIN_MARKUP_FILE)\";"; \
 
257
          if [ "$(APPLICATION_ICON)" != "" ]; then \
 
258
            echo "  NSIcon = \"$(APPLICATION_ICON)\";"; \
 
259
          fi; \
 
260
          echo "  NSPrincipalClass = \"$(PRINCIPAL_CLASS)\";"; \
 
261
          echo "}") >$@$(END_ECHO)
 
262
         -$(ECHO_NOTHING)if [ -r "$(GNUSTEP_INSTANCE)Info.plist" ]; then \
 
263
           plmerge $@ "$(GNUSTEP_INSTANCE)Info.plist"; \
 
264
          fi$(END_ECHO)
 
265
endif
 
266
 
 
267
$(APP_DIR)/Resources/$(GNUSTEP_INSTANCE).desktop: \
 
268
                $(APP_DIR)/Resources/Info-gnustep.plist
 
269
        $(ECHO_CREATING)pl2link $^ $(APP_DIR)/Resources/$(GNUSTEP_INSTANCE).desktop$(END_ECHO)
 
270
 
 
271
 
 
272
internal-app-copy_into_dir:: shared-instance-bundle-copy_into_dir
 
273
 
 
274
# install/uninstall targets
 
275
 
 
276
$(APP_INSTALL_DIR):
 
277
        $(ECHO_CREATING)$(MKINSTALLDIRS) $@$(END_ECHO)
 
278
 
 
279
internal-app-install_:: shared-instance-bundle-install
 
280
ifeq ($(strip),yes)
 
281
        $(ECHO_STRIPPING)$(STRIP) $(APP_INSTALL_DIR)/$(APP_FILE_NAME)$(END_ECHO)
 
282
endif
 
283
 
 
284
internal-app-uninstall_:: shared-instance-bundle-uninstall
 
285
 
 
286
include $(GNUSTEP_MAKEFILES)/Instance/Shared/strings.make