1#   -*-makefile-gmake-*-
2#   Instance/framework.make
3#
4#   Instance Makefile rules to build GNUstep-based frameworks.
5#
6#   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2010 Free Software Foundation, Inc.
7#
8#   Author: Mirko Viviani <mirko.viviani@rccr.cremona.it>
9#   Author: Nicola Pero <nicola.pero@meta-innovation.com>
10#
11#   This file is part of the GNUstep Makefile Package.
12#
13#   This library is free software; you can redistribute it and/or
14#   modify it under the terms of the GNU General Public License
15#   as published by the Free Software Foundation; either version 3
16#   of the License, or (at your option) any later version.
17#
18#   You should have received a copy of the GNU General Public
19#   License along with this library; see the file COPYING.
20#   If not, write to the Free Software Foundation,
21#   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
23# Frameworks usually link against a gui library (if available).  If
24# you don't need a gui library, use xxx_NEEDS_GUI = no.
25ifeq ($(NEEDS_GUI),)
26  NEEDS_GUI = yes
27endif
28
29ifeq ($(RULES_MAKE_LOADED),)
30include $(GNUSTEP_MAKEFILES)/rules.make
31endif
32
33.PHONY: internal-framework-all_ \
34        build-framework \
35        internal-framework-build-headers \
36        build-framework-dirs \
37        internal-framework-install_ \
38        internal-framework-distclean \
39        internal-framework-clean \
40        internal-framework-uninstall_ \
41        internal-framework-run-compile-submake \
42        internal-framework-compile
43
44# The name of the framework is in the FRAMEWORK_NAME variable.
45# The list of framework resource files are in xxx_RESOURCE_FILES
46# The list of framework web server resource files are in
47#    xxx_WEBSERVER_RESOURCE_FILES
48# The list of localized framework resource files is in
49#    xxx_LOCALIZED_RESOURCE_FILES
50# The list of localized framework web server resource files is in
51#    xxx_WEBSERVER_LOCALIZED_RESOURCE_FILES
52# The list of framework GSWeb components are in xxx_COMPONENTS
53# The list of languages the framework supports is in xxx_LANGUAGES
54# The list of framework resource directories are in xxx_RESOURCE_DIRS
55# The list of framework subprojects directories are in xxx_SUBPROJECTS
56# The name of the principal class is xxx_PRINCIPAL_CLASS
57# The header files are in xxx_HEADER_FILES
58# The directory where the header files are located is xxx_HEADER_FILES_DIR
59#   (defaults to ./)
60# The directory where to install the header files inside the library
61#   installation directory is xxx_HEADER_FILES_INSTALL_DIR
62#   (defaults to the framework name [without .framework]).  Can't be `.'
63# The list of framework web server resource directories are in
64#    xxx_WEBSERVER_RESOURCE_DIRS
65# The list of localized framework web server GSWeb components are in
66#    xxx_WEBSERVER_LOCALIZED_RESOURCE_DIRS
67# xxx_CURRENT_VERSION_NAME is the compiled version name (default "0")
68# xxx_MAKE_CURRENT_VERSION is used to decide if the framework version
69#   we compiling should be made the current/default version or not
70#   (default is "yes")
71# xxx_TEST_DIR is the directory in which 'make check' will cause tests
72#   to be run using gnustep-tests.
73#
74# where xxx is the framework name
75#
76#
77# The HEADER_FILES_INSTALL_DIR might look somewhat weird - because in
78# most if not all cases, you want it to be the framework name.  At the
79# moment, it allows you to put headers for framework XXX in directory
80# YYY, so that you can refer to them by using #include
81# <YYY/MyHeader.h> rather than #include <XXX/MyHeader.h>.  It seems to
82# be mostly used to have a framework with name XXX work as a drop-in
83# replacement for another framework, which has name YYY -- and which
84# might be installed at the same time :-).
85#
86# If you want to insert your own entries into Info.plist (or
87# Info-gnustep.plist) you should create a xxxInfo.plist file (where
88# xxx is the framework name) and gnustep-make will automatically
89# read it and merge it into Info-gnustep.plist.
90#
91
92# Set VERSION from xxx_VERSION
93ifneq ($($(GNUSTEP_INSTANCE)_VERSION),)
94  VERSION = $($(GNUSTEP_INSTANCE)_VERSION)
95endif
96
97ifeq ($(VERSION),)
98  VERSION = 0.0.1
99endif
100
101# By setting xxx_INTERFACE_VERSION you can change the soversion used
102# when linking the library.  See comments in library.make for the
103# variables with the same name for libraries.
104ifeq ($($(GNUSTEP_INSTANCE)_INTERFACE_VERSION),)
105  # By default, if VERSION is 1.0.0, INTERFACE_VERSION is 1
106  INTERFACE_VERSION = $(word 1,$(subst ., ,$(VERSION)))
107else
108  INTERFACE_VERSION = $($(GNUSTEP_INSTANCE)_INTERFACE_VERSION)
109endif
110
111# CURRENT_VERSION_NAME is the name of the version as used when
112# building the library structure.  We recommend just using
113# INTERFACE_VERSION for that, so your resources and your shared
114# library have the same versioning.
115
116# Warning - the following variable is also used in Master/rules.make
117# to build the OWNING_PROJECT_HEADER_DIR for the framework's
118# subprojects.  Make sure you keep them in sync if you change them.
119CURRENT_VERSION_NAME = $($(GNUSTEP_INSTANCE)_CURRENT_VERSION_NAME)
120ifeq ($(CURRENT_VERSION_NAME),)
121  CURRENT_VERSION_NAME = $(INTERFACE_VERSION)
122endif
123
124# xxx_MAKE_CURRENT_VERSION can be set to 'no' if you do not want the
125# framework version that we are building from becoming the Current
126# one.
127ifneq ($($(GNUSTEP_INSTANCE)_MAKE_CURRENT_VERSION),)
128  MAKE_CURRENT_VERSION = $($(GNUSTEP_INSTANCE)_MAKE_CURRENT_VERSION)
129endif
130
131ifeq ($(MAKE_CURRENT_VERSION),)
132  MAKE_CURRENT_VERSION = yes
133endif
134
135# If there are no working symlinks, common.make sets
136# FRAMEWORK_VERSION_SUPPORT to no, which unconditionally turn
137# versioning off.  This means that we create no symlinks inside the
138# xxx.framework directory for the various versions; that everything is
139# put top-level as in the case of bundles.  So with
140# FRAMEWORK_VERSION_SUPPORT = no, the Directory structure is:
141#
142# xxx.framework/libframework.dll.a
143# xxx.framework/framework.dll
144# xxx.framework/Resources
145# xxx.framework/Headers
146#
147# The Headers, libframework.dll.a and framework.dll are then copied into
148# the standard header/library locations so that they can be found by
149# compiler/linker.  Given that there are no symlinks, there is no other
150# way of doing this.
151ifeq ($(FRAMEWORK_VERSION_SUPPORT),no)
152  MAKE_CURRENT_VERSION = no
153endif
154
155# This is used on Apple to build frameworks which can be embedded into
156# applications.  You usually set it to something like
157# @executable_path/../Frameworks and then you can embed the framework
158# in an application.
159DYLIB_INSTALL_NAME_BASE = $($(GNUSTEP_INSTANCE)_DYLIB_INSTALL_NAME_BASE)
160
161FRAMEWORK_DIR_NAME = $(GNUSTEP_INSTANCE).framework
162FRAMEWORK_DIR = $(GNUSTEP_BUILD_DIR)/$(FRAMEWORK_DIR_NAME)
163
164ifeq ($(FRAMEWORK_VERSION_SUPPORT), yes)
165  FRAMEWORK_VERSION_DIR_NAME = $(FRAMEWORK_DIR_NAME)/Versions/$(CURRENT_VERSION_NAME)
166else
167  FRAMEWORK_VERSION_DIR_NAME = $(FRAMEWORK_DIR_NAME)
168endif
169
170FRAMEWORK_VERSION_DIR = $(GNUSTEP_BUILD_DIR)/$(FRAMEWORK_VERSION_DIR_NAME)
171
172# This is not doing much at the moment, it is only defining
173# HEADER_FILES, HEADER_SUBDIRS, HEADER_FILES_DIR and
174# HEADER_FILES_INSTALL_DIR in the standard way.  Please note that
175# HEADER_FILES might be empty even if we have headers in subprojects
176# that we need to manage and install.  So we assume by default that we
177# have some headers even if HEADER_FILES is empty.
178include $(GNUSTEP_MAKEFILES)/Instance/Shared/headers.make
179include $(GNUSTEP_MAKEFILES)/Instance/Shared/pkgconfig.make
180
181# On windows, this is unfortunately required.
182ifeq ($(BUILD_DLL), yes)
183  LINK_AGAINST_ALL_LIBS = yes
184endif
185
186ifeq ($(LINK_AGAINST_ALL_LIBS), yes)
187  # Link against all libs ... but not the one we're compiling! (not sure
188  # when this could happen with frameworks, anyway it makes sense)
189  LIBRARIES_DEPEND_UPON += $(filter-out -l$(GNUSTEP_INSTANCE), $(ALL_LIBS))
190endif
191
192INTERNAL_LIBRARIES_DEPEND_UPON =				\
193   $(ALL_LIB_DIRS)						\
194   $(LIBRARIES_DEPEND_UPON)
195
196ifeq ($(FOUNDATION_LIB),gnu)
197
198  # On GNUstep, build our dummy class to store information which
199  # gnustep-base can find at run time.
200
201  # An ObjC class name can not contain '-', but some people '-' this
202  # in framework names.  So we need to encode the '-' in some way
203  # into an ObjC class name. (since we're there, we also encode '+'
204  # even if that's not really common).
205
206  # What we do is, we use '_' as an escape character, and encode (in the
207  # order) as follows:
208  #
209  #  '_' is converted to '__'
210  #  '-' is converted to '_0'
211  #  '+' is converted to '_1'
212  #
213
214  # For example, 'Renaissance-Experimental' becomes
215  # 'Renaissance_0Experimental'.
216
217  # GNUstep-base will convert the name back by applying the reverse rules
218  # in the reverse order.
219
220  DUMMY_FRAMEWORK = NSFramework_$(subst +,_1,$(subst -,_0,$(subst _,__,$(GNUSTEP_INSTANCE))))
221  DUMMY_FRAMEWORK_FILE = $(DERIVED_SOURCES_DIR)/$(DUMMY_FRAMEWORK).m
222  DUMMY_FRAMEWORK_OBJ_FILE = $(addprefix $(GNUSTEP_OBJ_INSTANCE_DIR)/,$(DUMMY_FRAMEWORK).o)
223
224  # The following file will hold the list of classes compiled into the
225  # framework, ready to be included in the .plist file.  We include the
226  # list of classes twice, in the object file itself (for when the
227  # framework is loaded) and in the .plist (for tools which let you
228  # browse in frameworks on disk and see lists of classes).  Please note
229  # that reading the class list from the .plist requires gnustep-base to
230  # have properly located the framework bundle on disk, while reading
231  # the list from the object file itself does not (and so it's more
232  # likely to work in a portable way), which is why we still save the
233  # list in the object file rather than only putting it in the .plist.
234  # Maybe this point should be discarded, and we should only store the class
235  # list in the .plist file.
236  DUMMY_FRAMEWORK_CLASS_LIST = $(DERIVED_SOURCES_DIR)/$(GNUSTEP_INSTANCE)-class-list
237endif
238
239FRAMEWORK_HEADER_FILES = $(addprefix $(FRAMEWORK_VERSION_DIR)/Headers/,$(HEADER_FILES))
240FRAMEWORK_HEADER_SUBDIRS = $(addprefix $(FRAMEWORK_VERSION_DIR)/Headers/,$(HEADER_SUBDIRS))
241
242# FIXME - do we really those variables too ?
243ifeq ($(FRAMEWORK_VERSION_SUPPORT), yes)
244  FRAMEWORK_CURRENT_DIR_NAME = $(FRAMEWORK_DIR_NAME)/Versions/Current
245else
246  FRAMEWORK_CURRENT_DIR_NAME = $(FRAMEWORK_DIR_NAME)
247endif
248
249FRAMEWORK_CURRENT_DIR = $(GNUSTEP_BUILD_DIR)/$(FRAMEWORK_CURRENT_DIR_NAME)
250FRAMEWORK_LIBRARY_DIR_NAME = $(FRAMEWORK_VERSION_DIR_NAME)/$(GNUSTEP_TARGET_LDIR)
251FRAMEWORK_LIBRARY_DIR = $(GNUSTEP_BUILD_DIR)/$(FRAMEWORK_LIBRARY_DIR_NAME)
252FRAMEWORK_CURRENT_LIBRARY_DIR_NAME = $(FRAMEWORK_CURRENT_DIR_NAME)/$(GNUSTEP_TARGET_LDIR)
253FRAMEWORK_CURRENT_LIBRARY_DIR = $(GNUSTEP_BUILD_DIR)/$(FRAMEWORK_CURRENT_LIBRARY_DIR_NAME)
254
255ifneq ($(BUILD_DLL), yes)
256
257FRAMEWORK_LIBRARY_FILE = lib$(GNUSTEP_INSTANCE)$(SHARED_LIBEXT)
258ifeq ($(findstring darwin, $(GNUSTEP_TARGET_OS)), darwin)
259# On Mac OS X the version number conventionally precedes the shared
260# library suffix, e.g., libgnustep-base.1.16.1.dylib.
261VERSION_FRAMEWORK_LIBRARY_FILE = lib$(GNUSTEP_INSTANCE).$(VERSION)$(SHARED_LIBEXT)
262SONAME_FRAMEWORK_FILE = lib$(GNUSTEP_INSTANCE).$(INTERFACE_VERSION)$(SHARED_LIBEXT)
263else
264VERSION_FRAMEWORK_LIBRARY_FILE = $(FRAMEWORK_LIBRARY_FILE).$(VERSION)
265SONAME_FRAMEWORK_FILE = $(FRAMEWORK_LIBRARY_FILE).$(INTERFACE_VERSION)
266endif
267
268else # BUILD_DLL
269
270# When you build a DLL, you have to install it in a directory which is
271# in your PATH.
272ifeq ($(DLL_INSTALLATION_DIR),)
273  DLL_INSTALLATION_DIR = $(GNUSTEP_TOOLS)/$(GNUSTEP_TARGET_LDIR)
274endif
275
276# When we build a DLL, we also pass -DBUILD_lib{library_name}_DLL=1 to
277# the preprocessor.  With the new DLL support, this is usually not
278# needed; but in some cases some symbols are difficult and have to be
279# exported/imported manually.  For these cases, the library header
280# files can use this preprocessor define to know that they are
281# included during compilation of the library itself, or are being
282# imported by external code.  Typically with the new DLL support if a
283# symbol can't be imported you have to mark it with
284# __declspec(dllimport) when the library is not being compiled.
285# __declspec(dllexport) is not particularly useful instead.
286
287CLEAN_framework_NAME = $(subst -,_,$(GNUSTEP_INSTANCE))
288SHARED_CFLAGS += -DBUILD_$(CLEAN_framework_NAME)_DLL=1
289
290# FRAMEWORK_LIBRARY_FILE is the import library, libRenaissance.dll.a
291FRAMEWORK_LIBRARY_FILE         = lib$(GNUSTEP_INSTANCE)$(DLL_LIBEXT)$(LIBEXT)
292VERSION_FRAMEWORK_LIBRARY_FILE = $(FRAMEWORK_LIBRARY_FILE)
293SONAME_FRAMEWORK_FILE  = $(FRAMEWORK_LIBRARY_FILE)
294
295# LIB_LINK_DLL_FILE is the DLL library, Renaissance-0.dll
296# (cygRenaissance-0.dll on Cygwin).  Include the INTERFACE_VERSION in
297# the DLL library name.  Applications are linked explicitly to this
298# INTERFACE_VERSION of the library; this works exactly in the same way
299# as under Unix.
300LIB_LINK_DLL_FILE    = $(DLL_PREFIX)$(GNUSTEP_INSTANCE)-$(subst .,_,$(INTERFACE_VERSION))$(DLL_LIBEXT)
301
302FRAMEWORK_OBJ_EXT = $(DLL_LIBEXT)
303endif # BUILD_DLL
304
305FRAMEWORK_FILE_NAME = $(FRAMEWORK_LIBRARY_DIR_NAME)/$(VERSION_FRAMEWORK_LIBRARY_FILE)
306FRAMEWORK_FILE = $(GNUSTEP_BUILD_DIR)/$(FRAMEWORK_FILE_NAME)
307
308ifneq ($($(GNUSTEP_INSTANCE)_INSTALL_DIR),)
309  FRAMEWORK_INSTALL_DIR = $($(GNUSTEP_INSTANCE)_INSTALL_DIR)
310endif
311
312ifeq ($(FRAMEWORK_INSTALL_DIR),)
313  FRAMEWORK_INSTALL_DIR = $(GNUSTEP_FRAMEWORKS)
314endif
315
316#
317# Now prepare the variables which are used by target-dependent commands
318# defined in target.make
319#
320LIB_LINK_OBJ_DIR = $(FRAMEWORK_LIBRARY_DIR)
321LIB_LINK_VERSION_FILE = $(VERSION_FRAMEWORK_LIBRARY_FILE)
322LIB_LINK_SONAME_FILE = $(SONAME_FRAMEWORK_FILE)
323LIB_LINK_FILE = $(FRAMEWORK_LIBRARY_FILE)
324LIB_LINK_INSTALL_DIR = $(FRAMEWORK_INSTALL_DIR)/$(FRAMEWORK_LIBRARY_DIR_NAME)
325
326ifneq ($(DYLIB_INSTALL_NAME_BASE),)
327  LIB_LINK_INSTALL_NAME = $(DYLIB_INSTALL_NAME_BASE)/$(FRAMEWORK_FILE_NAME)
328else
329  # Use a relative path for easy relocation.
330  LIB_LINK_INSTALL_NAME = $(GNUSTEP_INSTANCE).framework/$(GNUSTEP_INSTANCE)
331
332  # On Mac OS X, set absolute install_name if requested
333  ifeq ($(findstring darwin, $(GNUSTEP_TARGET_OS)), darwin)
334    ifeq ($(GNUSTEP_ABSOLUTE_INSTALL_PATHS), yes)
335      LIB_LINK_INSTALL_NAME = $(LIB_LINK_INSTALL_DIR)/$(GNUSTEP_INSTANCE)
336    endif
337  endif
338endif
339
340
341GNUSTEP_SHARED_BUNDLE_RESOURCE_PATH = $(FRAMEWORK_VERSION_DIR)/Resources
342include $(GNUSTEP_MAKEFILES)/Instance/Shared/bundle.make
343
344internal-framework-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) $(OBJ_DIRS_TO_CREATE) \
345                          build-framework
346# If they specified Info-gnustep.plist in the xxx_RESOURCE_FILES,
347# print a warning. They are supposed to provide a xxxInfo.plist which
348# gets merged with the automatically generated entries to generate
349# Info-gnustep.plist.
350ifneq ($(FOUNDATION_LIB), apple)
351  ifneq ($(filter Info-gnustep.plist,$($(GNUSTEP_INSTANCE)_RESOURCE_FILES)),)
352	$(WARNING_INFO_GNUSTEP_PLIST)
353  endif
354else
355  ifneq ($(filter Info.plist,$($(GNUSTEP_INSTANCE)_RESOURCE_FILES)),)
356	$(WARNING_INFO_PLIST)
357  endif
358endif
359
360internal-framework-build-headers:: $(FRAMEWORK_VERSION_DIR)/Headers \
361                                   $(FRAMEWORK_HEADER_SUBDIRS) \
362                                   $(FRAMEWORK_HEADER_FILES) \
363                                   build-framework-dirs
364
365ifeq ($(MAKE_CURRENT_VERSION),yes)
366
367# A target to build/reset the Current symlink to point to the newly
368# compiled framework.  Only executed if MAKE_CURRENT_VERSION is yes,
369# and only executed if the symlink doesn't exist yet, or if
370# FRAMEWORK_VERSION_DIR is newer than the symlink.  This is to avoid
371# rebuilding the symlink every single time, which is a waste of time.
372UPDATE_CURRENT_SYMLINK_RULE = $(FRAMEWORK_DIR)/Versions/Current
373$(FRAMEWORK_DIR)/Versions/Current: $(FRAMEWORK_VERSION_DIR)
374	$(ECHO_UPDATING_VERSION_SYMLINK)cd $(FRAMEWORK_DIR)/Versions; \
375	$(RM_LN_S) Current; \
376	$(LN_S) $(CURRENT_VERSION_NAME) Current$(END_ECHO)
377
378else
379UPDATE_CURRENT_SYMLINK_RULE =
380endif
381
382# FIXME/TODO - the following rule is always executed.  This is stupid.
383# We should have some decent dependencies so that it's not executed if
384# there is nothing to build. :-)
385
386# Please note that test -h must be used instead of test -L because on
387# old Sun Solaris, test -h works but test -L does not.
388build-framework-dirs: $(DERIVED_SOURCES_DIR) \
389                      $(FRAMEWORK_LIBRARY_DIR) \
390                      $(FRAMEWORK_VERSION_DIR)/Resources \
391                      $(FRAMEWORK_RESOURCE_DIRS) \
392                      $(UPDATE_CURRENT_SYMLINK_RULE)
393ifeq ($(FRAMEWORK_VERSION_SUPPORT), yes)
394	$(ECHO_NOTHING)cd $(FRAMEWORK_DIR); \
395	  if [ ! -h "Resources" ]; then \
396	    $(RM_LN_S) Resources; \
397	    $(LN_S_RECURSIVE) Versions/Current/Resources Resources; \
398	  fi; \
399	  if [ ! -h "Headers" ]; then \
400	    $(RM_LN_S) Headers; \
401	    $(LN_S_RECURSIVE) Versions/Current/Headers Headers; \
402	  fi$(END_ECHO)
403endif
404	$(ECHO_NOTHING)cd $(DERIVED_SOURCES_DIR); \
405	  if [ ! -h "$(HEADER_FILES_INSTALL_DIR)" ]; then \
406	    $(RM_LN_S) ./$(HEADER_FILES_INSTALL_DIR); \
407	    $(LN_S_RECURSIVE) ../$(FRAMEWORK_DIR_NAME)/Headers \
408                    ./$(HEADER_FILES_INSTALL_DIR); \
409	  fi$(END_ECHO)
410
411$(FRAMEWORK_LIBRARY_DIR):
412	$(ECHO_CREATING)$(MKDIRS) $@$(END_ECHO)
413
414$(FRAMEWORK_VERSION_DIR)/Headers:
415	$(ECHO_CREATING)$(MKDIRS) $@$(END_ECHO)
416
417$(FRAMEWORK_HEADER_SUBDIRS):
418	$(ECHO_CREATING)$(MKDIRS) $@$(END_ECHO)
419
420$(DERIVED_SOURCES_DIR): $(DERIVED_SOURCES_DIR)/.stamp
421$(DERIVED_SOURCES_DIR)/.stamp:
422	$(ECHO_CREATING)$(MKDIRS) $(DERIVED_SOURCES_DIR); \
423	touch $@$(END_ECHO)
424
425# Need to share this code with the headers code ... but how.
426
427# IMPORTANT: It is tempting to have a file (a header, in this case)
428# depend on the directory in which we want to create it (the
429# .../Headers/ directory in this case).  The idea being that make
430# would automatically create the directory before the file.  That
431# might work for a single file, but could trigger spurious rebuilds if
432# you have more than one file in the directory.  The first file will
433# create the directory, then create the file.  The second file will be
434# created inside the directory; but on some filesystems, creating the
435# file inside the directory then updates the 'last modified' timestamp
436# of the directory.  So next time you run make, the directory is
437# 'newer' than the first file, and because the first file depends on
438# the directory, make will determine that it needs to be updated,
439# triggering a spurious recreation of the file.  If you also have
440# auto-dependencies turned on, this might in turn cause recompilation
441# and further spurious rebuilding to happen.
442$(FRAMEWORK_VERSION_DIR)/Headers/%.h: $(HEADER_FILES_DIR)/%.h
443	$(ECHO_CREATING)$(INSTALL_DATA) $< $@$(END_ECHO)
444
445OBJC_OBJ_FILES_TO_INSPECT = $(OBJC_OBJ_FILES) $(SUBPROJECT_OBJ_FILES)
446
447# FIXME - We should not depend on GNUmakefile - rather we should use
448# Instance/Shared/stamp-string.make if we need to depend on the value
449# of some make variables.  That would also detect a change in
450# FRAMEWORK_INSTALL_DIR from the command line, not currently covered
451# at the moment!
452#
453# To get the list of all classes, we use
454# $(EXTRACT_CLASS_NAMES_COMMAND), which is defined in target.make
455#
456#
457# The following rule will also build the DUMMY_FRAMEWORK_CLASS_LIST
458# file.  This file is always created/deleted at the same time as the
459# DUMMY_FRAMEWORK_FILE.
460$(DUMMY_FRAMEWORK_FILE): $(DERIVED_SOURCES_DIR)/.stamp $(OBJ_FILES_TO_LINK) GNUmakefile
461	$(ECHO_CREATING) classes=""; \
462	for object_file in $(OBJC_OBJ_FILES_TO_INSPECT) __dummy__; do \
463	  if [ "$$object_file" != "__dummy__" ]; then \
464	    sym=`$(EXTRACT_CLASS_NAMES_COMMAND)`; \
465	    classes="$$classes $$sym"; \
466	  fi; \
467	done; \
468	classlist=""; \
469	classarray=""; \
470	for f in $$classes __dummy__ ; do \
471	  if [ "$$f" != "__dummy__" ]; then \
472	    if [ "$$classlist" = "" ]; then \
473	      classlist="@\"$$f\""; \
474	      classarray="(\"$$f\""; \
475	    else \
476	      classlist="$$classlist, @\"$$f\""; \
477	      classarray="$$classarray, \"$$f\""; \
478	    fi; \
479	  fi; \
480	done; \
481	if [ "$$classlist" = "" ]; then \
482	  classlist="NULL"; \
483	  classarray="()"; \
484	else \
485	  classlist="$$classlist, NULL"; \
486	  classarray="$$classarray)"; \
487	fi; \
488	echo "$$classarray" > $(DUMMY_FRAMEWORK_CLASS_LIST); \
489	echo "#include <Foundation/NSObject.h>" > $@; \
490	echo "#include <Foundation/NSString.h>" > $@; \
491	echo "@interface $(DUMMY_FRAMEWORK) : NSObject" >> $@; \
492	echo "+ (NSString *)frameworkVersion;" >> $@; \
493	echo "+ (NSString *const*)frameworkClasses;" >> $@; \
494	echo "@end" >> $@; \
495	echo "@implementation $(DUMMY_FRAMEWORK)" >> $@; \
496	echo "+ (NSString *)frameworkVersion { return @\"$(CURRENT_VERSION_NAME)\"; }" >> $@; \
497	echo "static NSString *allClasses[] = {$$classlist};" >> $@; \
498	echo "+ (NSString *const*)frameworkClasses { return allClasses; }" >> $@;\
499	echo "@end" >> $@$(END_ECHO)
500
501ifeq ($(FOUNDATION_LIB),gnu)
502$(DUMMY_FRAMEWORK_OBJ_FILE): $(DUMMY_FRAMEWORK_FILE)
503	$(ECHO_COMPILING)$(CC) $< -c $(ALL_CPPFLAGS) $(ALL_OBJCFLAGS) -o $@$(END_ECHO)
504endif
505
506ifeq ($(FOUNDATION_LIB),gnu)
507  FRAMEWORK_INFO_PLIST_FILE = Info-gnustep.plist
508else
509  FRAMEWORK_INFO_PLIST_FILE = Info.plist
510endif
511
512ifeq ($(FRAMEWORK_VERSION_SUPPORT), yes)
513build-framework: internal-framework-run-compile-submake \
514                 shared-instance-bundle-all \
515                 $(FRAMEWORK_VERSION_DIR)/Resources/$(FRAMEWORK_INFO_PLIST_FILE) \
516                 $(GNUSTEP_BUILD_DIR)/$(GNUSTEP_INSTANCE).framework/$(GNUSTEP_TARGET_LDIR)/$(GNUSTEP_INSTANCE)
517else
518build-framework: internal-framework-run-compile-submake \
519                 shared-instance-bundle-all \
520                 $(FRAMEWORK_VERSION_DIR)/Resources/$(FRAMEWORK_INFO_PLIST_FILE)
521endif
522
523ifeq ($(findstring darwin, $(GNUSTEP_TARGET_OS)), darwin)
524# When building native frameworks on Apple, we need to create a
525# top-level symlink xxx.framework/xxx ---> the framework shared
526# library. On Darwin (non-Apple) we do this as well since we can partially
527# emulate frameworks (see the ld_lib_path.sh comments on this).
528
529# Please note that the following keeps the top-level symlink pointing
530# to the framework in Current.  This is always correct, even if what
531# we are compiling is not made the Current framework version, but if
532# what we are compiling is not made the Current framework version, I
533# think it's not our business to touch the Current stuff, so let's
534# ignore it.  It's faster to ignore it anyway. ;-)
535$(GNUSTEP_BUILD_DIR)/$(GNUSTEP_INSTANCE).framework/$(GNUSTEP_TARGET_LDIR):
536	$(ECHO_CREATING)$(MKDIRS) $@$(END_ECHO)
537
538$(GNUSTEP_BUILD_DIR)/$(GNUSTEP_INSTANCE).framework/$(GNUSTEP_TARGET_LDIR)/$(GNUSTEP_INSTANCE): $(GNUSTEP_BUILD_DIR)/$(GNUSTEP_INSTANCE).framework/$(GNUSTEP_TARGET_LDIR)
539ifeq ($(MAKE_CURRENT_VERSION),yes)
540	$(ECHO_NOTHING)cd $(GNUSTEP_BUILD_DIR)/$(GNUSTEP_INSTANCE).framework; \
541	$(RM_LN_S) $(GNUSTEP_INSTANCE); \
542	$(LN_S) Versions/Current/$(GNUSTEP_TARGET_LDIR)/$(GNUSTEP_INSTANCE) $(GNUSTEP_INSTANCE)$(END_ECHO)
543endif
544
545else
546
547# We create a top-level symlink (/copy)
548#
549# xxx.framework/{TARGET_LDIR}/xxx --> <the Current framework {TARGET_LDIR}/object file>
550#
551# And also
552#
553# xxx.framework/{TARGET_LDIR}/libxxx.so --> <the Current framework {TARGET_LDIR}/libxxx.so file>
554#
555# On Windows, we don't do any of this since there are no versions anyway.
556#
557# The reason for doing this is that you can link against the uninstalled framework
558# by just using -Lpath_to_the_framework/xxx.framework/$TARGET_LDIR
559#
560ifeq ($(FRAMEWORK_VERSION_SUPPORT), yes)
561$(GNUSTEP_BUILD_DIR)/$(GNUSTEP_INSTANCE).framework/$(GNUSTEP_TARGET_LDIR):
562	$(ECHO_CREATING)$(MKDIRS) $@$(END_ECHO)
563
564$(GNUSTEP_BUILD_DIR)/$(GNUSTEP_INSTANCE).framework/$(GNUSTEP_TARGET_LDIR)/$(GNUSTEP_INSTANCE): $(GNUSTEP_BUILD_DIR)/$(GNUSTEP_INSTANCE).framework/$(GNUSTEP_TARGET_LDIR)
565ifeq ($(MAKE_CURRENT_VERSION),yes)
566	$(ECHO_NOTHING)cd $(GNUSTEP_BUILD_DIR)/$(GNUSTEP_INSTANCE).framework/$(GNUSTEP_TARGET_LDIR); \
567	$(RM_LN_S) $(GNUSTEP_INSTANCE) $(FRAMEWORK_LIBRARY_FILE); \
568	$(LN_S) `$(REL_PATH_SCRIPT) $(GNUSTEP_TARGET_LDIR) \
569	                            Versions/Current/$(GNUSTEP_TARGET_LDIR)/$(GNUSTEP_INSTANCE) short` \
570	        $(GNUSTEP_INSTANCE); \
571	$(LN_S) `$(REL_PATH_SCRIPT) $(GNUSTEP_TARGET_LDIR) \
572	                            Versions/Current/$(GNUSTEP_TARGET_LDIR)/$(FRAMEWORK_LIBRARY_FILE) short` \
573	        $(FRAMEWORK_LIBRARY_FILE)$(END_ECHO)
574endif
575endif
576endif
577
578ifneq ($(BUILD_DLL), yes)
579  LIB_LINK_FRAMEWORK_FILE = $(LIB_LINK_FILE)
580else
581  LIB_LINK_FRAMEWORK_FILE = $(LIB_LINK_DLL_FILE)
582endif
583
584LIB_LINK_FILES_TO_LINK = $(OBJ_FILES_TO_LINK)
585
586# Important: FRAMEWORK_FILE (which is created in the parallel
587# 'compile' invocation) depends on DUMMY_FRAMEWORK_OBJ_FILES as well,
588# which depends on a lot of other rules.  These rules *must* be safe
589# for parallel building, because they will be used during a parallel
590# build.  In particular, note that DUMMY_FRAMEWORK_OBJ_FILE must
591# itself depend on OBJ_FILES_TO_LINK else it might be built before all
592# files are compiled.
593$(FRAMEWORK_FILE): $(DUMMY_FRAMEWORK_OBJ_FILE) $(OBJ_FILES_TO_LINK)
594ifeq ($(OBJ_FILES_TO_LINK),)
595	$(WARNING_EMPTY_LINKING)
596endif
597	$(ECHO_LINKING) \
598	$(LIB_LINK_CMD) || $(RM) $(FRAMEWORK_FILE) ; \
599	(cd $(LIB_LINK_OBJ_DIR); \
600	  $(RM_LN_S) $(GNUSTEP_INSTANCE); \
601	  $(LN_S) $(LIB_LINK_FRAMEWORK_FILE) $(GNUSTEP_INSTANCE)) \
602	$(END_ECHO)
603
604ifeq ($(GNUSTEP_MAKE_PARALLEL_BUILDING), no)
605# Standard building
606internal-framework-run-compile-submake: $(FRAMEWORK_FILE)
607else
608# Parallel building.  The actual compilation is delegated to a
609# sub-make invocation where _GNUSTEP_MAKE_PARALLEL is set to yet.
610# That sub-make invocation will compile files in parallel.
611internal-framework-run-compile-submake:
612	$(ECHO_NOTHING_RECURSIVE_MAKE)$(MAKE) -f $(MAKEFILE_NAME) --no-print-directory --no-keep-going \
613	internal-framework-compile \
614	GNUSTEP_TYPE=$(GNUSTEP_TYPE) \
615	GNUSTEP_INSTANCE=$(GNUSTEP_INSTANCE) \
616	GNUSTEP_OPERATION=compile \
617	GNUSTEP_BUILD_DIR="$(GNUSTEP_BUILD_DIR)" \
618	_GNUSTEP_MAKE_PARALLEL=yes$(END_ECHO_RECURSIVE_MAKE)
619
620internal-framework-compile: $(FRAMEWORK_FILE)
621endif
622
623PRINCIPAL_CLASS = $(strip $($(GNUSTEP_INSTANCE)_PRINCIPAL_CLASS))
624
625ifeq ($(PRINCIPAL_CLASS),)
626  PRINCIPAL_CLASS = $(GNUSTEP_INSTANCE)
627endif
628
629MAIN_MODEL_FILE = $(strip $(subst .gmodel,,$(subst .gorm,,$(subst .nib,,$($(GNUSTEP_INSTANCE)_MAIN_MODEL_FILE)))))
630
631# FIXME: Use stamp.make to depend on the value of MAIN_MODEL_FILE and PRINCIPAL_CLASS
632
633# FIXME: MacOSX frameworks should also merge xxxInfo.plist into them
634# MacOSX-S frameworks
635$(FRAMEWORK_VERSION_DIR)/Resources/Info.plist:
636	$(ECHO_CREATING)(echo "{"; echo '  NOTE = "Automatically generated, do not edit!";'; \
637	  echo "  NSExecutable = \"$(GNUSTEP_INSTANCE)\";"; \
638	  echo "  NSMainNibFile = \"$(MAIN_MODEL_FILE)\";"; \
639	  echo "  NSPrincipalClass = \"$(PRINCIPAL_CLASS)\";"; \
640	  echo "}") >$@$(END_ECHO)
641
642# GNUstep frameworks
643$(FRAMEWORK_VERSION_DIR)/Resources/Info-gnustep.plist: \
644                        $(DUMMY_FRAMEWORK_FILE) \
645                        $(GNUSTEP_PLIST_DEPEND)
646	$(ECHO_CREATING)(echo "{"; echo '  NOTE = "Automatically generated, do not edit!";'; \
647	  echo "  NSExecutable = \"$(GNUSTEP_INSTANCE)$(FRAMEWORK_OBJ_EXT)\";"; \
648	  echo "  NSMainNibFile = \"$(MAIN_MODEL_FILE)\";"; \
649	  echo "  NSPrincipalClass = \"$(PRINCIPAL_CLASS)\";"; \
650	  echo "  Classes = "; \
651	  cat $(DUMMY_FRAMEWORK_CLASS_LIST); \
652	  echo "  ;"; \
653	  echo "}") >$@$(END_ECHO)
654	$(ECHO_NOTHING)if [ -r "$(GNUSTEP_PLIST_DEPEND)" ]; then \
655	   plmerge $@ $(GNUSTEP_PLIST_DEPEND); \
656	 fi$(END_ECHO)
657
658ifneq ($(BUILD_DLL),yes)
659
660ifeq ($(FOUNDATION_LIB),gnu)
661
662internal-framework-install_:: $(FRAMEWORK_INSTALL_DIR) \
663                      $(GNUSTEP_LIBRARIES)/$(GNUSTEP_TARGET_LDIR) \
664                      $(GNUSTEP_HEADERS) shared-instance-pkgconfig-install
665	$(ECHO_INSTALLING)(cd $(GNUSTEP_BUILD_DIR); \
666	  $(TAR) cfX - $(GNUSTEP_MAKEFILES)/tar-exclude-list \
667	    $(FRAMEWORK_DIR_NAME)) \
668	    | (cd $(FRAMEWORK_INSTALL_DIR); $(TAR) xf -)$(END_ECHO)
669ifneq ($(CHOWN_TO),)
670	$(ECHO_CHOWNING)$(CHOWN) -R $(CHOWN_TO) $(FRAMEWORK_INSTALL_DIR)/$(FRAMEWORK_DIR_NAME)$(END_ECHO)
671endif
672ifeq ($(strip),yes)
673	$(ECHO_STRIPPING)$(STRIP) $(FRAMEWORK_INSTALL_DIR)/$(FRAMEWORK_FILE_NAME)$(END_ECHO)
674endif
675	$(ECHO_INSTALLING_HEADERS)cd $(GNUSTEP_HEADERS); \
676	$(RM_LN_S) $(HEADER_FILES_INSTALL_DIR); \
677	$(LN_S_RECURSIVE) `$(REL_PATH_SCRIPT) $(GNUSTEP_HEADERS) $(FRAMEWORK_INSTALL_DIR)/$(FRAMEWORK_DIR_NAME)/Headers short` $(HEADER_FILES_INSTALL_DIR); \
678	$(END_ECHO)
679ifneq ($(CHOWN_TO),)
680	$(ECHO_CHOWNING)cd $(GNUSTEP_HEADERS); \
681	$(CHOWN) $(CHOWN_TO) $(HEADER_FILES_INSTALL_DIR); \
682	$(END_ECHO)
683endif
684	$(ECHO_NOTHING)cd $(GNUSTEP_LIBRARIES)/$(GNUSTEP_TARGET_LDIR); \
685	$(RM_LN_S) $(FRAMEWORK_LIBRARY_FILE); \
686	$(RM_LN_S) $(SONAME_FRAMEWORK_FILE); \
687	$(RM_LN_S) $(VERSION_FRAMEWORK_LIBRARY_FILE); \
688	$(LN_S) `$(REL_PATH_SCRIPT) $(GNUSTEP_LIBRARIES)/$(GNUSTEP_TARGET_LDIR) $(FRAMEWORK_INSTALL_DIR)/$(FRAMEWORK_CURRENT_LIBRARY_DIR_NAME)/$(FRAMEWORK_LIBRARY_FILE) short` $(FRAMEWORK_LIBRARY_FILE); \
689	if test -r "$(FRAMEWORK_INSTALL_DIR)/$(FRAMEWORK_LIBRARY_DIR_NAME)/$(SONAME_FRAMEWORK_FILE)"; then \
690	  $(LN_S) `$(REL_PATH_SCRIPT) $(GNUSTEP_LIBRARIES)/$(GNUSTEP_TARGET_LDIR) $(FRAMEWORK_INSTALL_DIR)/$(FRAMEWORK_LIBRARY_DIR_NAME)/$(SONAME_FRAMEWORK_FILE) short` $(SONAME_FRAMEWORK_FILE); \
691	fi; \
692	$(LN_S) `$(REL_PATH_SCRIPT) $(GNUSTEP_LIBRARIES)/$(GNUSTEP_TARGET_LDIR) $(FRAMEWORK_INSTALL_DIR)/$(FRAMEWORK_LIBRARY_DIR_NAME)/$(VERSION_FRAMEWORK_LIBRARY_FILE) short` $(VERSION_FRAMEWORK_LIBRARY_FILE)$(END_ECHO)
693ifneq ($(CHOWN_TO),)
694	$(ECHO_CHOWNING)cd $(GNUSTEP_LIBRARIES)/$(GNUSTEP_TARGET_LDIR); \
695	$(CHOWN) $(CHOWN_TO) $(FRAMEWORK_LIBRARY_FILE); \
696	if test -r "$(SONAME_FRAMEWORK_FILE)"; then \
697	  $(CHOWN) $(CHOWN_TO) $(SONAME_FRAMEWORK_FILE); \
698	fi; \
699	$(CHOWN) $(CHOWN_TO) $(VERSION_FRAMEWORK_LIBRARY_FILE)$(END_ECHO)
700endif
701
702else
703
704# This code for Apple OSX
705
706internal-framework-install_:: $(FRAMEWORK_INSTALL_DIR)
707	$(ECHO_INSTALLING)rm -rf $(FRAMEWORK_INSTALL_DIR)/$(FRAMEWORK_DIR_NAME); \
708	(cd $(GNUSTEP_BUILD_DIR); $(TAR) cfX - $(GNUSTEP_MAKEFILES)/tar-exclude-list $(FRAMEWORK_DIR_NAME)) | (cd $(FRAMEWORK_INSTALL_DIR); $(TAR) xf -)$(END_ECHO)
709ifneq ($(CHOWN_TO),)
710	$(ECHO_CHOWNING)$(CHOWN) -R $(CHOWN_TO) $(FRAMEWORK_INSTALL_DIR)/$(FRAMEWORK_DIR_NAME)$(END_ECHO)
711endif
712ifeq ($(strip),yes)
713	$(ECHO_STRIPPING)$(STRIP) $(FRAMEWORK_INSTALL_DIR)/$(FRAMEWORK_FILE_NAME)$(END_ECHO)
714endif
715
716endif
717
718else # install DLL
719
720internal-framework-install_:: $(FRAMEWORK_INSTALL_DIR) \
721                      $(GNUSTEP_LIBRARIES)/$(GNUSTEP_TARGET_LDIR) \
722                      $(GNUSTEP_HEADERS) \
723                      $(DLL_INSTALLATION_DIR)
724	$(ECHO_INSTALLING)\
725	rm -rf $(FRAMEWORK_INSTALL_DIR)/$(FRAMEWORK_DIR_NAME); \
726	(cd $(GNUSTEP_BUILD_DIR);\
727	 $(TAR) cfX - $(GNUSTEP_MAKEFILES)/tar-exclude-list \
728	        $(FRAMEWORK_DIR_NAME)) | (cd $(FRAMEWORK_INSTALL_DIR); \
729	                                  $(TAR) xf -)$(END_ECHO)
730ifneq ($(CHOWN_TO),)
731	$(ECHO_CHOWNING)$(CHOWN) -R $(CHOWN_TO) $(FRAMEWORK_INSTALL_DIR)/$(FRAMEWORK_DIR_NAME)$(END_ECHO)
732endif
733ifeq ($(strip),yes)
734	$(ECHO_STRIPPING)$(STRIP) $(FRAMEWORK_INSTALL_DIR)/$(FRAMEWORK_FILE_NAME)$(END_ECHO)
735endif
736	$(ECHO_INSTALLING_HEADERS)cd $(GNUSTEP_HEADERS); \
737	if test -d "$(HEADER_FILES_INSTALL_DIR)"; then \
738	  rm -Rf $(HEADER_FILES_INSTALL_DIR); \
739	fi; \
740        $(MKINSTALLDIRS) $(HEADER_FILES_INSTALL_DIR); \
741	cd $(FRAMEWORK_INSTALL_DIR)/$(FRAMEWORK_VERSION_DIR_NAME)/Headers ; \
742          $(TAR) cfX - $(GNUSTEP_MAKEFILES)/tar-exclude-list . | (cd  $(GNUSTEP_HEADERS)/$(HEADER_FILES_INSTALL_DIR); \
743          $(TAR) xf - ); \
744	$(END_ECHO)
745ifneq ($(CHOWN_TO),)
746	$(ECHO_CHOWNING)cd $(GNUSTEP_HEADERS); \
747	$(CHOWN) -R $(CHOWN_TO) $(HEADER_FILES_INSTALL_DIR); \
748	$(END_ECHO)
749endif
750	$(ECHO_NOTHING)$(INSTALL_PROGRAM) $(FRAMEWORK_LIBRARY_DIR)/$(LIB_LINK_DLL_FILE) \
751          $(DLL_INSTALLATION_DIR)$(END_ECHO)
752	$(ECHO_NOTHING)$(INSTALL_PROGRAM) $(FRAMEWORK_FILE_NAME) \
753	  $(GNUSTEP_LIBRARIES)/$(GNUSTEP_TARGET_LDIR)$(END_ECHO)
754
755endif
756
757$(DLL_INSTALLATION_DIR):
758	$(ECHO_CREATING)$(MKINSTALLDIRS) $@$(END_ECHO)
759
760# If Version support is disabled, then this directory is the same as
761# the Resources directory in Shared/bundle.make for which we already
762# have a rule.
763ifeq ($(FRAMEWORK_VERSION_SUPPORT), yes)
764$(FRAMEWORK_DIR)/Resources:
765	$(ECHO_CREATING)$(MKDIRS) $@$(END_ECHO)
766endif
767
768$(FRAMEWORK_INSTALL_DIR):
769	$(ECHO_CREATING)$(MKINSTALLDIRS) $@$(END_ECHO)
770
771$(GNUSTEP_LIBRARIES)/$(GNUSTEP_TARGET_LDIR):
772	$(ECHO_CREATING)$(MKINSTALLDIRS) $@$(END_ECHO)
773
774$(GNUSTEP_HEADERS):
775	$(ECHO_CREATING)$(MKINSTALLDIRS) $@$(END_ECHO)
776
777ifneq ($(BUILD_DLL), yes)
778# NB: We use '$(RM_LN_S)' to remove the symlinks to insure
779#     that we do not remove customized real directories.
780internal-framework-uninstall_:: shared-instance-pkgconfig-uninstall
781	$(ECHO_UNINSTALLING)if [ "$(HEADER_FILES)" != "" ]; then \
782	  for file in $(HEADER_FILES) __done; do \
783	    if [ $$file != __done ]; then \
784	      rm -rf $(GNUSTEP_HEADERS)/$(HEADER_FILES_INSTALL_DIR)/$$file ; \
785	    fi; \
786	  done; \
787	fi; \
788	$(RM_LN_S) $(GNUSTEP_HEADERS)/$(HEADER_FILES_INSTALL_DIR) ; \
789	rm -rf $(FRAMEWORK_INSTALL_DIR)/$(FRAMEWORK_DIR_NAME) ; \
790	cd $(GNUSTEP_LIBRARIES)/$(GNUSTEP_TARGET_LDIR); \
791	$(RM_LN_S) $(FRAMEWORK_LIBRARY_FILE); \
792	$(RM_LN_S) $(SONAME_FRAMEWORK_FILE); \
793	$(RM_LN_S) $(VERSION_FRAMEWORK_LIBRARY_FILE); \
794	$(END_ECHO)
795else
796internal-framework-uninstall_::
797	$(ECHO_UNINSTALLING)if [ "$(HEADER_FILES)" != "" ]; then \
798	  for file in $(HEADER_FILES) __done; do \
799	    if [ $$file != __done ]; then \
800	      rm -rf $(GNUSTEP_HEADERS)/$(HEADER_FILES_INSTALL_DIR)/$$file ; \
801	    fi; \
802	  done; \
803	fi; \
804	$(RM_LN_S) $(GNUSTEP_HEADERS)/$(HEADER_FILES_INSTALL_DIR) ; \
805	rm -rf $(FRAMEWORK_INSTALL_DIR)/$(FRAMEWORK_DIR_NAME) ; \
806	cd $(GNUSTEP_LIBRARIES)/$(GNUSTEP_TARGET_LDIR); \
807	$(RM_LN_S) $(FRAMEWORK_LIBRARY_FILE); \
808	cd $(DLL_INSTALLATION_DIR); \
809	$(RM_LN_S) $(LIB_LINK_DLL_FILE); \
810	$(END_ECHO)
811endif
812
813internal-framework-check::
814ifneq ($($(GNUSTEP_INSTANCE)_TEST_DIR),)
815	@(\
816        touch $($(GNUSTEP_INSTANCE)_TEST_DIR)/TestInfo; \
817	echo "# Generated by 'make check'" \
818	  > $($(GNUSTEP_INSTANCE)_TEST_DIR)/make-check.env; \
819	echo "export LD_LIBRARY_PATH=\"$$(pwd)/$(GNUSTEP_INSTANCE).framework:$(LD_LIBRARY_PATH)\"" > $($(GNUSTEP_INSTANCE)_TEST_DIR)/make-check.env; \
820	echo "# Generated by 'make check'" \
821	  > $($(GNUSTEP_INSTANCE)_TEST_DIR)/make-check.mak; \
822	echo "ADDITIONAL_INCLUDE_DIRS += \"-I$(GNUSTEP_MAKEFILES)/TestFramework\" \"-I$(FRAMEWORK_VERSION_DIR)/Headers\"" \
823	  >> $($(GNUSTEP_INSTANCE)_TEST_DIR)/make-check.mak; \
824	echo "ADDITIONAL_LDFLAGS += \"-Wl,-rpath,$$(pwd)/$(GNUSTEP_INSTANCE).framework\"" \ >> $($(GNUSTEP_INSTANCE)_TEST_DIR)/make-check.mak; \
825	echo "ADDITIONAL_LIB_DIRS += \"-L$(FRAMEWORK_VERSION_DIR))\"" \
826	  >> $($(GNUSTEP_INSTANCE)_TEST_DIR)/make-check.mak; \
827	echo "ADDITIONAL_TOOL_LIBS += \"-l$(GNUSTEP_INSTANCE)\"" \
828	  >> $($(GNUSTEP_INSTANCE)_TEST_DIR)/make-check.mak; \
829        unset MAKEFLAGS; \
830	if [ "$(DEBUG)" = "" ]; then \
831	  gnustep-tests --verbose $($(GNUSTEP_INSTANCE)_TEST_DIR);\
832	else \
833	  gnustep-tests --debug $($(GNUSTEP_INSTANCE)_TEST_DIR);\
834	fi;\
835	)
836endif
837
838#
839# Cleaning targets
840#
841internal-framework-clean::
842	$(ECHO_NOTHING)rm -rf \
843	       $(PSWRAP_C_FILES) $(PSWRAP_H_FILES) \
844	       $(FRAMEWORK_DIR) $(DERIVED_SOURCES_DIR)$(END_ECHO)
845
846internal-framework-distclean::
847
848include $(GNUSTEP_MAKEFILES)/Instance/Shared/strings.make
849