2002-03-19 13:06:56 +00:00
|
|
|
# -*-makefile-*-
|
2002-03-05 12:14:27 +00:00
|
|
|
# Instace/resource-set.make
|
2002-03-04 18:32:25 +00:00
|
|
|
#
|
|
|
|
# Instance makefile rules to install resource files
|
|
|
|
#
|
|
|
|
# Copyright (C) 2002 Free Software Foundation, Inc.
|
|
|
|
#
|
|
|
|
# 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
|
2007-07-13 10:11:48 +00:00
|
|
|
# License along with this library; see the file COPYING.
|
2002-03-04 18:32:25 +00:00
|
|
|
# If not, write to the Free Software Foundation,
|
2005-05-22 03:20:14 +00:00
|
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-03-04 18:32:25 +00:00
|
|
|
|
|
|
|
ifeq ($(RULES_MAKE_LOADED),)
|
|
|
|
include $(GNUSTEP_MAKEFILES)/rules.make
|
|
|
|
endif
|
|
|
|
|
2007-03-13 08:56:51 +00:00
|
|
|
#
|
|
|
|
# This is used to install a bunch of resource files somewhere. It is
|
|
|
|
# different from a bundle without resources; in a bundle without
|
|
|
|
# resources, we first create the bundle in the build directory, then
|
|
|
|
# copy the build to the install dir, overwriting anything already
|
|
|
|
# there. This instead will install the separate resource files
|
|
|
|
# directly in the installation directory; it's more efficient as it
|
|
|
|
# doesn't create a local bundle, and it doesn't overwrite an existing
|
|
|
|
# bundle in the installation directory.
|
|
|
|
#
|
2002-03-04 18:32:25 +00:00
|
|
|
#
|
|
|
|
# The name of the set of resources is in the RESOURCE_SET_NAME variable.
|
2007-03-13 08:56:51 +00:00
|
|
|
# The list of resource files/dirs is in xxx_RESOURCE_FILES
|
2002-03-04 18:32:25 +00:00
|
|
|
# The list of resource directories to create are in xxx_RESOURCE_DIRS
|
|
|
|
# The directory in which to install the resources is in the
|
2007-02-12 19:20:02 +00:00
|
|
|
# xxx_INSTALL_DIR
|
2002-03-04 18:32:25 +00:00
|
|
|
# The directory in which the resources are is in the
|
|
|
|
# xxx_RESOURCE_FILES_DIR (defaults to ./ if omitted)
|
2002-03-05 12:14:27 +00:00
|
|
|
# The list of LANGUAGES is in the xxx_LANGUAGES variable.
|
2007-03-13 08:56:51 +00:00
|
|
|
# The list of localized files/dirs to be read from yyy.lproj and copied
|
2002-03-05 12:14:27 +00:00
|
|
|
# into $(RESOURCE_FILES_INSTALL_DIR)/yyy.lproj for each language yyy
|
|
|
|
# is in the xxx_LOCALIZED_RESOURCE_FILES variable.
|
2007-03-13 08:56:51 +00:00
|
|
|
# The list of localized dirs to be created empty inside each
|
|
|
|
# $(RESOURCE_FILES_INSTALL_DIR)/yyy.lproj for each language yyy
|
|
|
|
# is in the xxx_LOCALIZED_RESOURCE_DIRS variable.
|
2002-03-04 18:32:25 +00:00
|
|
|
|
2002-03-19 13:06:56 +00:00
|
|
|
.PHONY: internal-resource_set-install_ \
|
|
|
|
internal-resource_set-uninstall_
|
2002-03-04 18:32:25 +00:00
|
|
|
|
2007-02-12 19:20:02 +00:00
|
|
|
#
|
|
|
|
# Determine where to install. By default, install into GNUSTEP_RESOURCES/GNUSTEP_INSTANCE
|
|
|
|
#
|
|
|
|
ifneq ($($(GNUSTEP_INSTANCE)_INSTALL_DIR),)
|
|
|
|
RESOURCE_FILES_INSTALL_DIR = $($(GNUSTEP_INSTANCE)_INSTALL_DIR)
|
|
|
|
endif
|
|
|
|
|
2007-02-14 12:08:47 +00:00
|
|
|
# Use the old xxx_RESOURCE_FILES_INSTALL_DIR setting only if the new
|
|
|
|
# one is not available. If you need your makefile to be compatible
|
|
|
|
# with both old and new versions of make, you can use both settings.
|
|
|
|
ifeq ($($(GNUSTEP_INSTANCE)_INSTALL_DIR),)
|
|
|
|
ifneq ($($(GNUSTEP_INSTANCE)_RESOURCE_FILES_INSTALL_DIR),)
|
|
|
|
# This is deprecated because we need to prepend GNUSTEP_INSTALLATION_DIR to it, which
|
|
|
|
# is deprecated. This was deprecated on 12 Feb 2007.
|
|
|
|
$(warning xxx_RESOURCE_FILES_INSTALL_DIR is deprecated, please use xxx_INSTALL_DIR instead)
|
|
|
|
RESOURCE_FILES_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/$($(GNUSTEP_INSTANCE)_RESOURCE_FILES_INSTALL_DIR)
|
|
|
|
endif
|
2007-02-12 19:20:02 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(RESOURCE_FILES_INSTALL_DIR),)
|
|
|
|
RESOURCE_FILES_INSTALL_DIR = $(GNUSTEP_RESOURCES)/$(GNUSTEP_INSTANCE)
|
|
|
|
endif
|
2002-03-04 18:32:25 +00:00
|
|
|
|
2007-03-13 08:56:51 +00:00
|
|
|
# Determine the dir to take the resources from
|
|
|
|
RESOURCE_FILES_DIR = $($(GNUSTEP_INSTANCE)_RESOURCE_FILES_DIR)
|
|
|
|
ifeq ($(RESOURCE_FILES_DIR),)
|
|
|
|
RESOURCE_FILES_DIR = ./
|
|
|
|
endif
|
2002-03-04 18:32:25 +00:00
|
|
|
|
2002-03-05 12:14:27 +00:00
|
|
|
|
2007-03-13 08:56:51 +00:00
|
|
|
# Determine the list of resource files
|
|
|
|
RESOURCE_FILES = $($(GNUSTEP_INSTANCE)_RESOURCE_FILES)
|
2002-03-04 18:32:25 +00:00
|
|
|
RESOURCE_DIRS = $($(GNUSTEP_INSTANCE)_RESOURCE_DIRS)
|
|
|
|
|
|
|
|
ifneq ($(RESOURCE_DIRS),)
|
|
|
|
# Rule to build the additional installation dirs
|
2007-02-12 19:20:02 +00:00
|
|
|
$(addprefix $(RESOURCE_FILES_INSTALL_DIR)/,$(RESOURCE_DIRS)):
|
2003-05-27 10:19:06 +00:00
|
|
|
$(ECHO_CREATING)$(MKDIRS) $@$(END_ECHO)
|
2007-03-13 08:56:51 +00:00
|
|
|
ifneq ($(CHOWN_TO),)
|
|
|
|
$(ECHO_CHOWNING)$(CHOWN) -R $(CHOWN_TO) $@$(END_ECHO)
|
2002-03-04 18:32:25 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2007-03-13 08:56:51 +00:00
|
|
|
# Rule to build the installation dir
|
|
|
|
$(RESOURCE_FILES_INSTALL_DIR):
|
|
|
|
$(ECHO_CREATING)$(MKDIRS) $@$(END_ECHO)
|
|
|
|
ifneq ($(CHOWN_TO),)
|
|
|
|
$(ECHO_CHOWNING)$(CHOWN) -R $(CHOWN_TO) $@$(END_ECHO)
|
|
|
|
endif
|
2002-03-05 12:14:27 +00:00
|
|
|
|
|
|
|
# Determine the list of languages
|
|
|
|
override LANGUAGES = $($(GNUSTEP_INSTANCE)_LANGUAGES)
|
|
|
|
ifeq ($(LANGUAGES),)
|
|
|
|
override LANGUAGES = English
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Determine the list of localized resource files
|
|
|
|
LOCALIZED_RESOURCE_FILES = $($(GNUSTEP_INSTANCE)_LOCALIZED_RESOURCE_FILES)
|
2007-03-13 08:56:51 +00:00
|
|
|
LOCALIZED_RESOURCE_DIRS = $($(GNUSTEP_INSTANCE)_LOCALIZED_RESOURCE_DIRS)
|
|
|
|
|
|
|
|
ifneq ($(LOCALIZED_RESOURCE_DIRS),)
|
|
|
|
# The following expression will create all the
|
|
|
|
# RESOURCE_FILES_INSTALL_DIR/LANGUAGE/LOCALIZED_RESOURCE_DIR that we
|
|
|
|
# need to build.
|
|
|
|
$(foreach LANGUAGE,$(LANGUAGES),$(addprefix $(RESOURCE_FILES_INSTALL_DIR)/$(LANGUAGE), $(LOCALIZED_RESOURCE_DIRS))):
|
|
|
|
$(ECHO_CREATING)$(MKDIRS) $@$(END_ECHO)
|
|
|
|
ifneq ($(CHOWN_TO),)
|
|
|
|
$(ECHO_CHOWNING)$(CHOWN) -R $(CHOWN_TO) $@$(END_ECHO)
|
|
|
|
endif
|
|
|
|
endif
|
2002-03-05 12:14:27 +00:00
|
|
|
|
2002-03-04 18:32:25 +00:00
|
|
|
#
|
|
|
|
# We provide two different algorithms of installing resource files.
|
|
|
|
#
|
|
|
|
|
|
|
|
ifeq ($(GNUSTEP_DEVELOPER),)
|
|
|
|
|
|
|
|
# Standard one - just run a subshell and loop, and install everything.
|
2002-03-19 13:06:56 +00:00
|
|
|
internal-resource_set-install_: \
|
2007-02-12 19:20:02 +00:00
|
|
|
$(RESOURCE_FILES_INSTALL_DIR) \
|
2007-03-13 08:56:51 +00:00
|
|
|
$(addprefix $(RESOURCE_FILES_INSTALL_DIR)/,$(RESOURCE_DIRS)) \
|
|
|
|
$(foreach LANGUAGE,$(LANGUAGES),$(addprefix $(RESOURCE_FILES_INSTALL_DIR)/$(LANGUAGE), $(LOCALIZED_RESOURCE_DIRS)))
|
2002-03-05 12:14:27 +00:00
|
|
|
ifneq ($(RESOURCE_FILES),)
|
2007-03-13 08:56:51 +00:00
|
|
|
$(ECHO_NOTHING)for f in $(RESOURCE_FILES); do \
|
|
|
|
if [ -f $$f -o -d $$f ]; then \
|
|
|
|
cp -fr $(RESOURCE_FILES_DIR)/$$f \
|
|
|
|
$(RESOURCE_FILES_INSTALL_DIR)/$$f; \
|
|
|
|
else \
|
|
|
|
echo "Warning: $$f not found - ignoring"; \
|
|
|
|
fi; \
|
|
|
|
done$(END_ECHO)
|
|
|
|
ifneq ($(CHOWN_TO),)
|
|
|
|
$(ECHO_CHOWNING)for f in $(RESOURCE_FILES); do \
|
|
|
|
if [ -f $$f -o -d $$f ]; then \
|
|
|
|
$(CHOWN) -R $(CHOWN_TO) $(RESOURCE_FILES_INSTALL_DIR)/$$f; \
|
2002-03-04 18:32:25 +00:00
|
|
|
fi; \
|
2003-05-27 12:07:03 +00:00
|
|
|
done$(END_ECHO)
|
2002-03-05 12:14:27 +00:00
|
|
|
endif
|
2007-03-13 08:56:51 +00:00
|
|
|
endif
|
2002-03-05 12:14:27 +00:00
|
|
|
ifneq ($(LOCALIZED_RESOURCE_FILES),)
|
2003-05-27 12:07:03 +00:00
|
|
|
$(ECHO_NOTHING)for l in $(LANGUAGES); do \
|
2002-03-05 12:14:27 +00:00
|
|
|
if [ -d $$l.lproj ]; then \
|
2007-02-12 19:20:02 +00:00
|
|
|
$(MKINSTALLDIRS) $(RESOURCE_FILES_INSTALL_DIR)/$$l.lproj; \
|
2002-03-05 12:14:27 +00:00
|
|
|
for f in $(LOCALIZED_RESOURCE_FILES); do \
|
2007-03-13 08:56:51 +00:00
|
|
|
if [ -f $$l.lproj/$$f -o -d $$l.lproj/$$f ]; then \
|
|
|
|
cp -fr $$l.lproj/$$f \
|
|
|
|
$(RESOURCE_FILES_INSTALL_DIR)/$$l.lproj; \
|
2002-03-05 12:14:27 +00:00
|
|
|
else \
|
|
|
|
echo "Warning: $$l.lproj/$$f not found - ignoring"; \
|
|
|
|
fi; \
|
|
|
|
done; \
|
|
|
|
else \
|
|
|
|
echo "Warning: $$l.lproj not found - ignoring"; \
|
|
|
|
fi; \
|
2003-05-27 12:07:03 +00:00
|
|
|
done$(END_ECHO)
|
2007-03-13 08:56:51 +00:00
|
|
|
ifneq ($(CHOWN_TO),)
|
|
|
|
$(ECHO_CHOWNING)for l in $(LANGUAGES); do \
|
|
|
|
if [ -d $$l.lproj ]; then \
|
|
|
|
$(CHOWN) -R $(CHOWN_TO) $(RESOURCE_FILES_INSTALL_DIR)/$$l.lproj; \
|
|
|
|
for f in $(LOCALIZED_RESOURCE_FILES); do \
|
|
|
|
if [ -f $$l.lproj/$$f -o -d $$l.lproj/$$f ]; then \
|
|
|
|
$(CHOWN) -R $(CHOWN_TO) $(RESOURCE_FILES_INSTALL_DIR)/$$l.lproj/$$f; \
|
|
|
|
fi; \
|
|
|
|
done; \
|
|
|
|
fi; \
|
|
|
|
done$(END_ECHO)
|
|
|
|
endif
|
2002-03-05 12:14:27 +00:00
|
|
|
endif
|
2002-03-04 18:32:25 +00:00
|
|
|
|
2002-03-05 12:14:27 +00:00
|
|
|
else # Following code turned on by setting GNUSTEP_DEVELOPER=YES in the shell
|
|
|
|
|
2007-03-13 08:56:51 +00:00
|
|
|
# TODO/FIXME: Update the code; implement proper
|
|
|
|
# LOCALIZED_RESOURCE_FILES that also allows directories etc.
|
|
|
|
|
2002-03-05 12:14:27 +00:00
|
|
|
.PHONY: internal-resource-set-install-languages
|
2002-03-04 18:32:25 +00:00
|
|
|
|
|
|
|
# One optimized for recurrent installations during development - this
|
|
|
|
# rule installs a single file only if strictly needed
|
2007-02-12 19:20:02 +00:00
|
|
|
$(RESOURCE_FILES_INSTALL_DIR)/% : $(RESOURCE_FILES_DIR)/%
|
2007-03-13 08:56:51 +00:00
|
|
|
$(ECHO_NOTHING)cp -fr $< $(RESOURCE_FILES_DIR)$(END_ECHO)
|
|
|
|
ifneq ($(CHOWN_TO),)
|
|
|
|
$(ECHO_CHOWNING)$(CHOWN) -R $(CHOWN_TO) $@$(END_ECHO)
|
|
|
|
endif
|
2002-03-04 18:32:25 +00:00
|
|
|
|
|
|
|
# This rule depends on having installed all files
|
2002-03-19 13:06:56 +00:00
|
|
|
internal-resource_set-install_: \
|
2007-02-12 19:20:02 +00:00
|
|
|
$(RESOURCE_FILES_INSTALL_DIR) \
|
|
|
|
$(addprefix $(RESOURCE_FILES_INSTALL_DIR)/,$(RESOURCE_DIRS)) \
|
|
|
|
$(addprefix $(RESOURCE_FILES_INSTALL_DIR)/,$(RESOURCE_FILES)) \
|
2002-03-05 12:14:27 +00:00
|
|
|
internal-resource-set-install-languages
|
|
|
|
|
|
|
|
ifeq ($(LOCALIZED_RESOURCE_FILES),)
|
|
|
|
internal-resource-set-install-languages:
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
# Rule to build the language installation directories
|
2007-02-12 19:20:02 +00:00
|
|
|
$(addsuffix .lproj,$(addprefix $(RESOURCE_FILES_INSTALL_DIR)/,$(LANGUAGES))):
|
2003-05-27 10:19:06 +00:00
|
|
|
$(ECHO_CREATING)$(MKDIRS) $@$(END_ECHO)
|
2002-03-05 12:14:27 +00:00
|
|
|
|
|
|
|
# install the localized resources, checking the installation date by
|
|
|
|
# using test -nt ... this doesn't seem to be easy to do using make
|
|
|
|
# rules because we want to issue a warning if the directory/file can't
|
|
|
|
# be found, rather than aborting with an error as make would do.
|
|
|
|
internal-resource-set-install-languages: \
|
2007-02-12 19:20:02 +00:00
|
|
|
$(addsuffix .lproj,$(addprefix $(RESOURCE_FILES_INSTALL_DIR)/,$(LANGUAGES)))
|
2003-05-27 12:07:03 +00:00
|
|
|
$(ECHO_NOTHING)for l in $(LANGUAGES); do \
|
2002-03-05 12:14:27 +00:00
|
|
|
if [ -d $$l.lproj ]; then \
|
|
|
|
for f in $(LOCALIZED_RESOURCE_FILES); do \
|
|
|
|
if [ -f $$l.lproj/$$f ]; then \
|
2007-02-12 19:20:02 +00:00
|
|
|
if [ $$l.lproj -nt $(RESOURCE_FILES_INSTALL_DIR)/$$l.lproj/$$f ]; then \
|
2002-03-05 12:14:27 +00:00
|
|
|
$(INSTALL_DATA) $$l.lproj/$$f \
|
2007-02-12 19:20:02 +00:00
|
|
|
$(RESOURCE_FILES_INSTALL_DIR)/$$l.lproj; \
|
2002-03-05 12:14:27 +00:00
|
|
|
fi; \
|
|
|
|
else \
|
|
|
|
echo "Warning: $$l.lproj/$$f not found - ignoring"; \
|
|
|
|
fi; \
|
|
|
|
done; \
|
|
|
|
else \
|
|
|
|
echo "Warning: $$l.lproj not found - ignoring"; \
|
|
|
|
fi; \
|
2003-05-27 12:07:03 +00:00
|
|
|
done$(END_ECHO)
|
2002-03-05 12:14:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
endif # LOCALIZED_RESOURCE_FILES
|
2002-03-04 18:32:25 +00:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2002-03-19 13:06:56 +00:00
|
|
|
internal-resource_set-uninstall_:
|
2002-03-05 12:14:27 +00:00
|
|
|
ifneq ($(LOCALIZED_RESOURCE_FILES),)
|
2004-06-16 15:14:59 +00:00
|
|
|
-$(ECHO_NOTHING)for language in $(LANGUAGES); do \
|
2002-03-05 12:14:27 +00:00
|
|
|
for file in $(LOCALIZED_RESOURCE_FILES); do \
|
2007-02-12 19:20:02 +00:00
|
|
|
rm -rf $(RESOURCE_FILES_INSTALL_DIR)/$$language.lproj/$$file;\
|
2002-03-05 12:14:27 +00:00
|
|
|
done; \
|
2007-02-12 19:20:02 +00:00
|
|
|
rmdir $(RESOURCE_FILES_INSTALL_DIR)/$$language.lproj; \
|
2003-05-27 12:07:03 +00:00
|
|
|
done$(END_ECHO)
|
2002-03-05 12:14:27 +00:00
|
|
|
endif
|
2004-06-16 15:14:59 +00:00
|
|
|
ifneq ($(RESOURCE_FILES),)
|
|
|
|
$(ECHO_NOTHING)for file in $(RESOURCE_FILES); do \
|
2007-02-12 19:20:02 +00:00
|
|
|
rm -rf $(RESOURCE_FILES_INSTALL_DIR)/$$file ; \
|
2004-06-16 15:14:59 +00:00
|
|
|
done$(END_ECHO)
|
2007-02-12 19:20:02 +00:00
|
|
|
-rmdir $(RESOURCE_FILES_INSTALL_DIR)
|
2004-06-16 15:14:59 +00:00
|
|
|
endif
|