2002-02-09 13:49:56 +00:00
|
|
|
#
|
|
|
|
# Instace/bundle.make
|
|
|
|
#
|
|
|
|
# Instance makefile rules to build GNUstep-based bundles.
|
|
|
|
#
|
2002-05-23 11:27:14 +00:00
|
|
|
# Copyright (C) 1997, 2001, 2002 Free Software Foundation, Inc.
|
2002-02-09 13:49:56 +00:00
|
|
|
#
|
|
|
|
# Author: Scott Christley <scottc@net-community.com>
|
|
|
|
# Author: Ovidiu Predescu <ovidiu@net-community.com>
|
|
|
|
# Author: Nicola Pero <nicola@brainstorm.co.uk>
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
ifeq ($(RULES_MAKE_LOADED),)
|
|
|
|
include $(GNUSTEP_MAKEFILES)/rules.make
|
|
|
|
endif
|
|
|
|
|
|
|
|
include $(GNUSTEP_MAKEFILES)/Instance/Shared/headers.make
|
|
|
|
|
|
|
|
# The name of the bundle is in the BUNDLE_NAME variable.
|
|
|
|
# The list of bundle resource file are in xxx_RESOURCE_FILES
|
|
|
|
# The list of localized bundle resource files is in
|
|
|
|
# xxx_LOCALIZED_RESOURCE_FILES
|
|
|
|
# The list of languages the bundle supports is in xxx_LANGUAGES
|
|
|
|
# The list of bundle resource directories are in xxx_RESOURCE_DIRS
|
|
|
|
# The name of the principal class is xxx_PRINCIPAL_CLASS
|
|
|
|
# The header files are in xxx_HEADER_FILES
|
|
|
|
# The directory where the header files are located is xxx_HEADER_FILES_DIR
|
|
|
|
# The directory where to install the header files inside the library
|
|
|
|
# installation directory is xxx_HEADER_FILES_INSTALL_DIR
|
|
|
|
# where xxx is the bundle name
|
|
|
|
#
|
|
|
|
|
2002-03-19 13:06:56 +00:00
|
|
|
.PHONY: internal-bundle-all_ \
|
|
|
|
internal-bundle-install_ \
|
|
|
|
internal-bundle-uninstall_ \
|
2002-02-09 13:49:56 +00:00
|
|
|
build-bundle-dir \
|
|
|
|
build-bundle \
|
|
|
|
build-macosx-bundle \
|
|
|
|
bundle-resource-files \
|
|
|
|
bundle-localized-resource-files
|
|
|
|
|
2002-05-23 11:27:14 +00:00
|
|
|
# In some cases, a bundle without any object file in it is useful - to
|
|
|
|
# just store some resources which can be loaded comfortably using the
|
|
|
|
# gnustep-base NSBundle API. In this case - which we detect because
|
|
|
|
# OBJ_FILES_TO_LINK is empty - we skip any code related to linking etc
|
|
|
|
ifneq ($(OBJ_FILES_TO_LINK),)
|
2002-04-18 10:02:52 +00:00
|
|
|
# NB: we don't need to link the bundle against the system libraries,
|
|
|
|
# which are already linked in the application ... linking them both in
|
|
|
|
# the bundle and in the application would just make things more
|
|
|
|
# difficult when the bundle is loaded (eg, if the application and the
|
|
|
|
# bundle end up being linked to different versions of the system
|
|
|
|
# libraries ...)
|
|
|
|
|
2002-04-21 12:56:55 +00:00
|
|
|
# On windows, this is unfortunately required.
|
|
|
|
ifeq ($(WITH_DLL),yes)
|
|
|
|
BUNDLE_LIBS += $(ADDITIONAL_GUI_LIBS) $(AUXILIARY_GUI_LIBS) $(BACKEND_LIBS) \
|
|
|
|
$(GUI_LIBS) $(ADDITIONAL_TOOL_LIBS) $(AUXILIARY_TOOL_LIBS) \
|
|
|
|
$(FND_LIBS) $(ADDITIONAL_OBJC_LIBS) $(AUXILIARY_OBJC_LIBS) $(OBJC_LIBS) \
|
|
|
|
$(SYSTEM_LIBS) $(TARGET_SYSTEM_LIBS)
|
|
|
|
endif
|
2002-02-09 13:49:56 +00:00
|
|
|
|
|
|
|
ALL_BUNDLE_LIBS = \
|
|
|
|
$(shell $(WHICH_LIB_SCRIPT) \
|
|
|
|
$(ALL_LIB_DIRS) \
|
|
|
|
$(BUNDLE_LIBS) \
|
|
|
|
debug=$(debug) profile=$(profile) shared=$(shared) \
|
|
|
|
libext=$(LIBEXT) shared_libext=$(SHARED_LIBEXT))
|
|
|
|
|
|
|
|
ifeq ($(WITH_DLL),yes)
|
|
|
|
BUNDLE_OBJ_EXT = $(DLL_LIBEXT)
|
2002-04-18 10:02:52 +00:00
|
|
|
endif
|
2002-02-09 13:49:56 +00:00
|
|
|
|
2002-05-23 11:27:14 +00:00
|
|
|
endif # OBJ_FILES_TO_LINK
|
|
|
|
|
2002-03-19 13:06:56 +00:00
|
|
|
internal-bundle-all_:: $(GNUSTEP_OBJ_DIR) \
|
|
|
|
build-bundle \
|
|
|
|
build-macosx-bundle
|
2002-02-09 13:49:56 +00:00
|
|
|
|
2002-02-28 14:12:08 +00:00
|
|
|
BUNDLE_DIR_NAME = $(GNUSTEP_INSTANCE:=$(BUNDLE_EXTENSION))
|
|
|
|
|
2002-03-05 14:27:06 +00:00
|
|
|
GNUSTEP_SHARED_INSTANCE_BUNDLE_RESOURCE_PATH = $(BUNDLE_DIR_NAME)/Resources
|
2002-02-28 14:12:08 +00:00
|
|
|
include $(GNUSTEP_MAKEFILES)/Instance/Shared/bundle.make
|
|
|
|
|
2002-05-23 11:27:14 +00:00
|
|
|
ifneq ($(OBJ_FILES_TO_LINK),)
|
2002-02-28 14:12:08 +00:00
|
|
|
BUNDLE_FILE = \
|
|
|
|
$(BUNDLE_DIR_NAME)/$(GNUSTEP_TARGET_LDIR)/$(GNUSTEP_INSTANCE)$(BUNDLE_OBJ_EXT)
|
2002-05-23 11:27:14 +00:00
|
|
|
endif
|
2002-02-28 14:12:08 +00:00
|
|
|
|
2002-02-09 13:49:56 +00:00
|
|
|
ifeq ($(BUNDLE_INSTALL_DIR),)
|
2002-03-05 17:17:03 +00:00
|
|
|
BUNDLE_INSTALL_DIR = $(GNUSTEP_BUNDLES)
|
2002-02-09 13:49:56 +00:00
|
|
|
endif
|
|
|
|
|
2002-05-23 11:27:14 +00:00
|
|
|
ifneq ($(OBJ_FILES_TO_LINK),)
|
2002-02-28 14:12:08 +00:00
|
|
|
build-bundle:: $(BUNDLE_DIR_NAME)/$(GNUSTEP_TARGET_LDIR) \
|
|
|
|
$(BUNDLE_FILE) \
|
|
|
|
$(BUNDLE_DIR_NAME)/Resources \
|
|
|
|
$(BUNDLE_DIR_NAME)/Resources/Info.plist \
|
|
|
|
$(BUNDLE_DIR_NAME)/Resources/Info-gnustep.plist \
|
|
|
|
shared-instance-bundle-all
|
2002-02-09 13:49:56 +00:00
|
|
|
|
2002-02-28 14:12:08 +00:00
|
|
|
# The rule to build $(BUNDLE_DIR_NAME)/Resources is already provided
|
|
|
|
# by Instance/Shared/bundle.make
|
2002-02-09 13:49:56 +00:00
|
|
|
|
2002-02-28 14:12:08 +00:00
|
|
|
$(BUNDLE_DIR_NAME)/$(GNUSTEP_TARGET_LDIR):
|
|
|
|
$(MKDIRS) $@
|
2002-02-09 13:49:56 +00:00
|
|
|
|
|
|
|
ifeq ($(WITH_DLL),yes)
|
|
|
|
|
|
|
|
$(BUNDLE_FILE) : $(OBJ_FILES_TO_LINK)
|
2002-06-13 16:14:06 +00:00
|
|
|
$(ECHO_LINKING)$(DLLWRAP) --driver-name $(CC) \
|
2002-02-09 13:49:56 +00:00
|
|
|
-o $(LDOUT)$(BUNDLE_FILE) \
|
|
|
|
$(OBJ_FILES_TO_LINK) \
|
2002-06-13 16:14:06 +00:00
|
|
|
$(ALL_BUNDLE_LIBS)$(END_ECHO)
|
2002-02-09 13:49:56 +00:00
|
|
|
|
|
|
|
else # WITH_DLL
|
|
|
|
|
|
|
|
$(BUNDLE_FILE) : $(OBJ_FILES_TO_LINK)
|
2002-06-13 16:14:06 +00:00
|
|
|
$(ECHO_LINKING)$(BUNDLE_LD) $(BUNDLE_LDFLAGS) $(ALL_LDFLAGS) \
|
2002-02-09 13:49:56 +00:00
|
|
|
-o $(LDOUT)$(BUNDLE_FILE) \
|
|
|
|
$(OBJ_FILES_TO_LINK) \
|
2002-06-13 16:14:06 +00:00
|
|
|
$(ALL_BUNDLE_LIBS)$(END_ECHO)
|
2002-02-09 13:49:56 +00:00
|
|
|
|
|
|
|
endif # WITH_DLL
|
|
|
|
|
2002-02-28 18:30:07 +00:00
|
|
|
PRINCIPAL_CLASS = $(strip $($(GNUSTEP_INSTANCE)_PRINCIPAL_CLASS))
|
|
|
|
|
2002-02-09 13:49:56 +00:00
|
|
|
ifeq ($(PRINCIPAL_CLASS),)
|
2002-02-28 18:30:07 +00:00
|
|
|
PRINCIPAL_CLASS = $(GNUSTEP_INSTANCE)
|
2002-02-09 13:49:56 +00:00
|
|
|
endif
|
|
|
|
|
2002-05-23 11:27:14 +00:00
|
|
|
else
|
|
|
|
# Following code for the case OBJ_FILES_TO_LINK is empty - bundle with
|
|
|
|
# no shared object in it.
|
|
|
|
build-bundle:: $(BUNDLE_DIR_NAME)/Resources \
|
|
|
|
$(BUNDLE_DIR_NAME)/Resources/Info.plist \
|
|
|
|
$(BUNDLE_DIR_NAME)/Resources/Info-gnustep.plist \
|
|
|
|
shared-instance-bundle-all
|
|
|
|
endif # OBJ_FILES_TO_LINK
|
|
|
|
|
2002-02-09 13:49:56 +00:00
|
|
|
# MacOSX bundles
|
|
|
|
|
|
|
|
$(BUNDLE_DIR_NAME)/Contents :
|
2002-06-13 16:14:06 +00:00
|
|
|
@$(MKDIRS) $@
|
2002-02-09 13:49:56 +00:00
|
|
|
|
|
|
|
$(BUNDLE_DIR_NAME)/Contents/Resources : $(BUNDLE_DIR_NAME)/Contents \
|
|
|
|
$(BUNDLE_DIR_NAME)/Resources
|
|
|
|
@(cd $(BUNDLE_DIR_NAME)/Contents; rm -f Resources; \
|
|
|
|
$(LN_S) ../Resources .)
|
|
|
|
|
2002-05-23 11:27:14 +00:00
|
|
|
ifneq ($(OBJ_FILES_TO_LINK),)
|
2002-02-09 13:49:56 +00:00
|
|
|
$(BUNDLE_DIR_NAME)/Contents/Info.plist: $(BUNDLE_DIR_NAME)/Contents
|
|
|
|
@(echo "<?xml version='1.0' encoding='utf-8'?>";\
|
|
|
|
echo "<!DOCTYPE plist SYSTEM 'file://localhost/System/Library/DTDs/PropertyList.dtd'>";\
|
|
|
|
echo "<!-- Automatically generated, do not edit! -->";\
|
|
|
|
echo "<plist version='0.9'>";\
|
|
|
|
echo " <dict>";\
|
|
|
|
echo " <key>CFBundleExecutable</key>";\
|
|
|
|
echo " <string>$(GNUSTEP_TARGET_LDIR)/$(GNUSTEP_INSTANCE)${BUNDLE_OBJ_EXT}</string>";\
|
|
|
|
echo " <key>CFBundleInfoDictionaryVersion</key>";\
|
|
|
|
echo " <string>6.0</string>";\
|
|
|
|
echo " <key>CFBundlePackageType</key>";\
|
|
|
|
echo " <string>BNDL</string>";\
|
|
|
|
echo " <key>NSPrincipalClass</key>";\
|
|
|
|
echo " <string>$(PRINCIPAL_CLASS)</string>";\
|
|
|
|
echo " </dict>";\
|
|
|
|
echo "</plist>";\
|
|
|
|
) >$@
|
2002-05-23 11:27:14 +00:00
|
|
|
else
|
|
|
|
$(BUNDLE_DIR_NAME)/Contents/Info.plist: $(BUNDLE_DIR_NAME)/Contents
|
|
|
|
@(echo "<?xml version='1.0' encoding='utf-8'?>";\
|
|
|
|
echo "<!DOCTYPE plist SYSTEM 'file://localhost/System/Library/DTDs/PropertyList.dtd'>";\
|
|
|
|
echo "<!-- Automatically generated, do not edit! -->";\
|
|
|
|
echo "<plist version='0.9'>";\
|
|
|
|
echo " <dict>";\
|
|
|
|
echo " <key>CFBundleInfoDictionaryVersion</key>";\
|
|
|
|
echo " <string>6.0</string>";\
|
|
|
|
echo " <key>CFBundlePackageType</key>";\
|
|
|
|
echo " <string>BNDL</string>";\
|
|
|
|
echo " </dict>";\
|
|
|
|
echo "</plist>";\
|
|
|
|
) >$@
|
|
|
|
endif
|
2002-02-09 13:49:56 +00:00
|
|
|
|
|
|
|
build-macosx-bundle :: $(BUNDLE_DIR_NAME)/Contents \
|
|
|
|
$(BUNDLE_DIR_NAME)/Contents/Resources \
|
|
|
|
$(BUNDLE_DIR_NAME)/Contents/Info.plist
|
|
|
|
|
2002-03-06 12:25:03 +00:00
|
|
|
MAIN_MODEL_FILE = $(strip $(subst .gmodel,,$(subst .gorm,,$(subst .nib,,$($(GNUSTEP_INSTANCE)_MAIN_MODEL_FILE)))))
|
|
|
|
|
2002-05-23 11:27:14 +00:00
|
|
|
ifneq ($(OBJ_FILES_TO_LINK),)
|
2002-02-09 13:49:56 +00:00
|
|
|
# NeXTstep bundles
|
2002-02-28 14:12:08 +00:00
|
|
|
$(BUNDLE_DIR_NAME)/Resources/Info.plist:
|
2002-02-09 13:49:56 +00:00
|
|
|
@(echo "{"; echo ' NOTE = "Automatically generated, do not edit!";'; \
|
|
|
|
echo " NSExecutable = \"$(GNUSTEP_TARGET_LDIR)/$(GNUSTEP_INSTANCE)${BUNDLE_OBJ_EXT}\";"; \
|
2002-03-06 12:25:03 +00:00
|
|
|
echo " NSMainNibFile = \"$(MAIN_MODEL_FILE)\";"; \
|
2002-02-09 13:49:56 +00:00
|
|
|
echo " NSPrincipalClass = \"$(PRINCIPAL_CLASS)\";"; \
|
|
|
|
echo "}") >$@
|
|
|
|
|
|
|
|
# GNUstep bundles
|
2002-02-28 14:12:08 +00:00
|
|
|
$(BUNDLE_DIR_NAME)/Resources/Info-gnustep.plist:
|
2002-02-09 13:49:56 +00:00
|
|
|
@(echo "{"; echo ' NOTE = "Automatically generated, do not edit!";'; \
|
|
|
|
echo " NSExecutable = \"$(GNUSTEP_INSTANCE)${BUNDLE_OBJ_EXT}\";"; \
|
2002-03-06 12:25:03 +00:00
|
|
|
echo " NSMainNibFile = \"$(MAIN_MODEL_FILE)\";"; \
|
2002-02-09 13:49:56 +00:00
|
|
|
echo " NSPrincipalClass = \"$(PRINCIPAL_CLASS)\";"; \
|
|
|
|
echo "}") >$@
|
2002-06-13 16:14:06 +00:00
|
|
|
@(if [ -r "$(GNUSTEP_INSTANCE)Info.plist" ]; then \
|
2002-02-09 13:49:56 +00:00
|
|
|
plmerge $@ $(GNUSTEP_INSTANCE)Info.plist; \
|
2002-06-13 16:14:06 +00:00
|
|
|
fi)
|
2002-05-23 11:27:14 +00:00
|
|
|
else # following code for when no object file is built
|
|
|
|
# NeXTstep bundles
|
|
|
|
$(BUNDLE_DIR_NAME)/Resources/Info.plist:
|
|
|
|
@(echo "{"; echo ' NOTE = "Automatically generated, do not edit!";'; \
|
|
|
|
echo " NSMainNibFile = \"$(MAIN_MODEL_FILE)\";"; \
|
|
|
|
echo "}") >$@
|
|
|
|
|
|
|
|
# GNUstep bundles
|
|
|
|
$(BUNDLE_DIR_NAME)/Resources/Info-gnustep.plist:
|
|
|
|
@(echo "{"; echo ' NOTE = "Automatically generated, do not edit!";'; \
|
|
|
|
echo " NSMainNibFile = \"$(MAIN_MODEL_FILE)\";"; \
|
|
|
|
echo "}") >$@
|
2002-06-13 16:14:06 +00:00
|
|
|
@(if [ -r "$(GNUSTEP_INSTANCE)Info.plist" ]; then \
|
2002-05-23 11:27:14 +00:00
|
|
|
plmerge $@ $(GNUSTEP_INSTANCE)Info.plist; \
|
2002-06-13 16:14:06 +00:00
|
|
|
fi)
|
2002-05-23 11:27:14 +00:00
|
|
|
endif
|
2002-02-09 13:49:56 +00:00
|
|
|
|
|
|
|
# Comment on the tar options used in the rule below -
|
|
|
|
|
|
|
|
# The h option to tar makes sure the bundle can contain symbolic links
|
|
|
|
# to external files (for example templates), and when you install the
|
|
|
|
# bundle, the symbolic links are replaced with the actual files. The
|
|
|
|
# X option is used because otherwise the -h option would dereference
|
|
|
|
# the Contents/Resources-->Resources symbolic link, and install the
|
|
|
|
# Resources directory twice. Instead, we exclude the symbolic link
|
|
|
|
# from the tar file, then rebuild the link by hand in the installation
|
|
|
|
# directory.
|
|
|
|
|
|
|
|
# Because of compatibility issues with older versions of GNU tar (not
|
|
|
|
# to speak of non-GNU tars), we use the X option rather than the
|
|
|
|
# --exclude= option. The X option requires as argument a file listing
|
|
|
|
# files to exclude. We create a temporary file for this, then remove
|
|
|
|
# it immediately afterwards.
|
|
|
|
|
|
|
|
# When rebuilding the link, just as yet another compatibility safety
|
|
|
|
# measure, we need to make sure that we can manage the case that tar
|
|
|
|
# was actually broken and didn't honour the X option (and/or the h
|
|
|
|
# option). To manage this, we simply do not build the link if
|
|
|
|
# Resources already exists and is a directory (either a real one or a
|
|
|
|
# symbolic link, we don't care).
|
|
|
|
|
2002-03-19 13:06:56 +00:00
|
|
|
internal-bundle-install_:: $(BUNDLE_INSTALL_DIR) shared-instance-headers-install
|
2002-06-13 16:14:06 +00:00
|
|
|
$(ECHO_INSTALLING)rm -f .tmp.gnustep.exclude; \
|
2002-02-09 13:49:56 +00:00
|
|
|
echo "$(BUNDLE_DIR_NAME)/Contents/Resources" > .tmp.gnustep.exclude;\
|
|
|
|
rm -rf $(BUNDLE_INSTALL_DIR)/$(BUNDLE_DIR_NAME); \
|
|
|
|
$(TAR) chfX - .tmp.gnustep.exclude $(BUNDLE_DIR_NAME) \
|
|
|
|
| (cd $(BUNDLE_INSTALL_DIR); $(TAR) xf -); \
|
|
|
|
rm -f .tmp.gnustep.exclude; \
|
|
|
|
(cd $(BUNDLE_INSTALL_DIR)/$(BUNDLE_DIR_NAME)/Contents; \
|
|
|
|
if [ ! -d Resources ]; then \
|
|
|
|
rm -f Resources; $(LN_S) ../Resources .; \
|
2002-06-13 16:14:06 +00:00
|
|
|
fi;)$(END_ECHO)
|
2002-02-09 13:49:56 +00:00
|
|
|
ifneq ($(CHOWN_TO),)
|
|
|
|
$(CHOWN) -R $(CHOWN_TO) $(BUNDLE_INSTALL_DIR)/$(BUNDLE_DIR_NAME)
|
|
|
|
endif
|
|
|
|
ifeq ($(strip),yes)
|
|
|
|
$(STRIP) $(BUNDLE_INSTALL_DIR)/$(BUNDLE_FILE)
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(BUNDLE_INSTALL_DIR):
|
|
|
|
$(MKINSTALLDIRS) $@
|
|
|
|
|
2002-03-19 13:06:56 +00:00
|
|
|
internal-bundle-uninstall_:: shared-instance-headers-uninstall
|
2002-02-09 13:49:56 +00:00
|
|
|
rm -rf $(BUNDLE_INSTALL_DIR)/$(BUNDLE_DIR_NAME)
|
|
|
|
|
|
|
|
|
|
|
|
## Local variables:
|
|
|
|
## mode: makefile
|
|
|
|
## End:
|