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