1#  -*-makefile-*-
2#   rules.make
3#
4#   Makefile rules for the Instance invocation.
5#
6#   Copyright (C) 1997, 2001, 2002 Free Software Foundation, Inc.
7#
8#   Author:  Scott Christley <scottc@net-community.com>
9#   Author:  Ovidiu Predescu <ovidiu@net-community.com>
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
24
25# Every project should have its internal-xxx-all depend first on
26# before-$(GNUSTEP_INSTANCE)-all, and last on
27# after-$(GNUSTEP_INSTANCE)-all.  We declare them here, empty, so that
28# the user can add them if he wants, but if he doesn't, make doesn't
29# complain about missing targets.
30
31# NB: internal-$(GNUSTEP_TYPE)-all_ should not be declared .PHONY
32# here, because it's not implemented here.  (example of how could go
33# wrong otherwise: if say internal-clibrary-all_ depends on
34# internal-library-all_, both of them should be declared .PHONY, while
35# here we would only declare one of them .PHONY, so it should be done
36# by the project specific makefile fragments).
37.PHONY: \
38 internal-precompile-headers \
39 before-$(GNUSTEP_INSTANCE)-all after-$(GNUSTEP_INSTANCE)-all \
40 internal-$(GNUSTEP_TYPE)-all \
41 before-$(GNUSTEP_INSTANCE)-jar after-$(GNUSTEP_INSTANCE)-jar \
42 internal-$(GNUSTEP_TYPE)-jar \
43 before-$(GNUSTEP_INSTANCE)-install after-$(GNUSTEP_INSTANCE)-install \
44 internal-$(GNUSTEP_TYPE)-install \
45 before-$(GNUSTEP_INSTANCE)-uninstall after-$(GNUSTEP_INSTANCE)-uninstall \
46 internal-$(GNUSTEP_TYPE)-uninstall
47
48# By adding the line
49#   xxx_COPY_INTO_DIR = ../Vanity.framework/Resources
50# to you GNUmakefile, you cause the after-xxx-all:: stage of
51# compilation of xxx to copy the created stuff into the *local*
52# directory ../Vanity.framework/Resources (this path should be
53# relative).  It also disables installation of xxx.
54#
55# This is normally used, for example, to bundle a tool into a
56# framework.  You compile the framework, then the tool, then you can
57# request the tool to be copied into the framework, becoming part of
58# the framework (it is installed with the framework etc).
59#
60COPY_INTO_DIR = $(strip $($(GNUSTEP_INSTANCE)_COPY_INTO_DIR))
61
62# If COPY_INTO_DIR is non-empty, we'll execute below an additional
63# target at the end of compilation:
64# internal-$(GNUSTEP_TYPE)-copy_into_dir
65
66# Centrally disable standard installation if COPY_INTO_DIR is non-empty.
67ifneq ($(COPY_INTO_DIR),)
68  $(GNUSTEP_INSTANCE)_STANDARD_INSTALL = no
69endif
70
71before-$(GNUSTEP_INSTANCE)-all::
72
73after-$(GNUSTEP_INSTANCE)-all::
74
75# Automatically run before-$(GNUSTEP_INSTANCE)-all before building,
76# and after-$(GNUSTEP_INSTANCE)-all after building.
77# The project-type specific makefile instance fragment only needs to provide
78# the internal-$(GNUSTEP_TYPE)-all_ rule.
79
80ifeq ($(COPY_INTO_DIR),)
81internal-$(GNUSTEP_TYPE)-all:: internal-precompile-headers \
82                               before-$(GNUSTEP_INSTANCE)-all \
83                               internal-$(GNUSTEP_TYPE)-all_  \
84                               after-$(GNUSTEP_INSTANCE)-all
85else
86internal-$(GNUSTEP_TYPE)-all:: internal-precompile-headers \
87                               before-$(GNUSTEP_INSTANCE)-all \
88                               internal-$(GNUSTEP_TYPE)-all_  \
89                               after-$(GNUSTEP_INSTANCE)-all \
90                               internal-$(GNUSTEP_TYPE)-copy_into_dir
91# To copy into a dir, we always have to first make sure the dir exists :-)
92$(COPY_INTO_DIR):
93	$(ECHO_CREATING)$(MKDIRS) $@$(END_ECHO)
94
95# The specific project-type makefiles will add more commands.
96internal-$(GNUSTEP_TYPE)-copy_into_dir:: $(COPY_INTO_DIR)
97endif
98
99before-$(GNUSTEP_INSTANCE)-jar::
100
101after-$(GNUSTEP_INSTANCE)-jar::
102
103before-$(GNUSTEP_INSTANCE)-install::
104
105after-$(GNUSTEP_INSTANCE)-install::
106
107before-$(GNUSTEP_INSTANCE)-uninstall::
108
109after-$(GNUSTEP_INSTANCE)-uninstall::
110
111# By adding the line
112#   xxxx_STANDARD_INSTALL = no
113# to your GNUmakefile, you can disable the standard installation code
114# for a certain GNUSTEP_INSTANCE.  This can be useful if you are
115# installing manually in some other way (or for some other reason you
116# don't want installation to be performed ever) and don't want the
117# standard installation to be performed.  Please note that
118# before-xxx-install and after-xxx-install are still executed, so if
119# you want, you can add your code in those targets to perform your
120# custom installation.
121
122ifeq ($($(GNUSTEP_INSTANCE)_STANDARD_INSTALL),no)
123
124internal-$(GNUSTEP_TYPE)-install:: before-$(GNUSTEP_INSTANCE)-install \
125                                   after-$(GNUSTEP_INSTANCE)-install
126	@echo "Skipping standard installation of $(GNUSTEP_INSTANCE) as requested by makefile"
127
128internal-$(GNUSTEP_TYPE)-uninstall:: before-$(GNUSTEP_INSTANCE)-uninstall \
129                                     after-$(GNUSTEP_INSTANCE)-uninstall
130	@echo "Skipping standard uninstallation of $(GNUSTEP_INSTANCE) as requested by makefile"
131
132else
133
134# By adding an xxx_INSTALL_DIRS variable you can request additional
135# installation directories to be created before the first installation
136# target is executed.  You can also have general
137# ADDITIONAL_INSTALL_DIRS directories that are always created before
138# install is executed; this is done top-level in the Master
139# invocation.
140$($(GNUSTEP_INSTANCE)_INSTALL_DIRS):
141	$(ECHO_CREATING)$(MKINSTALLDIRS) $@$(END_ECHO)
142
143internal-$(GNUSTEP_TYPE)-install:: $($(GNUSTEP_INSTANCE)_INSTALL_DIRS) \
144                                   before-$(GNUSTEP_INSTANCE)-install \
145                                   internal-$(GNUSTEP_TYPE)-install_  \
146                                   after-$(GNUSTEP_INSTANCE)-install
147
148# Here we remove the xxx_INSTALL_DIRS of this specific instance.  The
149# global ADDITIONAL_INSTALL_DIRS are removed in the top-level Master
150# invocation.  If we were to remove all of ADDITIONAL_INSTALL_DIRS
151# here, we'd be doing that at every single uninstall target.
152internal-$(GNUSTEP_TYPE)-uninstall:: before-$(GNUSTEP_INSTANCE)-uninstall \
153                                   internal-$(GNUSTEP_TYPE)-uninstall_  \
154                                   after-$(GNUSTEP_INSTANCE)-uninstall
155ifneq ($($(GNUSTEP_INSTANCE)_INSTALL_DIRS),)
156	-$(ECHO_NOTHING)for dir in $($(GNUSTEP_INSTANCE)_INSTALL_DIRS); do \
157	  rmdir $$dir ; \
158	done$(END_ECHO)
159endif
160
161endif
162
163# before-$(GNUSTEP_INSTANCE)-clean and similar for after and distclean
164# are not supported -- they wouldn't be executed most of the times, since
165# most of the times we don't perform an Instance invocation at all on
166# make clean or make distclean.
167
168#
169# The list of Objective-C source files to be compiled
170# are in the OBJC_FILES variable.
171#
172# The list of C source files to be compiled
173# are in the C_FILES variable.
174#
175# The list of C++ source files to be compiled
176# are in the CC_FILES variable.
177#
178# The list of Objective-C++ source files to be compiled
179# are in the OBJCC_FILES variable.
180#
181# The list of PSWRAP source files to be compiled
182# are in the PSWRAP_FILES variable.
183#
184# The list of JAVA source files to be compiled
185# are in the JAVA_FILES variable.
186#
187# The list of JAVA source files from which to generate jni headers
188# are in the JAVA_JNI_FILES variable.
189#
190# The list of WINDRES source files to be compiled
191# are in the WINDRES_FILES variable.
192#
193
194#
195# Please note the subtle difference:
196#
197# At `user' level (ie, in the user's GNUmakefile),
198# the SUBPROJECTS variable is reserved for use with aggregate.make
199# (this will be renamed to AGGREGATE_PROJECTS in a future version of
200# gnustep-make); the xxx_SUBPROJECTS variable is reserved for use with
201# subproject.make.
202#
203# This separation *must* be enforced strictly, because nothing prevents
204# a GNUmakefile from including both aggregate.make and subproject.make!
205#
206
207ifneq ($($(GNUSTEP_INSTANCE)_SUBPROJECTS),)
208SUBPROJECT_OBJ_FILES = $(foreach d, $($(GNUSTEP_INSTANCE)_SUBPROJECTS), \
209    $(addprefix $(GNUSTEP_BUILD_DIR)/$(d)/, $(GNUSTEP_OBJ_DIR_NAME)/$(SUBPROJECT_PRODUCT)))
210endif
211
212OBJC_OBJS = $(patsubst %.m,%.m$(OEXT),$($(GNUSTEP_INSTANCE)_OBJC_FILES))
213OBJC_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_INSTANCE_DIR)/,$(OBJC_OBJS))
214
215OBJCC_OBJS = $(patsubst %.mm,%.mm$(OEXT),$($(GNUSTEP_INSTANCE)_OBJCC_FILES))
216OBJCC_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_INSTANCE_DIR)/,$(OBJCC_OBJS))
217
218JAVA_OBJS = $(patsubst %.java,%.class,$($(GNUSTEP_INSTANCE)_JAVA_FILES))
219JAVA_OBJ_FILES = $(JAVA_OBJS)
220
221JAVA_JNI_OBJS = $(patsubst %.java,%.h,$($(GNUSTEP_INSTANCE)_JAVA_JNI_FILES))
222JAVA_JNI_OBJ_FILES = $(JAVA_JNI_OBJS)
223
224PSWRAP_C_FILES = $(patsubst %.psw,%.c,$($(GNUSTEP_INSTANCE)_PSWRAP_FILES))
225PSWRAP_H_FILES = $(patsubst %.psw,%.h,$($(GNUSTEP_INSTANCE)_PSWRAP_FILES))
226PSWRAP_OBJS = $(patsubst %.psw,%.c$(OEXT),$($(GNUSTEP_INSTANCE)_PSWRAP_FILES))
227PSWRAP_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_INSTANCE_DIR)/,$(PSWRAP_OBJS))
228
229C_OBJS = $(patsubst %.c,%.c$(OEXT),$($(GNUSTEP_INSTANCE)_C_FILES))
230C_OBJ_FILES = $(PSWRAP_OBJ_FILES) $(addprefix $(GNUSTEP_OBJ_INSTANCE_DIR)/,$(C_OBJS))
231
232# C++ files might end in .C, .cc, .cpp, .cxx, .cp so we replace multiple times
233CC_OBJS = $(patsubst %.cc,%.cc$(OEXT),\
234           $(patsubst %.C,%.C$(OEXT),\
235            $(patsubst %.cp,%.cp$(OEXT),\
236             $(patsubst %.cpp,%.cpp$(OEXT),\
237              $(patsubst %.cxx,%.cxx$(OEXT),$($(GNUSTEP_INSTANCE)_CC_FILES))))))
238CC_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_INSTANCE_DIR)/,$(CC_OBJS))
239
240ifeq ($(findstring mingw32, $(GNUSTEP_TARGET_OS)), mingw32)
241  WINDRES_OBJS = $(patsubst %.rc,%.rc$(OEXT),$($(GNUSTEP_INSTANCE)_WINDRES_FILES))
242  WINDRES_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_INSTANCE_DIR)/,$(WINDRES_OBJS))
243else
244  WINDRES_OBJ_FILES =
245endif
246
247OBJ_FILES = $($(GNUSTEP_INSTANCE)_OBJ_FILES)
248
249# OBJ_FILES_TO_LINK is the set of all .o files which will be linked
250# into the result - please note that you can add to OBJ_FILES_TO_LINK
251# by defining manually some special xxx_OBJ_FILES for your
252# tool/app/whatever.  Strip the variable so that by comparing
253# OBJ_FILES_TO_LINK to '' we know if there is a link stage to be
254# performed at all (useful for example in bundles which can contain an
255# object file, or not).
256OBJ_FILES_TO_LINK = $(strip $(C_OBJ_FILES) $(OBJC_OBJ_FILES) $(CC_OBJ_FILES) $(OBJCC_OBJ_FILES) $(WINDRES_OBJ_FILES) $(SUBPROJECT_OBJ_FILES) $(OBJ_FILES))
257
258# This is the subset of OBJ_FILES_TO_LINK that includes all the files
259# that we compile ourselves.  Since we compile them ourselves, we are
260# responsible for creating the directories in which they are stored.
261# We exclude SUBPROJECT_OBJ_FILES since we are not responsible for
262# creating subproject's directories, and OBJ_FILES since again these
263# are obj files already available / built using some other process
264# over which we have no control, so we are not responsible for
265# creating the directories for them.
266OBJ_FILES_TO_LINK_THAT_WE_CREATE = $(strip $(C_OBJ_FILES) $(OBJC_OBJ_FILES) $(CC_OBJ_FILES) $(OBJCC_OBJ_FILES) $(WINDRES_OBJ_FILES))
267
268# OBJ_DIRS_TO_CREATE is the set of all directories that contain
269# OBJ_FILES_TO_LINK.  For example, if you want to compile
270# ./Source/File.m, you'd generate a obj/Tool/Source/File.o file, and
271# we first need to create the directory obj/Tool/Source.
272# Tool/Source/File.m would be in OBJC_FILES, obj/Tool/Source/File.o
273# would be in OBJ_FILES_TO_LINK_WE_CREATE, and obj/Tool/Source would
274# be in OBJ_DIRS_TO_CREATE.
275#
276# Explanation: $(dir ...) is used to extract the directory; $(sort
277# ...) is used to remove duplicates; $(filter-out ...) is used to
278# remove $(GNUSTEP_OBJ_INSTANCE_DIR) which would always
279# appear and is already covered by default.
280OBJ_DIRS_TO_CREATE = $(filter-out $(GNUSTEP_OBJ_INSTANCE_DIR)/,$(sort $(dir $(OBJ_FILES_TO_LINK_THAT_WE_CREATE))))
281
282# Note that when doing a parallel build, we build instances in
283# parallel.  To prevent race conditions in building the directories or
284# compiling the files, each instance has its own build directory to
285# store its own object files, completely separate from the other
286# instances.  The GNUSTEP_OBJ_DIR is built during the Master
287# invocation (so no concurrency issues there); each instance then
288# builds its own GNUSTEP_OBJ_DIR/GNUSTEP_INSTANCE/ subdirectory and
289# puts its object file in there.
290$(OBJ_DIRS_TO_CREATE):
291	$(ECHO_CREATING)cd $(GNUSTEP_BUILD_DIR); $(MKDIRS) $@$(END_ECHO)
292
293# The rule to create the objects file directory for this specific
294# instance.
295$(GNUSTEP_OBJ_INSTANCE_DIR):
296	$(ECHO_NOTHING)cd $(GNUSTEP_BUILD_DIR); \
297	$(MKDIRS) ./$(GNUSTEP_OBJ_INSTANCE_DIR_NAME)/$(END_ECHO)
298
299# If C++ or ObjC++ are involved, we use the C++ compiler instead of
300# the C/ObjC one to link; this happens automatically when compiling
301# C++ or ObjC++ files, but we also want it to happen when linking,
302# because we want g++ to be used instead of gcc to link.  All the
303# linking commands use $(LD) to link; this is set by default to
304# be the same as $(CC).  If C++ or ObjC++ is involved, we want
305# to replace that one with the C++ compiler.  Hence the following.
306ifneq ($(CC_OBJ_FILES)$(OBJCC_OBJ_FILES),)
307  LD = $(CXX)
308endif
309
310ifeq ($(AUTO_DEPENDENCIES),yes)
311  ifneq ($(strip $(OBJ_FILES_TO_LINK)),)
312    -include $(addsuffix .d, $(basename $(OBJ_FILES_TO_LINK)))
313  endif
314endif
315
316# The following is for precompiled headers, only executed if GCC
317# supports them.
318ifeq ($(GCC_WITH_PRECOMPILED_HEADERS),yes)
319#
320# The following are useful to speed up compilation by using
321# precompiled headers.  If GCC_WITH_PRECOMPILED_HEADERS is '', then
322# these variables do nothing.  If GCC_WITH_PRECOMPILED_HEADERS is yes,
323# then these variables cause all the listed headers to be precompiled
324# with the specified compiler before the compilation of the main files
325# starts; the precompiled files will be put in the
326# GNUSTEP_OBJ_DIR/PrecompiledHeaders/{language} directory, and
327# -I$GNUSTEP_OBJ_DIR/PrecompiledHeaders/{language} -Winvalid-pch will
328# automatically be added to the command line to make sure they are
329# used.
330#
331# The list of C header files to be precompiled is in the
332# C_PRECOMPILED_HEADERS variable
333#
334# The list of Objective-C header files to be precompiled is in the
335# OBJC_PRECOMPILED_HEADERS variable
336#
337# The list of C++ header files to be precompiled is in the
338# CC_PRECOMPILED_HEADERS variable
339#
340# The list of Objective-C++ header files to be precompiled is in the
341# OBJCC_PRECOMPILED_HEADERS variable
342#
343
344C_PRECOMPILED_OBJS = $(patsubst %,%.gch,$($(GNUSTEP_INSTANCE)_C_PRECOMPILED_HEADERS))
345C_PRECOMPILED_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/C/,$(C_PRECOMPILED_OBJS))
346
347OBJC_PRECOMPILED_OBJS = $(patsubst %,%.gch,$($(GNUSTEP_INSTANCE)_OBJC_PRECOMPILED_HEADERS))
348OBJC_PRECOMPILED_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/ObjC/,$(OBJC_PRECOMPILED_OBJS))
349
350CC_PRECOMPILED_OBJS = $(patsubst %,%.gch,$($(GNUSTEP_INSTANCE)_CC_PRECOMPILED_HEADERS))
351CC_PRECOMPILED_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/CC/,$(CC_PRECOMPILED_OBJS))
352
353OBJCC_PRECOMPILED_OBJS = $(patsubst %,%.gch,$($(GNUSTEP_INSTANCE)_OBJCC_PRECOMPILED_HEADERS))
354OBJCC_PRECOMPILED_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/ObjCC/,$(OBJCC_PRECOMPILED_OBJS))
355
356# If any of those variables is not empty
357ifneq ($(C_PRECOMPILED_OBJ_FILES)$(OBJC_PRECOMPILED_OBJ_FILES)$(CC_PRECOMPILED_OBJ_FILES)$(OBJCC_PRECOMPILED_OBJ_FILES),)
358  # Then we need to build the files before everything else!
359  internal-precompile-headers: $(C_PRECOMPILED_OBJ_FILES)\
360                               $(OBJC_PRECOMPILED_OBJ_FILES)\
361                               $(CC_PRECOMPILED_OBJ_FILES)\
362                               $(OBJCC_PRECOMPILED_OBJ_FILES)
363
364  # We put all the PrecompiledHeaders/xx/ dirs in xx_PRECOMPILED_HEADERS_INCLUDE_FLAGS,
365  # which will be put before any other header include (this is what we want, as we
366  # want a precompiled header, if available, to be used in preference
367  # to the non-precompiled header, no matter where the non-precompiled
368  # header is).
369  ifneq ($(C_PRECOMPILED_OBJ_FILES),)
370    C_PRECOMPILED_HEADERS_INCLUDE_FLAGS += -I$(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/C
371  endif
372  ifneq ($(OBJC_PRECOMPILED_OBJ_FILES),)
373    OBJC_PRECOMPILED_HEADERS_INCLUDE_FLAGS += -I$(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/ObjC
374  endif
375  ifneq ($(CC_PRECOMPILED_OBJ_FILES),)
376    CC_PRECOMPILED_HEADERS_INCLUDE_FLAGS += -I$(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/CC
377  endif
378  ifneq ($(OBJCC_PRECOMPILED_OBJ_FILES),)
379    OBJCC_PRECOMPILED_HEADERS_INCLUDE_FLAGS  += -I$(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/ObjCC
380  endif
381
382else
383  internal-precompile-headers:
384endif
385
386# End of precompiled headers code
387else
388internal-precompile-headers:
389endif
390
391##
392## Library and related special flags.
393##
394BUNDLE_LIBS += $($(GNUSTEP_INSTANCE)_BUNDLE_LIBS)
395
396ADDITIONAL_INCLUDE_DIRS += $($(GNUSTEP_INSTANCE)_INCLUDE_DIRS)
397
398ADDITIONAL_GUI_LIBS += $($(GNUSTEP_INSTANCE)_GUI_LIBS)
399
400ADDITIONAL_TOOL_LIBS += $($(GNUSTEP_INSTANCE)_TOOL_LIBS)
401
402ADDITIONAL_OBJC_LIBS += $($(GNUSTEP_INSTANCE)_OBJC_LIBS)
403
404ADDITIONAL_LIBRARY_LIBS += $($(GNUSTEP_INSTANCE)_LIBS) \
405                           $($(GNUSTEP_INSTANCE)_LIBRARY_LIBS)
406
407ADDITIONAL_NATIVE_LIBS += $($(GNUSTEP_INSTANCE)_NATIVE_LIBS)
408
409ADDITIONAL_LIB_DIRS += $($(GNUSTEP_INSTANCE)_LIB_DIRS)
410
411ADDITIONAL_CPPFLAGS += $($(GNUSTEP_INSTANCE)_CPPFLAGS)
412
413ADDITIONAL_CFLAGS += $($(GNUSTEP_INSTANCE)_CFLAGS)
414
415ADDITIONAL_OBJCFLAGS += $($(GNUSTEP_INSTANCE)_OBJCFLAGS)
416
417ADDITIONAL_CCFLAGS += $($(GNUSTEP_INSTANCE)_CCFLAGS)
418
419ADDITIONAL_OBJCCFLAGS += $($(GNUSTEP_INSTANCE)_OBJCCFLAGS)
420
421ADDITIONAL_LDFLAGS += $($(GNUSTEP_INSTANCE)_LDFLAGS)
422
423ADDITIONAL_CLASSPATH += $($(GNUSTEP_INSTANCE)_CLASSPATH)
424
425LIBRARIES_DEPEND_UPON += $($(GNUSTEP_INSTANCE)_LIBRARIES_DEPEND_UPON)
426
427# You can control whether you want to link against the gui library
428# by using one of the two commands --
429#
430#  xxx_NEEDS_GUI = yes
431#  xxx_NEEDS_GUI = no
432# (where 'xxx' is the name of your application/bundle/etc.)
433#
434# You can also change it for all applications/bundles/etc by doing
435#
436# NEEDS_GUI = yes (or no)
437#
438# If you don't specify anything, the default for the project type will
439# be used (this is the NEEDS_GUI = yes/no that is at the top of all
440# project types).
441#
442# If the project type doesn't specify anything (eg, doesn't need
443# linking to ObjC libraries, or it is buggy/old or it is from a
444# third-party and hasn't been updated yet) then the default is NO.
445
446INTERNAL_NEEDS_GUI = $($(GNUSTEP_INSTANCE)_NEEDS_GUI)
447
448ifeq ($(INTERNAL_NEEDS_GUI),)
449
450  INTERNAL_NEEDS_GUI = $(NEEDS_GUI)
451
452  ifeq ($(INTERNAL_NEEDS_GUI),)
453    INTERNAL_NEEDS_GUI = no
454  endif
455
456endif
457
458# Recognize 'YES' as well as 'yes'
459ifeq ($(INTERNAL_NEEDS_GUI),YES)
460  INTERNAL_NEEDS_GUI = yes
461endif
462
463# Now we prepare a variable, ALL_LIBS, containing the list of all LIBS
464# that should be used when linking.  This is different depending on
465# whether we need to link against the gui library or not.
466ifeq ($(INTERNAL_NEEDS_GUI), yes)
467# Please note that you usually need to add ALL_LIB_DIRS before
468# ALL_LIBS when linking.  It's kept separate because sometimes (eg,
469# bundles) we only use ALL_LIB_DIRS and not ALL_LIBS (not sure how
470# useful ALL_LIB_DIRS would be without ALL_LIBS, anyway touching flags
471# is dangerous as things might stop compiling for some people who
472# were relying on the old behaviour)
473ALL_LIBS =								     \
474     $(ADDITIONAL_GUI_LIBS) $(AUXILIARY_GUI_LIBS) $(GUI_LIBS)		     \
475     $(BACKEND_LIBS) $(ADDITIONAL_TOOL_LIBS) $(AUXILIARY_TOOL_LIBS)	     \
476     $(FND_LIBS) $(ADDITIONAL_OBJC_LIBS) $(AUXILIARY_OBJC_LIBS) $(OBJC_LIBS) \
477     $(SYSTEM_LIBS) $(TARGET_SYSTEM_LIBS)
478else
479ALL_LIBS =								     \
480     $(ADDITIONAL_TOOL_LIBS) $(AUXILIARY_TOOL_LIBS)			     \
481     $(FND_LIBS) $(ADDITIONAL_OBJC_LIBS) $(AUXILIARY_OBJC_LIBS) $(OBJC_LIBS) \
482     $(SYSTEM_LIBS) $(TARGET_SYSTEM_LIBS)
483endif
484
485#
486# Determine the languages used by this instance.  This is used in
487# various places (bundles, resource sets, make_strings) where language
488# resources are managed.
489#
490LANGUAGES = $(strip $($(GNUSTEP_INSTANCE)_LANGUAGES))
491
492ifeq ($(LANGUAGES),)
493  LANGUAGES = English
494endif
495
496# You can have a single xxxInfo.plist for both GNUstep and Apple.
497# Often enough, you can just put in it all fields required by both
498# GNUstep and Apple; if there is a conflict, you can provide
499# axxxInfo.cplist (please note the suffix!) - that file is
500# automatically run through the C preprocessor to generate a
501# xxxInfo.plist file from it.  The preprocessor will define GNUSTEP
502# when using gnustep-base, APPLE when using Apple FoundationKit, NEXT
503# when using NeXT/OPENStep FoundationKit, and UNKNOWN when using
504# something else, so you can use
505# #ifdef GNUSTEP
506#   ... some plist code for GNUstep ...
507# #else
508#   ... some plist code for Apple ...
509# #endif
510# to have your .cplist use different code for each.
511#
512
513# Our problem is that we'd like to always depend on xxxInfo.plist if
514# it's there, and not depend on it if it's not there - which we solve
515# by expanding $(wildcard $(GNUSTEP_INSTANCE)Info.plist)
516GNUSTEP_PLIST_DEPEND = $(wildcard $(GNUSTEP_INSTANCE)Info.plist)
517
518# older versions of XCode use the form Info-xxx.plist
519ifeq ($(GNUSTEP_PLIST_DEPEND),)
520  GNUSTEP_PLIST_DEPEND = $(wildcard Info-$(GNUSTEP_INSTANCE).plist)
521endif
522
523# Newer versions of XCode use the form xxx-Info.plist
524ifeq ($(GNUSTEP_PLIST_DEPEND),)
525  GNUSTEP_PLIST_DEPEND = $(wildcard $(GNUSTEP_INSTANCE)-Info.plist)
526endif
527
528# As a special case, if xxxInfo.cplist is there, in this case as well
529# we'd like to depend on xxxInfo.plist.
530ifeq ($(GNUSTEP_PLIST_DEPEND),)
531   # xxxInfo.plist is not there.  Check if xxxInfo.cplist is there, and
532   # if so, convert it to xxxInfo.plist and add it to the dependencies.
533   GNUSTEP_PLIST_DEPEND = $(patsubst %.cplist,%.plist,$(wildcard $(GNUSTEP_INSTANCE)Info.cplist))
534endif
535