1 |
# -*-makefile-*- |
2 |
# library-combo.make |
3 |
# |
4 |
# Determine which runtime, foundation and gui library to use. |
5 |
# |
6 |
# Copyright (C) 1997, 2001 Free Software Foundation, Inc. |
7 |
# |
8 |
# Author: Scott Christley <scottc@net-community.com> |
9 |
# Author: Nicola Pero <n.pero@mi.flashnet.it> |
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 2 |
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.LIB. |
20 |
# If not, write to the Free Software Foundation, |
21 |
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
22 |
|
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). |
29 |
ifdef LIBRARY_COMBO |
30 |
library_combo := $(LIBRARY_COMBO) |
31 |
else |
32 |
library_combo := $(default_library_combo) |
33 |
endif |
34 |
|
35 |
# Handle abbreviations for library combinations. |
36 |
the_library_combo = $(library_combo) |
37 |
|
38 |
ifeq ($(the_library_combo), nx) |
39 |
the_library_combo = nx-nx-nx |
40 |
endif |
41 |
|
42 |
ifeq ($(the_library_combo), apple) |
43 |
the_library_combo = apple-apple-apple |
44 |
endif |
45 |
|
46 |
ifeq ($(the_library_combo), gnu) |
47 |
the_library_combo = gnu-gnu-gnu |
48 |
endif |
49 |
|
50 |
ifeq ($(the_library_combo), fd) |
51 |
the_library_combo = gnu-fd-gnu |
52 |
endif |
53 |
|
54 |
# Strip out the individual libraries from the library_combo string |
55 |
combo_list = $(subst -, ,$(the_library_combo)) |
56 |
|
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 |
59 |
# determination. |
60 |
|
61 |
# gc=yes is just another way of saying you want OBJC_RUNTIME_LIB = gnugc |
62 |
# to be used! |
63 |
ifeq ($(gc), yes) |
64 |
OBJC_RUNTIME_LIB = gnugc |
65 |
endif |
66 |
|
67 |
ifeq ($(OBJC_RUNTIME_LIB),) |
68 |
OBJC_RUNTIME_LIB = $(word 1,$(combo_list)) |
69 |
endif |
70 |
|
71 |
ifeq ($(FOUNDATION_LIB),) |
72 |
FOUNDATION_LIB = $(word 2,$(combo_list)) |
73 |
endif |
74 |
|
75 |
ifeq ($(GUI_LIB),) |
76 |
GUI_LIB = $(word 3,$(combo_list)) |
77 |
endif |
78 |
|
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) |
87 |
|
88 |
OBJC_LDFLAGS = |
89 |
OBJC_LIBS = |
90 |
# |
91 |
# Set the appropriate ObjC runtime library and other information |
92 |
# |
93 |
ifeq ($(OBJC_RUNTIME_LIB), gnu) |
94 |
OBJC_LDFLAGS = |
95 |
OBJC_LIB_DIR = |
96 |
OBJC_LIBS = -lobjc |
97 |
RUNTIME_FLAG = -fgnu-runtime |
98 |
RUNTIME_DEFINE = -DGNU_RUNTIME=1 |
99 |
endif |
100 |
|
101 |
ifeq ($(OBJC_RUNTIME_LIB), gnugc) |
102 |
OBJC_LDFLAGS = |
103 |
OBJC_LIB_DIR = |
104 |
OBJC_LIBS = -lobjc_gc -lgc |
105 |
RUNTIME_FLAG = -fgnu-runtime |
106 |
RUNTIME_DEFINE = -DGNU_RUNTIME=1 -DOBJC_WITH_GC=1 |
107 |
ifeq ($(debug),yes) |
108 |
RUNTIME_DEFINE += -DGC_DEBUG |
109 |
endif |
110 |
endif |
111 |
|
112 |
ifeq ($(OBJC_RUNTIME_LIB), nx) |
113 |
RUNTIME_FLAG = -fnext-runtime |
114 |
RUNTIME_DEFINE = -DNeXT_RUNTIME=1 |
115 |
ifeq ($(FOUNDATION_LIB), gnu) |
116 |
OBJC_LIBS = -lobjc |
117 |
endif |
118 |
endif |
119 |
|
120 |
ifeq ($(OBJC_RUNTIME_LIB), sun) |
121 |
RUNTIME_DEFINE = -DSun_RUNTIME=1 |
122 |
endif |
123 |
|
124 |
ifeq ($(OBJC_RUNTIME_LIB), apple) |
125 |
RUNTIME_FLAG = -fnext-runtime |
126 |
RUNTIME_DEFINE = -DNeXT_RUNTIME=1 |
127 |
ifeq ($(FOUNDATION_LIB), gnu) |
128 |
OBJC_LIBS = -lobjc |
129 |
endif |
130 |
endif |
131 |
|
132 |
FND_LDFLAGS = |
133 |
FND_LIBS = |
134 |
# |
135 |
# Set the appropriate Foundation library |
136 |
# |
137 |
ifeq ($(FOUNDATION_LIB),gnu) |
138 |
GNUSTEP_FND_DIR = gnustep |
139 |
FOUNDATION_LIBRARY_NAME = gnustep-base |
140 |
FOUNDATION_LIBRARY_DEFINE = -DGNUSTEP_BASE_LIBRARY=1 |
141 |
endif |
142 |
|
143 |
# |
144 |
# Third-party foundations not using make package |
145 |
# Our own foundation will install a base.make file into |
146 |
# $GNUSTEP_MAKEFILES/Additional/ to set the needed flags |
147 |
# |
148 |
ifeq ($(FOUNDATION_LIB), nx) |
149 |
# -framework Foundation is used both to find headers, and to link |
150 |
INTERNAL_OBJCFLAGS += -framework Foundation |
151 |
FND_LIBS = -framework Foundation |
152 |
FND_DEFINE = -DNeXT_Foundation_LIBRARY=1 |
153 |
LIBRARIES_DEPEND_UPON += -framework Foundation |
154 |
BUNDLE_LIBS += -framework Foundation |
155 |
endif |
156 |
|
157 |
ifeq ($(FOUNDATION_LIB), sun) |
158 |
FND_DEFINE = -DSun_Foundation_LIBRARY=1 |
159 |
endif |
160 |
|
161 |
ifeq ($(FOUNDATION_LIB), apple) |
162 |
# -framework Foundation is used both to find headers, and to link |
163 |
INTERNAL_OBJCFLAGS += -framework Foundation |
164 |
FND_LIBS = -framework Foundation |
165 |
FND_DEFINE = -DNeXT_Foundation_LIBRARY=1 |
166 |
LIBRARIES_DEPEND_UPON += -framework Foundation |
167 |
endif |
168 |
|
169 |
# |
170 |
# FIXME - Ask Helge to move this inside his libFoundation, and have |
171 |
# it installed as a $(GNUSTEP_MAKEFILES)/Additional/libFoundation.make |
172 |
# |
173 |
ifeq ($(FOUNDATION_LIB),fd) |
174 |
-include $(GNUSTEP_MAKEFILES)/libFoundation.make |
175 |
|
176 |
GNUSTEP_FND_DIR = libFoundation |
177 |
FND_DEFINE = -DLIB_FOUNDATION_LIBRARY=1 |
178 |
FND_LIBS = -lFoundation |
179 |
|
180 |
# If gc=yes was passed and libFoundation was compiled with Boehm's |
181 |
# GC support, use the appropriate libraries |
182 |
|
183 |
ifeq ($(gc), yes) |
184 |
ifeq ($(LIBFOUNDATION_WITH_GC), yes) |
185 |
ifeq ($(leak), yes) |
186 |
AUXILIARY_CPPFLAGS += -DLIB_FOUNDATION_LEAK_GC=1 |
187 |
else |
188 |
AUXILIARY_CPPFLAGS += -DLIB_FOUNDATION_BOEHM_GC=1 |
189 |
endif |
190 |
endif |
191 |
endif |
192 |
|
193 |
endif |
194 |
|
195 |
GUI_LDFLAGS = |
196 |
GUI_LIBS = |
197 |
# |
198 |
# Third-party GUI libraries - our own sets its flags into |
199 |
# $(GNUSTEP_MAKEFILES)/Additional/gui.make |
200 |
# |
201 |
ifeq ($(GUI_LIB), nx) |
202 |
GUI_DEFINE = -DNeXT_GUI_LIBRARY=1 |
203 |
# -framework AppKit is used both to find headers, and to find the library |
204 |
INTERNAL_OBJCFLAGS += -framework AppKit |
205 |
GUI_LIBS = -framework AppKit |
206 |
LIBRARIES_DEPEND_UPON += -framework AppKit |
207 |
BUNDLE_LIBS += -framework AppKit |
208 |
endif |
209 |
|
210 |
ifeq ($(GUI_LIB), apple) |
211 |
GUI_DEFINE = -DNeXT_GUI_LIBRARY=1 |
212 |
# -framework AppKit is used both to find headers, and to find the library |
213 |
INTERNAL_OBJCFLAGS += -framework AppKit |
214 |
GUI_LIBS = -framework AppKit |
215 |
LIBRARIES_DEPEND_UPON += -framework AppKit |
216 |
endif |
217 |
|
218 |
SYSTEM_INCLUDES = $(CONFIG_SYSTEM_INCL) |
219 |
SYSTEM_LDFLAGS = $(LDFLAGS) |
220 |
SYSTEM_LIB_DIR = |
221 |
SYSTEM_LIBS = |