1# -*-makefile-*- 2# Instance/service.make 3# 4# Instance Makefile rules to build GNUstep-based services. 5# 6# Copyright (C) 1998, 2001 Free Software Foundation, Inc. 7# 8# Author: Richard Frith-Macdonald <richard@brainstorm.co.uk> 9# Based on the makefiles by Scott Christley. 10# Author: Nicola Pero <nicola@brainstorm.co.uk> 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 3 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. 21# If not, write to the Free Software Foundation, 22# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 23 24ifeq ($(RULES_MAKE_LOADED),) 25include $(GNUSTEP_MAKEFILES)/rules.make 26endif 27 28# 29# The name of the service is in the SERVICE_NAME variable. 30# The NSServices info should be in $(SERVICE_NAME)Info.plist 31# The list of service resource file are in xxx_RESOURCE_FILES 32# The list of service resource directories are in xxx_RESOURCE_DIRS 33# where xxx is the service name 34# 35 36.PHONY: internal-service-all_ \ 37 internal-service-install_ \ 38 internal-service-uninstall_ \ 39 internal-service-copy_into_dir \ 40 service-resource-files \ 41 internal-service-run-compile-submake \ 42 internal-service-compile 43 44# Libraries that go before the GUI libraries 45ALL_SERVICE_LIBS = \ 46 $(ALL_LIB_DIRS) \ 47 $(ADDITIONAL_GUI_LIBS) $(AUXILIARY_GUI_LIBS) \ 48 $(GUI_LIBS) $(ADDITIONAL_TOOL_LIBS) $(AUXILIARY_TOOL_LIBS) \ 49 $(FND_LIBS) $(ADDITIONAL_OBJC_LIBS) $(AUXILIARY_OBJC_LIBS) \ 50 $(OBJC_LIBS) $(SYSTEM_LIBS) $(TARGET_SYSTEM_LIBS) 51 52# Don't include these definitions the first time make is invoked. This part is 53# included when make is invoked the second time from the %.build rule (see 54# rules.make). 55SERVICE_DIR_NAME = $(GNUSTEP_INSTANCE:=.service) 56SERVICE_DIR = $(GNUSTEP_BUILD_DIR)/$(SERVICE_DIR_NAME) 57 58# 59# Internal targets 60# 61SERVICE_FILE_NAME = $(SERVICE_DIR_NAME)/$(GNUSTEP_TARGET_LDIR)/$(GNUSTEP_INSTANCE) 62SERVICE_FILE = $(GNUSTEP_BUILD_DIR)/$(SERVICE_FILE_NAME) 63 64ifneq ($($(GNUSTEP_INSTANCE)_INSTALL_DIR),) 65 SERVICE_INSTALL_DIR = $($(GNUSTEP_INSTANCE)_INSTALL_DIR) 66endif 67 68ifeq ($(SERVICE_INSTALL_DIR),) 69 SERVICE_INSTALL_DIR = $(GNUSTEP_SERVICES) 70endif 71 72GNUSTEP_SHARED_BUNDLE_RESOURCE_PATH = $(SERVICE_DIR)/Resources 73GNUSTEP_SHARED_BUNDLE_INSTALL_NAME = $(SERVICE_DIR_NAME) 74GNUSTEP_SHARED_BUNDLE_INSTALL_LOCAL_PATH = . 75GNUSTEP_SHARED_BUNDLE_INSTALL_PATH = $(SERVICE_INSTALL_DIR) 76include $(GNUSTEP_MAKEFILES)/Instance/Shared/bundle.make 77 78internal-service-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) \ 79 $(OBJ_DIRS_TO_CREATE) \ 80 $(SERVICE_DIR)/$(GNUSTEP_TARGET_LDIR) \ 81 internal-service-run-compile-submake \ 82 $(SERVICE_DIR)/Resources/Info-gnustep.plist \ 83 shared-instance-bundle-all 84# If they specified Info-gnustep.plist in the xxx_RESOURCE_FILES, 85# print a warning. They are supposed to provide a xxxInfo.plist which 86# gets merged with the automatically generated entries to generate 87# Info-gnustep.plist. 88ifneq ($(FOUNDATION_LIB), apple) 89 ifneq ($(filter Info-gnustep.plist,$($(GNUSTEP_INSTANCE)_RESOURCE_FILES)),) 90 $(WARNING_INFO_GNUSTEP_PLIST) 91 endif 92else 93 ifneq ($(filter Info.plist,$($(GNUSTEP_INSTANCE)_RESOURCE_FILES)),) 94 $(WARNING_INFO_PLIST) 95 endif 96endif 97 98ifeq ($(GNUSTEP_MAKE_PARALLEL_BUILDING), no) 99# Standard building 100internal-service-run-compile-submake: $(SERVICE_FILE) 101else 102# Parallel building. The actual compilation is delegated to a 103# sub-make invocation where _GNUSTEP_MAKE_PARALLEL is set to yet. 104# That sub-make invocation will compile files in parallel. 105internal-service-run-compile-submake: 106 $(ECHO_NOTHING_RECURSIVE_MAKE)$(MAKE) -f $(MAKEFILE_NAME) --no-print-directory --no-keep-going \ 107 internal-service-compile \ 108 GNUSTEP_TYPE=$(GNUSTEP_TYPE) \ 109 GNUSTEP_INSTANCE=$(GNUSTEP_INSTANCE) \ 110 GNUSTEP_OPERATION=compile \ 111 GNUSTEP_BUILD_DIR="$(GNUSTEP_BUILD_DIR)" \ 112 _GNUSTEP_MAKE_PARALLEL=yes$(END_ECHO_RECURSIVE_MAKE) 113 114internal-service-compile: $(SERVICE_FILE) 115endif 116 117$(SERVICE_FILE): $(OBJ_FILES_TO_LINK) 118ifeq ($(OBJ_FILES_TO_LINK),) 119 $(WARNING_EMPTY_LINKING) 120endif 121 $(ECHO_LINKING)$(LD) $(ALL_LDFLAGS) $(CC_LDFLAGS) -o $(LDOUT)$@ \ 122 $(OBJ_FILES_TO_LINK) $(ALL_SERVICE_LIBS)$(END_ECHO) 123 124$(SERVICE_DIR)/$(GNUSTEP_TARGET_LDIR): 125 $(ECHO_CREATING)$(MKDIRS) $(SERVICE_DIR)/$(GNUSTEP_TARGET_LDIR)$(END_ECHO) 126 127 128# Allow the gui library to redefine make_services to use its local one 129ifeq ($(GNUSTEP_MAKE_SERVICES),) 130 GNUSTEP_MAKE_SERVICES = make_services 131endif 132 133ifeq ($(GNUSTEP_PLIST_DEPEND),) 134 $(warning Service $(GNUSTEP_INSTANCE) missing $(GNUSTEP_INSTANCE)Info.plist) 135endif 136 137# FIXME - xxxInfo.plist in this case is not really a plist! 138 139$(SERVICE_DIR)/Resources/Info-gnustep.plist: \ 140 $(SERVICE_DIR)/Resources $(GNUSTEP_PLIST_DEPEND) 141 $(ECHO_CREATING)(echo "{"; echo ' NOTE = "Automatically generated, do not edit!";'; \ 142 echo " NSExecutable = \"$(GNUSTEP_INSTANCE)\";"; \ 143 if [ -r "$(GNUSTEP_PLIST_DEPEND)" ]; then \ 144 cat $(GNUSTEP_PLIST_DEPEND); \ 145 fi; \ 146 echo "}") >$@ ;\ 147 if $(GNUSTEP_MAKE_SERVICES) --test $@; then : ; else rm -f $@; false; \ 148 fi$(END_ECHO) 149 150internal-service-copy_into_dir:: shared-instance-bundle-copy_into_dir 151 152# 153# Install targets 154# 155$(SERVICE_INSTALL_DIR): 156 $(ECHO_CREATING)$(MKINSTALLDIRS) $@$(END_ECHO) 157 158internal-service-install_:: shared-instance-bundle-install 159ifeq ($(strip),yes) 160 $(ECHO_STRIPPING)$(STRIP) $(SERVICE_INSTALL_DIR)/$(SERVICE_FILE_NAME)$(END_ECHO) 161endif 162 163internal-service-uninstall_:: shared-instance-bundle-uninstall 164 165include $(GNUSTEP_MAKEFILES)/Instance/Shared/strings.make 166