4
# Instance Makefile rules to build GNUstep-based applications.
6
# Copyright (C) 1997, 2001, 2002 Free Software Foundation, Inc.
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.
12
# This file is part of the GNUstep Makefile Package.
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.
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.
25
# Include in the common makefile rules
27
ifeq ($(RULES_MAKE_LOADED),)
28
include $(GNUSTEP_MAKEFILES)/rules.make
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
44
.PHONY: internal-app-all_ \
45
internal-app-install_ \
46
internal-app-uninstall_ \
47
internal-app-copy_into_dir \
48
internal-application-build-template
51
# Determine where to install. By default, install into GNUSTEP_APPS.
53
ifneq ($($(GNUSTEP_INSTANCE)_INSTALL_DIR),)
54
APP_INSTALL_DIR = $($(GNUSTEP_INSTANCE)_INSTALL_DIR)
57
ifeq ($(APP_INSTALL_DIR),)
58
APP_INSTALL_DIR = $(GNUSTEP_APPS)
62
$(shell $(WHICH_LIB_SCRIPT) \
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))
71
APP_DIR_NAME = $(GNUSTEP_INSTANCE:=.$(APP_EXTENSION))
72
APP_DIR = $(GNUSTEP_BUILD_DIR)/$(APP_DIR_NAME)
75
# Now include the standard resource-bundle routines from Shared/bundle.make
78
ifneq ($(FOUNDATION_LIB), apple)
80
GNUSTEP_SHARED_BUNDLE_RESOURCE_PATH = $(APP_DIR)/Resources
81
APP_INFO_PLIST_FILE = $(APP_DIR)/Resources/Info-gnustep.plist
84
GNUSTEP_SHARED_BUNDLE_RESOURCE_PATH = $(APP_DIR)/Contents/Resources
85
APP_INFO_PLIST_FILE = $(APP_DIR)/Contents/Info.plist
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
91
ifneq ($(FOUNDATION_LIB), apple)
92
APP_FILE_NAME = $(APP_DIR_NAME)/$(GNUSTEP_TARGET_LDIR)/$(GNUSTEP_INSTANCE)$(EXEEXT)
94
APP_FILE_NAME = $(APP_DIR_NAME)/Contents/MacOS/$(GNUSTEP_INSTANCE)$(EXEEXT)
97
APP_FILE = $(GNUSTEP_BUILD_DIR)/$(APP_FILE_NAME)
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)
113
# Compilation targets
116
ifeq ($(FOUNDATION_LIB), apple)
117
internal-app-all_:: $(GNUSTEP_OBJ_DIR) \
118
$(APP_DIR)/Contents/MacOS \
120
shared-instance-bundle-all \
121
$(APP_INFO_PLIST_FILE)
123
$(APP_DIR)/Contents/MacOS:
124
$(ECHO_CREATING)$(MKDIRS) $@$(END_ECHO)
128
internal-app-all_:: $(GNUSTEP_OBJ_DIR) \
129
$(APP_DIR)/$(GNUSTEP_TARGET_LDIR) \
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
137
$(APP_DIR)/$(GNUSTEP_TARGET_LDIR):
138
$(ECHO_CREATING)$(MKDIRS) $@$(END_ECHO)
140
ifeq ($(GNUSTEP_FLATTENED),)
141
internal-application-build-template: $(APP_DIR)/$(GNUSTEP_INSTANCE)
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)
148
internal-application-build-template:
153
PRINCIPAL_CLASS = $(strip $($(GNUSTEP_INSTANCE)_PRINCIPAL_CLASS))
155
ifeq ($(PRINCIPAL_CLASS),)
156
PRINCIPAL_CLASS = NSApplication
159
APPLICATION_ICON = $($(GNUSTEP_INSTANCE)_APPLICATION_ICON)
161
MAIN_MODEL_FILE = $(strip $(subst .gmodel,,$(subst .gorm,,$(subst .nib,,$($(GNUSTEP_INSTANCE)_MAIN_MODEL_FILE)))))
163
MAIN_MARKUP_FILE = $(strip $(subst .gsmarkup,,$($(GNUSTEP_INSTANCE)_MAIN_MARKUP_FILE)))
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)
173
ifneq ($(FOUNDATION_LIB),apple)
174
GNUSTEP_STAMP_DIR = $(APP_DIR)
176
# Only for efficiency
177
$(GNUSTEP_STAMP_DIR): $(APP_DIR)/$(GNUSTEP_TARGET_LDIR)
179
# Everything goes in $(APP_DIR)/Contents on Apple
180
GNUSTEP_STAMP_DIR = $(APP_DIR)/Contents
183
include $(GNUSTEP_MAKEFILES)/Instance/Shared/stamp-string.make
185
# FIXME: Missing dependency on $(GNUSTEP_INSTANCE)Info.plist files
187
# You can have a single xxxInfo.plist for both GNUstep and Apple.
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
199
# ... some plist code for GNUstep ...
201
# ... some plist code for Apple ...
203
# to have your .cplist use different code for each.
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
216
GNUSTEP_PLIST_DEPEND =
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.
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.
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
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)\";"; \
244
echo " NSPrincipalClass = \"$(PRINCIPAL_CLASS)\";"; \
245
if [ -r "$(GNUSTEP_INSTANCE)Info.plist" ]; then \
246
sed '1d' "$(GNUSTEP_INSTANCE)Info.plist"; \
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)\";"; \
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"; \
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)
272
internal-app-copy_into_dir:: shared-instance-bundle-copy_into_dir
274
# install/uninstall targets
277
$(ECHO_CREATING)$(MKINSTALLDIRS) $@$(END_ECHO)
279
internal-app-install_:: shared-instance-bundle-install
281
$(ECHO_STRIPPING)$(STRIP) $(APP_INSTALL_DIR)/$(APP_FILE_NAME)$(END_ECHO)
284
internal-app-uninstall_:: shared-instance-bundle-uninstall
286
include $(GNUSTEP_MAKEFILES)/Instance/Shared/strings.make