4 # Determine which runtime, foundation and gui library to use.
6 # Copyright (C) 1997, 2001 Free Software Foundation, Inc.
8 # Author: Scott Christley <scottc@net-community.com>
9 # Author: Nicola Pero <n.pero@mi.flashnet.it>
11 # This file is part of the GNUstep Makefile Package.
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 2
16 # of the License, or (at your option) any later version.
18 # You should have received a copy of the GNU General Public
19 # License along with this library; see the file COPYING.LIB.
20 # If not, write to the Free Software Foundation,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 # Get library_combo from LIBRARY_COMBO or default_library_combo (or
24 # from the command line if the user defined it on the command line by
25 # invoking `make library_combo=gnu-gnu-gnu'; command line
26 # automatically takes the precedence over makefile definitions, so
27 # setting library_combo here has no effect if the user already defined
28 # it on the command line).
30 library_combo := $(LIBRARY_COMBO)
32 library_combo := $(default_library_combo)
35 # Handle abbreviations for library combinations.
36 the_library_combo = $(library_combo)
38 ifeq ($(the_library_combo), nx)
39 the_library_combo = nx-nx-nx
42 ifeq ($(the_library_combo), apple)
43 the_library_combo = apple-apple-apple
46 ifeq ($(the_library_combo), gnu)
47 the_library_combo = gnu-gnu-gnu
50 ifeq ($(the_library_combo), fd)
51 the_library_combo = gnu-fd-gnu
54 # Strip out the individual libraries from the library_combo string
55 combo_list = $(subst -, ,$(the_library_combo))
57 # NB: The user can always specify any of the OBJC_RUNTIME_LIB, the
58 # FOUNDATION_LIB and the GUI_LIB variable manually overriding our
61 # gc=yes is just another way of saying you want OBJC_RUNTIME_LIB = gnugc
64 OBJC_RUNTIME_LIB = gnugc
67 ifeq ($(OBJC_RUNTIME_LIB),)
68 OBJC_RUNTIME_LIB = $(word 1,$(combo_list))
71 ifeq ($(FOUNDATION_LIB),)
72 FOUNDATION_LIB = $(word 2,$(combo_list))
76 GUI_LIB = $(word 3,$(combo_list))
79 # Now build and export the final LIBRARY_COMBO variable, which is the
80 # only variable (together with OBJC_RUNTIME_LIB, FOUNDATION_LIB and
81 # GUI_LIB) the other makefiles need to know about. This LIBRARY_COMBO
82 # might be different from the original one, because we might have
83 # replaced it with a library_combo provided on the command line, or we
84 # might have fixed up parts of it in accordance to some custom
85 # OBJC_RUNTIME_LIB, FOUNDATION_LIB and/or GUI_LIB !
86 export LIBRARY_COMBO = $(OBJC_RUNTIME_LIB)-$(FOUNDATION_LIB)-$(GUI_LIB)
91 # Set the appropriate ObjC runtime library and other information
93 ifeq ($(OBJC_RUNTIME_LIB), gnu)
97 RUNTIME_FLAG = -fgnu-runtime
98 RUNTIME_DEFINE = -DGNU_RUNTIME=1
101 ifeq ($(OBJC_RUNTIME_LIB), gnugc)
104 OBJC_LIBS = -lobjc_gc -lgc
105 RUNTIME_FLAG = -fgnu-runtime
106 RUNTIME_DEFINE = -DGNU_RUNTIME=1 -DOBJC_WITH_GC=1
108 RUNTIME_DEFINE += -DGC_DEBUG
112 ifeq ($(OBJC_RUNTIME_LIB), nx)
113 RUNTIME_FLAG = -fnext-runtime
114 RUNTIME_DEFINE = -DNeXT_RUNTIME=1
115 ifeq ($(FOUNDATION_LIB), gnu)
120 ifeq ($(OBJC_RUNTIME_LIB), sun)
121 RUNTIME_DEFINE = -DSun_RUNTIME=1
124 ifeq ($(OBJC_RUNTIME_LIB), apple)
125 RUNTIME_FLAG = -fnext-runtime
126 RUNTIME_DEFINE = -DNeXT_RUNTIME=1
127 ifeq ($(FOUNDATION_LIB), gnu)
135 # Set the appropriate Foundation library
137 ifeq ($(FOUNDATION_LIB),gnu)
138 FOUNDATION_LIBRARY_NAME = gnustep-base
139 FOUNDATION_LIBRARY_DEFINE = -DGNUSTEP_BASE_LIBRARY=1
143 # Third-party foundations not using make package
144 # Our own foundation will install a base.make file into
145 # $GNUSTEP_MAKEFILES/Additional/ to set the needed flags
147 ifeq ($(FOUNDATION_LIB), nx)
148 # -framework Foundation is used both to find headers, and to link
149 INTERNAL_OBJCFLAGS += -framework Foundation
150 FND_LIBS = -framework Foundation
151 FND_DEFINE = -DNeXT_Foundation_LIBRARY=1
152 LIBRARIES_DEPEND_UPON += -framework Foundation
153 BUNDLE_LIBS += -framework Foundation
156 ifeq ($(FOUNDATION_LIB), sun)
157 FND_DEFINE = -DSun_Foundation_LIBRARY=1
160 ifeq ($(FOUNDATION_LIB), apple)
161 # -framework Foundation is used only to link
162 FND_LIBS = -framework Foundation
163 FND_DEFINE = -DNeXT_Foundation_LIBRARY=1
164 LIBRARIES_DEPEND_UPON += -framework Foundation
168 # FIXME - Ask Helge to move this inside his libFoundation, and have
169 # it installed as a $(GNUSTEP_MAKEFILES)/Additional/libFoundation.make
171 ifeq ($(FOUNDATION_LIB),fd)
172 -include $(GNUSTEP_MAKEFILES)/libFoundation.make
174 FND_DEFINE = -DLIB_FOUNDATION_LIBRARY=1
175 FND_LIBS = -lFoundation
177 # If gc=yes was passed and libFoundation was compiled with Boehm's
178 # GC support, use the appropriate libraries
181 ifeq ($(LIBFOUNDATION_WITH_GC), yes)
183 AUXILIARY_CPPFLAGS += -DLIB_FOUNDATION_LEAK_GC=1
185 AUXILIARY_CPPFLAGS += -DLIB_FOUNDATION_BOEHM_GC=1
195 # Third-party GUI libraries - our own sets its flags into
196 # $(GNUSTEP_MAKEFILES)/Additional/gui.make
198 ifeq ($(GUI_LIB), nx)
199 GUI_DEFINE = -DNeXT_GUI_LIBRARY=1
200 # -framework AppKit is used both to find headers, and to link
201 INTERNAL_OBJCFLAGS += -framework AppKit
202 GUI_LIBS = -framework AppKit
203 LIBRARIES_DEPEND_UPON += -framework AppKit
204 BUNDLE_LIBS += -framework AppKit
207 ifeq ($(GUI_LIB), apple)
208 GUI_DEFINE = -DNeXT_GUI_LIBRARY=1
209 # -framework AppKit is used only to link
210 GUI_LIBS = -framework AppKit
211 LIBRARIES_DEPEND_UPON += -framework AppKit
214 SYSTEM_INCLUDES = $(CONFIG_SYSTEM_INCL)
215 SYSTEM_LDFLAGS = $(LDFLAGS)
216 SYSTEM_LIB_DIR = $(CONFIG_SYSTEM_LIB_DIR)