4 # Makefile rules to build GNUstep web bundles.
6 # Copyright (C) 2002 Free Software Foundation, Inc.
8 # Author: Nicola Pero <nicola@brainstorm.co.uk>
10 # This file is part of the GNUstep Makefile Package.
12 # This library is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License
14 # as published by the Free Software Foundation; either version 2
15 # of the License, or (at your option) any later version.
17 # You should have received a copy of the GNU General Public
18 # License along with this library; see the file COPYING.LIB.
19 # If not, write to the Free Software Foundation,
20 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 ifeq ($(GNUSTEP_INSTANCE),)
23 ifeq ($(RULES_MAKE_LOADED),)
24 include $(GNUSTEP_MAKEFILES)/rules.make
27 ifeq ($(strip $(WOBUNDLE_EXTENSION)),)
28 WOBUNDLE_EXTENSION = .wobundle
31 WOBUNDLE_NAME := $(strip $(WOBUNDLE_NAME))
33 internal-all:: $(WOBUNDLE_NAME:=.all.wobundle.variables)
35 internal-install:: $(WOBUNDLE_NAME:=.install.wobundle.variables)
37 internal-uninstall:: $(WOBUNDLE_NAME:=.uninstall.wobundle.variables)
39 internal-clean:: $(WOBUNDLE_NAME:=.clean.wobundle.subprojects)
40 rm -rf $(GNUSTEP_OBJ_DIR) \
41 $(addsuffix $(WOBUNDLE_EXTENSION),$(WOBUNDLE_NAME))
43 internal-distclean:: $(WOBUNDLE_NAME:=.distclean.wobundle.subprojects)
44 rm -rf shared_obj static_obj shared_debug_obj shared_profile_obj \
45 static_debug_obj static_profile_obj shared_profile_debug_obj \
46 static_profile_debug_obj
49 @$(MAKE) -f $(MAKEFILE_NAME) --no-print-directory \
50 $@.all.wobundle.variables
53 ifeq ($(GNUSTEP_TYPE),wobundle)
54 ifeq ($(RULES_MAKE_LOADED),)
55 include $(GNUSTEP_MAKEFILES)/rules.make
58 # FIXME - this file has not been updated to use Shared/bundle.make
59 # because it is using symlinks rather than copying resources.
61 COMPONENTS = $($(GNUSTEP_INSTANCE)_COMPONENTS)
62 LANGUAGES = $($(GNUSTEP_INSTANCE)_LANGUAGES)
63 WEBSERVER_RESOURCE_FILES = $($(GNUSTEP_INSTANCE)_WEBSERVER_RESOURCE_FILES)
64 LOCALIZED_WEBSERVER_RESOURCE_FILES = $($(GNUSTEP_INSTANCE)_LOCALIZED_WEBSERVER_RESOURCE_FILES)
65 WEBSERVER_RESOURCE_DIRS = $($(GNUSTEP_INSTANCE)_WEBSERVER_RESOURCE_DIRS)
66 LOCALIZED_RESOURCE_FILES = $($(GNUSTEP_INSTANCE)_LOCALIZED_RESOURCE_FILES)
67 RESOURCE_FILES = $($(GNUSTEP_INSTANCE)_RESOURCE_FILES)
68 RESOURCE_DIRS = $($(GNUSTEP_INSTANCE)_RESOURCE_DIRS)
70 include $(GNUSTEP_MAKEFILES)/Instance/Shared/headers.make
72 ifeq ($(strip $(WOBUNDLE_EXTENSION)),)
73 WOBUNDLE_EXTENSION = .wobundle
76 WOBUNDLE_LD = $(BUNDLE_LD)
77 WOBUNDLE_LDFLAGS = $(BUNDLE_LDFLAGS)
79 ifeq ($(FOUNDATION_LIB),apple)
80 WORSRCDIRINFIX:=Contents/Resources
81 WORSRCLINKUP:=../../..
83 WORSRCDIRINFIX:=Resources
87 ifeq ($(WOBUNDLE_INSTALL_DIR),)
88 WOBUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Libraries
90 # The name of the bundle is in the BUNDLE_NAME variable.
91 # The list of languages the bundle is localized in are in xxx_LANGUAGES
92 # The list of bundle resource file are in xxx_RESOURCE_FILES
93 # The list of localized bundle resource file are in xxx_LOCALIZED_RESOURCE_FILES
94 # The list of bundle resource directories are in xxx_RESOURCE_DIRS
95 # The name of the principal class is xxx_PRINCIPAL_CLASS
96 # The header files are in xxx_HEADER_FILES
97 # The directory where the header files are located is xxx_HEADER_FILES_DIR
98 # The directory where to install the header files inside the library
99 # installation directory is xxx_HEADER_FILES_INSTALL_DIR
100 # where xxx is the bundle name
101 # xxx_WEBSERVER_RESOURCE_DIRS <==
102 # The list of localized application web server resource directories are in
103 # xxx_LOCALIZED_WEBSERVER_RESOURCE_DIRS
104 # where xxx is the application name <==
106 .PHONY: internal-wobundle-all_ \
107 internal-wobundle-install_ \
108 internal-wobundle-uninstall_ \
111 wobundle-components \
112 wobundle-resource-files \
113 wobundle-localized-resource-files \
114 wobundle-webresource-dir \
115 wobundle-webresource-files \
116 wobundle-localized-webresource-files
118 # On Solaris we don't need to specifies the libraries the bundle needs.
119 # How about the rest of the systems? ALL_BUNDLE_LIBS is temporary empty.
120 TALL_WOBUNDLE_LIBS = $(ADDITIONAL_WO_LIBS) $(AUXILIARY_WO_LIBS) $(WO_LIBS) \
121 $(ADDITIONAL_BUNDLE_LIBS) $(AUXILIARY_BUNDLE_LIBS) \
122 $(FND_LIBS) $(ADDITIONAL_OBJC_LIBS) $(AUXILIARY_OBJC_LIBS) \
123 $(OBJC_LIBS) $(SYSTEM_LIBS) $(TARGET_SYSTEM_LIBS)
125 ifeq ($(WHICH_LIB_SCRIPT),)
126 ALL_WOBUNDLE_LIBS = $(ALL_LIB_DIRS) $(TALL_WOBUNDLE_LIBS)
128 ALL_WOBUNDLE_LIBS = \
129 $(shell $(WHICH_LIB_SCRIPT) $(ALL_LIB_DIRS) $(TALL_WOBUNDLE_LIBS) \
130 debug=$(debug) profile=$(profile) shared=$(shared) libext=$(LIBEXT) \
131 shared_libext=$(SHARED_LIBEXT))
134 internal-wobundle-all_:: $(GNUSTEP_OBJ_DIR) \
138 WOBUNDLE_DIR_NAME = $(GNUSTEP_INSTANCE:=$(WOBUNDLE_EXTENSION))
140 $(WOBUNDLE_DIR_NAME)/$(GNUSTEP_TARGET_LDIR)/$(GNUSTEP_INSTANCE)
141 WOBUNDLE_RESOURCE_DIRS = $(foreach d, $(RESOURCE_DIRS), $(WOBUNDLE_DIR_NAME)/$(WORSRCDIRINFIX)/$(d))
142 WOBUNDLE_WEBSERVER_RESOURCE_DIRS = $(foreach d, $(WEBSERVER_RESOURCE_DIRS), $(WOBUNDLE_DIR_NAME)/Resources/WebServer/$(d))
144 ifeq ($(strip $(LANGUAGES)),)
149 build-bundle-dir:: $(WOBUNDLE_DIR_NAME)/$(WORSRCDIRINFIX) \
150 $(WOBUNDLE_DIR_NAME)/$(GNUSTEP_TARGET_LDIR) \
151 $(WOBUNDLE_RESOURCE_DIRS)
153 $(WOBUNDLE_DIR_NAME)/$(GNUSTEP_TARGET_LDIR):
154 @$(MKDIRS) $(WOBUNDLE_DIR_NAME)/$(GNUSTEP_TARGET_LDIR)
156 $(WOBUNDLE_RESOURCE_DIRS):
157 @$(MKDIRS) $(WOBUNDLE_RESOURCE_DIRS)
159 build-bundle:: $(WOBUNDLE_FILE) \
160 wobundle-components \
161 wobundle-resource-files \
162 wobundle-localized-resource-files \
163 wobundle-localized-webresource-files \
164 wobundle-webresource-files
167 $(WOBUNDLE_FILE) : $(OBJ_FILES_TO_LINK)
168 $(WOBUNDLE_LD) $(WOBUNDLE_LDFLAGS) \
169 $(ALL_LDFLAGS) -o $(LDOUT)$(WOBUNDLE_FILE) \
170 $(OBJ_FILES_TO_LINK) \
173 wobundle-components :: $(WOBUNDLE_DIR_NAME)
174 ifneq ($(strip $(COMPONENTS)),)
175 @(echo "Linking components into the bundle wrapper..."; \
176 cd $(WOBUNDLE_DIR_NAME)/$(WORSRCDIRINFIX); \
177 for component in $(COMPONENTS); do \
178 if [ -d $(WORSRCLINKUP)/$$component ]; then \
179 $(LN_S) -f $(WORSRCLINKUP)/$$component ./;\
182 echo "Linking localized components into the bundle wrapper..."; \
183 for l in $(LANGUAGES); do \
184 if [ -d $(WORSRCLINKUP)/$$l.lproj ]; then \
185 $(MKDIRS) $$l.lproj; \
187 for f in $(COMPONENTS); do \
188 if [ -d $(WORSRCLINKUP)/../$$l.lproj/$$f ]; then \
189 $(LN_S) -f $(WORSRCLINKUP)/../$$l.lproj/$$f .;\
197 wobundle-resource-files:: $(WOBUNDLE_DIR_NAME)/bundle-info.plist \
198 $(WOBUNDLE_DIR_NAME)/$(WORSRCDIRINFIX)/Info-gnustep.plist
199 ifneq ($(strip $(RESOURCE_FILES)),)
200 @(echo "Linking resources into the bundle wrapper..."; \
201 cd $(WOBUNDLE_DIR_NAME)/$(WORSRCDIRINFIX)/; \
202 for ff in $(RESOURCE_FILES); do \
203 $(LN_S) -f $(WORSRCLINKUP)/$$ff .;\
207 wobundle-localized-resource-files:: $(WOBUNDLE_DIR_NAME)/$(WORSRCDIRINFIX)/Info-gnustep.plist
208 ifneq ($(strip $(LOCALIZED_RESOURCE_FILES)),)
209 @(echo "Linking localized resources into the bundle wrapper..."; \
210 cd $(WOBUNDLE_DIR_NAME)/$(WORSRCDIRINFIX); \
211 for l in $(LANGUAGES); do \
212 if [ -d $(WORSRCLINKUP)/$$l.lproj ]; then \
213 $(MKDIRS) $$l.lproj; \
215 for f in $(LOCALIZED_RESOURCE_FILES); do \
216 if [ -f $(WORSRCLINKUP)/../$$l.lproj/$$f ]; then \
217 $(LN_S) -f $(WORSRCLINKUP)/../$$l.lproj/$$f .;\
222 echo "Warning - $$l.lproj not found - ignoring";\
227 wobundle-webresource-dir::
228 @$(MKDIRS) $(WOBUNDLE_WEBSERVER_RESOURCE_DIRS)
230 wobundle-webresource-files:: $(WOBUNDLE_DIR_NAME)/Resources/WebServer \
231 wobundle-webresource-dir
232 ifneq ($(strip $(WEBSERVER_RESOURCE_FILES)),)
233 @(echo "Linking webserver resources into the application wrapper..."; \
234 cd $(WOBUNDLE_DIR_NAME)/Resources/WebServer; \
235 for ff in $(WEBSERVER_RESOURCE_FILES); do \
236 $(LN_S) -f ../../WebServerResources/$$ff .;\
240 wobundle-localized-webresource-files:: $(WOBUNDLE_DIR_NAME)/Resources/WebServer \
241 wobundle-webresource-dir
242 ifneq ($(strip $(LOCALIZED_WEBSERVER_RESOURCE_FILES)),)
243 @(echo "Linking localized web resources into the application wrapper..."; \
244 cd $(WOBUNDLE_DIR_NAME)/Resources/WebServer; \
245 for l in $(LANGUAGES); do \
246 if [ -d ../../WebServerResources/$$l.lproj ]; then \
247 $(MKDIRS) $$l.lproj; \
249 for f in $(LOCALIZED_WEBSERVER_RESOURCE_FILES); do \
250 if [ -f ../../../WebServerResources/$$l.lproj/$$f ]; then \
251 if [ ! -r $$f ]; then \
252 $(LN_S) ../../../WebServerResources/$$l.lproj/$$f $$f;\
258 echo "Warning - WebServerResources/$$l.lproj not found - ignoring";\
263 PRINCIPAL_CLASS = $(strip $($(GNUSTEP_INSTANCE)_PRINCIPAL_CLASS))
265 ifeq ($(PRINCIPAL_CLASS),)
266 PRINCIPAL_CLASS = $(GNUSTEP_INSTANCE)
269 $(WOBUNDLE_DIR_NAME)/bundle-info.plist: $(WOBUNDLE_DIR_NAME)
270 @(cd $(WOBUNDLE_DIR_NAME); $(LN_S) -f ../bundle-info.plist .)
272 HAS_WOCOMPONENTS = $($(GNUSTEP_INSTANCE)_HAS_WOCOMPONENTS)
274 $(WOBUNDLE_DIR_NAME)/$(WORSRCDIRINFIX)/Info-gnustep.plist: $(WOBUNDLE_DIR_NAME)/$(WORSRCDIRINFIX)
275 @(echo "{"; echo ' NOTE = "Automatically generated, do not edit!";'; \
276 echo " NSExecutable = \"$(GNUSTEP_INSTANCE)\";"; \
277 echo " NSPrincipalClass = \"$(PRINCIPAL_CLASS)\";"; \
278 if [ "$(HAS_WOCOMPONENTS)" != "" ]; then \
279 echo " HasWOComponents = \"$(HAS_WOCOMPONENTS)\";"; \
283 $(WOBUNDLE_DIR_NAME)/$(WORSRCDIRINFIX):
286 $(WOBUNDLE_DIR_NAME)/Resources/WebServer:
289 internal-wobundle-install_:: $(WOBUNDLE_INSTALL_DIR) shared-instance-headers-install
290 rm -rf $(WOBUNDLE_INSTALL_DIR)/$(WOBUNDLE_DIR_NAME); \
291 $(TAR) chf - --exclude=CVS --exclude=.svn --to-stdout $(WOBUNDLE_DIR_NAME) | (cd $(WOBUNDLE_INSTALL_DIR); $(TAR) xf -)
293 $(CHOWN) -R $(CHOWN_TO) $(WOBUNDLE_INSTALL_DIR)/$(WOBUNDLE_DIR_NAME)
296 $(STRIP) $(WOBUNDLE_INSTALL_DIR)/$(WOBUNDLE_FILE)
299 $(WOBUNDLE_INSTALL_DIR)::
302 internal-wobundle-uninstall_:: shared-instance-headers-uninstall
303 rm -rf $(WOBUNDLE_INSTALL_DIR)/$(WOBUNDLE_DIR_NAME)