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 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
23OBJC_LDFLAGS =
24OBJC_LIBS =
25
26#
27# Set the appropriate ObjC runtime library and other information
28#
29# PS: OBJC_LIB_FLAG is set by config.make.
30ifeq ($(OBJC_RUNTIME_LIB), gnu)
31  OBJC_LDFLAGS =
32  OBJC_LIB_DIR =
33  OBJC_LIBS = $(OBJC_LIB_FLAG)
34  ifeq ($(CLANG_CC), yes)
35    RUNTIME_FLAG   = -fobjc-runtime=gcc
36  else
37    RUNTIME_FLAG   =
38  endif
39  RUNTIME_DEFINE = -DGNU_RUNTIME=1
40endif
41
42ifeq ($(OBJC_RUNTIME_LIB), ng)
43  OBJC_LDFLAGS =
44  OBJC_LIB_DIR =
45  OBJC_LIBS = $(OBJC_LIB_FLAG)
46  ifeq ($(RUNTIME_VERSION),)
47    ifneq ($(DEFAULT_OBJC_RUNTIME_ABI),)
48      RUNTIME_VERSION=$(DEFAULT_OBJC_RUNTIME_ABI)
49   else
50     RUNTIME_VERSION=gnustep-1.8
51   endif
52  endif
53  RUNTIME_FLAG = -fobjc-runtime=$(RUNTIME_VERSION) -fblocks
54  RUNTIME_DEFINE = -DGNUSTEP_RUNTIME=1 -D_NONFRAGILE_ABI=1
55endif
56
57ifeq ($(OBJC_RUNTIME_LIB), nx)
58  RUNTIME_FLAG = -fnext-runtime
59  RUNTIME_DEFINE = -DNeXT_RUNTIME=1
60  ifeq ($(FOUNDATION_LIB), gnu)
61    OBJC_LIBS = $(OBJC_LIB_FLAG)
62  endif
63endif
64
65ifeq ($(OBJC_RUNTIME_LIB), sun)
66  RUNTIME_DEFINE = -DSun_RUNTIME=1
67endif
68
69ifeq ($(OBJC_RUNTIME_LIB), apple)
70  RUNTIME_FLAG = -fnext-runtime
71  RUNTIME_DEFINE = -DNeXT_RUNTIME=1
72  OBJC_LIBS = $(OBJC_LIB_FLAG)
73endif
74
75FND_LDFLAGS =
76FND_LIBS =
77#
78# Set the appropriate Foundation library
79#
80ifeq ($(FOUNDATION_LIB), gnu)
81  FOUNDATION_LIBRARY_NAME   = gnustep-base
82  FOUNDATION_LIBRARY_DEFINE = -DGNUSTEP_BASE_LIBRARY=1
83endif
84
85#
86# Third-party foundations not using make package
87# Our own foundation will install a base.make file into
88# $GNUSTEP_MAKEFILES/Additional/ to set the needed flags
89#
90ifeq ($(FOUNDATION_LIB), nx)
91  # -framework Foundation is used both to find headers, and to link
92  INTERNAL_OBJCFLAGS += -framework Foundation
93  FND_LIBS   = -framework Foundation
94  FND_DEFINE = -DNeXT_Foundation_LIBRARY=1
95  LIBRARIES_DEPEND_UPON += -framework Foundation
96  BUNDLE_LIBS += -framework Foundation
97endif
98
99ifeq ($(FOUNDATION_LIB), sun)
100  FND_DEFINE = -DSun_Foundation_LIBRARY=1
101endif
102
103ifeq ($(FOUNDATION_LIB), apple)
104  # -framework Foundation is used only to link
105  FND_LIBS   = -framework Foundation
106  FND_DEFINE = -DNeXT_Foundation_LIBRARY=1
107  LIBRARIES_DEPEND_UPON += -framework Foundation
108endif
109
110#
111# FIXME - Ask Helge to move this inside his libFoundation, and have
112# it installed as a $(GNUSTEP_MAKEFILES)/Additional/libFoundation.make
113#
114ifeq ($(FOUNDATION_LIB), fd)
115  -include $(GNUSTEP_MAKEFILES)/libFoundation.make
116
117  FND_DEFINE = -DLIB_FOUNDATION_LIBRARY=1
118  FND_LIBS = -lFoundation
119
120  ifeq ($(gc), yes)
121    ifeq ($(LIBFOUNDATION_WITH_GC), yes)
122      ifeq ($(leak), yes)
123        AUXILIARY_CPPFLAGS += -DLIB_FOUNDATION_LEAK_GC=1
124      else
125        AUXILIARY_CPPFLAGS += -DLIB_FOUNDATION_BOEHM_GC=1
126      endif
127    endif
128  endif
129
130endif
131
132GUI_LDFLAGS =
133GUI_LIBS =
134#
135# Third-party GUI libraries - our own sets its flags into
136# $(GNUSTEP_MAKEFILES)/Additional/gui.make
137#
138ifeq ($(GUI_LIB), nx)
139  GUI_DEFINE = -DNeXT_GUI_LIBRARY=1
140  # -framework AppKit is used both to find headers, and to link
141  INTERNAL_OBJCFLAGS += -framework AppKit
142  GUI_LIBS = -framework AppKit
143  LIBRARIES_DEPEND_UPON += -framework AppKit
144  BUNDLE_LIBS += -framework AppKit
145endif
146
147ifeq ($(GUI_LIB), apple)
148  GUI_DEFINE = -DNeXT_GUI_LIBRARY=1
149  # -framework AppKit is used only to link
150  GUI_LIBS = -framework AppKit
151  LIBRARIES_DEPEND_UPON += -framework AppKit
152endif
153
154SYSTEM_INCLUDES = $(CONFIG_SYSTEM_INCL)
155SYSTEM_LDFLAGS = $(LDFLAGS)
156SYSTEM_LIB_DIR = $(CONFIG_SYSTEM_LIB_DIR)
157SYSTEM_LIBS =
158