]> err.no Git - sope/blob - gnustep-make/library-combo.make
Drop apache 1 build-dependency
[sope] / gnustep-make / library-combo.make
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 #   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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   FOUNDATION_LIBRARY_NAME   = gnustep-base
139   FOUNDATION_LIBRARY_DEFINE = -DGNUSTEP_BASE_LIBRARY=1
140 endif
141
142 #
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
146 #
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
154 endif
155
156 ifeq ($(FOUNDATION_LIB), sun)
157   FND_DEFINE = -DSun_Foundation_LIBRARY=1
158 endif
159
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
165 endif
166
167 #
168 # FIXME - Ask Helge to move this inside his libFoundation, and have 
169 # it installed as a $(GNUSTEP_MAKEFILES)/Additional/libFoundation.make
170 #
171 ifeq ($(FOUNDATION_LIB),fd)
172   -include $(GNUSTEP_MAKEFILES)/libFoundation.make
173
174   FND_DEFINE = -DLIB_FOUNDATION_LIBRARY=1
175   FND_LIBS = -lFoundation
176
177   # If gc=yes was passed and libFoundation was compiled with Boehm's
178   # GC support, use the appropriate libraries
179
180   ifeq ($(gc), yes)
181     ifeq ($(LIBFOUNDATION_WITH_GC), yes)
182       ifeq ($(leak), yes)
183         AUXILIARY_CPPFLAGS += -DLIB_FOUNDATION_LEAK_GC=1
184       else
185         AUXILIARY_CPPFLAGS += -DLIB_FOUNDATION_BOEHM_GC=1
186       endif
187     endif
188   endif
189
190 endif
191
192 GUI_LDFLAGS =
193 GUI_LIBS = 
194 #
195 # Third-party GUI libraries - our own sets its flags into 
196 # $(GNUSTEP_MAKEFILES)/Additional/gui.make
197 #
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
205 endif
206
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
212 endif
213
214 SYSTEM_INCLUDES = $(CONFIG_SYSTEM_INCL)
215 SYSTEM_LDFLAGS = $(LDFLAGS)
216 SYSTEM_LIB_DIR = $(CONFIG_SYSTEM_LIB_DIR)
217 SYSTEM_LIBS =