4 # Determine target specific settings
6 # Copyright (C) 1997 Free Software Foundation, Inc.
8 # Author: Scott Christley <scottc@net-community.com>
9 # Author: Ovidiu Predescu <ovidiu@net-community.com>
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 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 # This file should not contain any conditional based on the value of
24 # the 'shared' variable, because we have not set it up yet when this
28 # Host and target specific settings
30 ifeq ($(findstring solaris, $(GNUSTEP_TARGET_OS)), solaris)
31 X_INCLUDES := $(X_INCLUDES)/X11
35 # Target specific libraries
37 TARGET_SYSTEM_LIBS = $(CONFIG_SYSTEM_LIBS) -lm
38 ifneq ("$(objc_threaded)","")
39 INTERNAL_CFLAGS = -D_REENTRANT
40 INTERNAL_OBJCFLAGS = -D_REENTRANT
41 AUXILIARY_OBJC_LIBS += $(objc_threaded)
43 TARGET_SYSTEM_LIBS += $(objc_threaded)
47 ifeq ($(findstring mingw32, $(GNUSTEP_TARGET_OS)), mingw32)
48 TARGET_SYSTEM_LIBS := $(CONFIG_SYSTEM_LIBS) \
49 -lws2_32 -ladvapi32 -lcomctl32 -luser32 -lcomdlg32 \
50 -lmpr -lnetapi32 -lm -I. # the -I is a dummy to avoid -lm^M
52 ifeq ($(findstring cygwin, $(GNUSTEP_TARGET_OS)), cygwin)
53 TARGET_SYSTEM_LIBS := $(CONFIG_SYSTEM_LIBS) -lm -I.
55 ifeq ($(findstring solaris, $(GNUSTEP_TARGET_OS)), solaris)
56 TARGET_SYSTEM_LIBS := $(CONFIG_SYSTEM_LIBS) -lsocket -lnsl -lm
58 ifeq ($(findstring sysv4.2, $(GNUSTEP_TARGET_OS)), sysv4.2)
59 TARGET_SYSTEM_LIBS := $(CONFIG_SYSTEM_LIBS) -lsocket -lnsl -lm
63 # Specific settings for building shared libraries, static libraries,
64 # and bundles on various systems
68 # For each target, a few target-specific variables need to be set.
70 # The first one is SHARED_LIB_LINK_CMD - which should be set to the
71 # command(s) to use to link a shared library on that platform. Please
72 # note that the variables (stuff like $(CC)) in it are not expanded
73 # until SHARED_LIB_LINK_CMD is actually used (STATIC_LIB_LINK_CMD is
74 # the equivalent variable, used for static libraries).
76 # SHARED_LIB_LINK_CMD will be used to link standard shared libraries,
77 # and frameworks. It should use the following variables (which are set
78 # by library.make or framework.make before executing
79 # SHARED_LIB_LINK_CMD) to refer to what it needs to link (please note
80 # that STATIC_LIB_LINK_CMD will also use these variables with similar
81 # meanings; but not all of them, as noted):
83 # LIB_LINK_OBJ_DIR: where the newly created library should be.
84 # Usually GNUSTEP_OBJ_DIR for libraries, and FRAMEWORK_LIBRARY_DIR_NAME
86 # LIB_LINK_VERSION_FILE: the final file to create, having full
87 # version information: typically `libgnustep-base.so.1.5.3' for shared
88 # libraries, and `libgnustep-base.a' for static libraries.
89 # LIB_LINK_SONAME_FILE: this is only used for shared libraries; it
90 # should be passed in the -Wl,-soname argument of most linkers when
91 # building the LIB_LINK_VERSION_FILE. Typically `libgnustep-base.so.1'
92 # (but might also be `libgnustep-base.so.1.0' if INTERFACE_VERSION
93 # has been manually changed when using library.make). On many
94 # platforms, it's appropriate/standard to also create this file as
95 # a symlink to LIB_LINK_VERSION_FILE. If LIB_LINK_VERSION_FILE is
96 # the same as LIB_LINK_SONAME_FILE, then the symlink should not be
98 # LIB_LINK_FILE: this is only used for shared libraries; it should
99 # be created as a symlink to LIB_LINK_VERSION_FILE (or to
100 # LIB_LINK_SONAME_FILE if it's created on that platform).
101 # Typically `libgnustep-base.so'.
102 # LIB_LINK_INSTALL_NAME: on some platforms, when a shared library is
103 # linked, a default install name of the library is hardcoded into
104 # the library. This is that name.
106 # AFTER_INSTALL_SHARED_LIB_CMD provides commands to be executed after
107 # installation (at least for libraries, not for frameworks at the
108 # moment), and is supposed to setup symlinks properly in the
109 # installation directory. It uses the same variables, except for
110 # LIB_LINK_INSTALL_DIR which is the full final path to where the
111 # library (and symlinks) is going to be installed.
113 # AFTER_INSTALL_STATIC_LIB_CMD is similar.
116 # For frameworks on unusual platforms, you might also need to set
117 # EXTRACT_CLASS_NAMES_COMMAND. This should be a command which is
118 # evaluated on $(object_file) and returns a list of classes
119 # implemented in the object_file. Our default command is the
120 # following (you can override it with another one in your target's
121 # section if you need), which runs 'nm' on the object file, and
122 # retrieve all symbols of the form __objc_class_name_NSObject which
123 # are not 'U' (undefined) ... an __objc_class_name_NSObject is defined
124 # in the module implementing the class, and referenced by all other
125 # modules needing to use the class. So if we have an
126 # __objc_class_name_XXX which is not 'U' (which would be a reference
127 # to a class implemented elsewhere), it must be a class implemented in
130 # The 'sed' command parses a set of lines, and extracts lines starting
131 # with __objc_class_name_XXXX Y, where XXXX is a string of characters
132 # from A-Za-z_. and Y is not 'U'. It then replaces the whole line
133 # with XXXX, and prints the result. '-n' disables automatic printing
134 # for portability, so we are sure we only print what we want on all
136 EXTRACT_CLASS_NAMES_COMMAND = nm -Pg $$object_file | sed -n -e '/^__objc_class_name_[A-Za-z_.]* [^U]/ {s/^__objc_class_name_\([A-Za-z_.]*\) [^U].*/\1/p;}'
139 # This is the generic version - if the target is not in the following list,
140 # this setup will be used. It the target does not override variables here
141 # with its own version, these generic definitions will be used.
143 HAVE_SHARED_LIBS = no
144 STATIC_LIB_LINK_CMD = \
145 $(AR) $(ARFLAGS) $(AROUT)$(LIB_LINK_OBJ_DIR)/$(LIB_LINK_VERSION_FILE) $^;\
146 $(RANLIB) $(LIB_LINK_OBJ_DIR)/$(LIB_LINK_VERSION_FILE)
147 AFTER_INSTALL_STATIC_LIB_CMD = \
148 (cd $(LIB_LINK_INSTALL_DIR); \
149 $(RANLIB) $(LIB_LINK_VERSION_FILE))
150 SHARED_LIB_LINK_CMD =
153 AFTER_INSTALL_SHARED_LIB_CMD = \
154 (cd $(LIB_LINK_INSTALL_DIR); \
155 rm -f $(LIB_LINK_FILE); \
156 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_FILE))
157 AFTER_INSTALL_SHARED_LIB_CHOWN = \
158 (cd $(LIB_LINK_INSTALL_DIR); \
159 chown $(CHOWN_TO) $(LIB_LINK_FILE))
162 ####################################################
164 # Start of system specific settings
166 ####################################################
168 ####################################################
172 ifeq ($(findstring rhapsody5, $(GNUSTEP_TARGET_OS)), rhapsody5)
173 ifeq ($(OBJC_RUNTIME_LIB), apple)
177 HAVE_SHARED_LIBS = yes
178 SHARED_LIBEXT = .dylib
180 ifeq ($(FOUNDATION_LIB), apple)
181 # Use the NeXT compiler
185 ARCH_FLAGS = $(foreach a, $(arch), -arch $(a))
186 INTERNAL_OBJCFLAGS += $(ARCH_FLAGS)
187 INTERNAL_CFLAGS += $(ARCH_FLAGS)
188 INTERNAL_LDFLAGS += $(ARCH_FLAGS)
193 Library/Libraries/$(GNUSTEP_TARGET_LDIR)
195 ifneq ($(OBJC_COMPILER), NeXT)
196 SHARED_LIB_LINK_CMD = \
197 $(CC) $(SHARED_LD_PREFLAGS) \
198 -dynamiclib $(ARCH_FLAGS) -dynamic \
199 -compatibility_version 1 -current_version 1 \
200 -install_name $(GNUSTEP_SYSTEM_ROOT)/$(TARGET_LIB_DIR)/$(LIB_LINK_FILE) \
201 $(ALL_LDFLAGS) -o $@ \
202 -framework Foundation \
204 $(INTERNAL_LIBRARIES_DEPEND_UPON) $(LIBRARIES_FOUNDATION_DEPEND_UPON) \
205 -lobjc -lgcc $^ $(SHARED_LD_POSTFLAGS); \
206 (cd $(LIB_LINK_OBJ_DIR); rm -f $(LIB_LINK_FILE); \
207 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_FILE))
208 else # OBJC_COMPILER=NeXT
209 SHARED_LIB_LINK_CMD = \
210 $(CC) $(SHARED_LD_PREFLAGS) \
211 -dynamiclib $(ARCH_FLAGS) -dynamic \
212 -compatibility_version 1 -current_version 1 \
213 -read_only_relocs warning -undefined warning \
214 -install_name $(GNUSTEP_SYSTEM_ROOT)/$(TARGET_LIB_DIR)/$(LIB_LINK_FILE) \
215 $(ALL_LDFLAGS) -o $@ \
216 $(INTERNAL_LIBRARIES_DEPEND_UPON) $(LIBRARIES_FOUNDATION_DEPEND_UPON) \
217 -framework Foundation \
218 $^ $(SHARED_LD_POSTFLAGS); \
219 (cd $(LIB_LINK_OBJ_DIR); rm -f $(LIB_LINK_FILE); \
220 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_FILE))
221 endif # OBJC_COMPILER
224 $(CC) -nostdlib -r -d $(ALL_LDFLAGS) -o $(GNUSTEP_OBJ_DIR)/$(SUBPROJECT_PRODUCT) $^ ;
226 STATIC_LIB_LINK_CMD = \
227 /usr/bin/libtool $(STATIC_LD_PREFLAGS) -static $(ARCH_FLAGS) $(ALL_LDFLAGS) -o $@ $^ \
228 $(STATIC_LD_POSTFLAGS)
230 # This doesn't work with 4.1, what about others?
231 #ADDITIONAL_LDFLAGS += -Wl,-read_only_relocs,suppress
233 AFTER_INSTALL_STATIC_LIB_CMD =
235 SHARED_CFLAGS += -dynamic
236 SHARED_LIBEXT = .dylib
239 BUNDLE_LDFLAGS += -bundle -undefined suppress $(ARCH_FLAGS)
242 # end MacOSX-Server 1.0
244 ####################################################
246 ####################################################
248 # MacOSX 10.[12], darwin[567]
250 ifeq ($(findstring darwin, $(GNUSTEP_TARGET_OS)), darwin)
251 ifeq ($(OBJC_RUNTIME_LIB), apple)
253 # Set flags to ignore the MacOSX headers
254 ifneq ($(FOUNDATION_LIB), apple)
255 INTERNAL_OBJCFLAGS += -no-cpp-precomp -nostdinc -I/usr/include
259 HAVE_SHARED_LIBS = yes
260 SHARED_LIBEXT = .dylib
262 # The output of nm is slightly different on Darwin, it doesn't support -P
263 EXTRACT_CLASS_NAMES_COMMAND = nm -g $$object_file | sed -n -e '/[^U] ___objc_class_name_/ {s/[0-9a-f]* [^U] ___objc_class_name_//p;}'
265 ifeq ($(FOUNDATION_LIB), apple)
267 ARCH_FLAGS = $(foreach a, $(arch), -arch $(a))
268 INTERNAL_OBJCFLAGS += $(ARCH_FLAGS)
269 INTERNAL_CFLAGS += $(ARCH_FLAGS)
270 INTERNAL_LDFLAGS += $(ARCH_FLAGS)
274 # The developer should set this explicitly
275 #DYLIB_COMPATIBILITY_VERSION = -compatibility_version $(VERSION)
276 DYLIB_CURRENT_VERSION = -current_version $(VERSION)
278 # Remove empty dirs from the compiler/linker flags (ie, remove -Idir and
279 # -Ldir flags where dir is empty).
280 REMOVE_EMPTY_DIRS = yes
282 ifeq ($(FOUNDATION_LIB), apple)
283 DYLIB_DEF_FRAMEWORKS += -framework Foundation
287 ifeq ($(CC_BUNDLE), no)
289 SHARED_LD_PREFLAGS += -noall_load -read_only_relocs warning \
290 -flat_namespace -undefined warning
291 # Useful flag: -Wl,-single_module. This flag only
292 # works starting with 10.3. libs w/ffcall don't link on darwin/ix86 without it.
293 ifeq ($(findstring darwin7, $(GNUSTEP_TARGET_OS)), darwin7)
294 SHARED_LD_PREFLAGS += -single_module
296 SHARED_LIB_LINK_CMD = \
298 $(SHARED_LD_PREFLAGS) \
299 $(ARCH_FLAGS) -dynamic \
300 $(DYLIB_COMPATIBILITY_VERSION) \
301 $(DYLIB_CURRENT_VERSION) \
302 -install_name $(LIB_LINK_INSTALL_NAME) \
303 $(ALL_LDFLAGS) -o $@ \
304 $(DYLIB_DEF_FRAMEWORKS) \
305 $^ $(INTERNAL_LIBRARIES_DEPEND_UPON) $(LIBRARIES_FOUNDATION_DEPEND_UPON) \
306 $(SHARED_LD_POSTFLAGS); \
307 (cd $(LIB_LINK_OBJ_DIR); \
308 rm -f $(LIB_LINK_FILE); \
309 if [ "$(LIB_LINK_SONAME_FILE)" != "$(LIB_LINK_VERSION_FILE)" ]; then\
310 rm -f $(LIB_LINK_SONAME_FILE);\
311 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_SONAME_FILE); \
313 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_FILE))
315 BUNDLE_LD = /usr/bin/ld
316 BUNDLE_LDFLAGS += -bundle -flat_namespace -undefined suppress /usr/lib/bundle1.o
321 #DYLIB_EXTRA_FLAGS = -read_only_relocs warning -undefined warning -fno-common
322 DYLIB_EXTRA_FLAGS = -flat_namespace -undefined warning
323 # Useful optimization flag: -Wl,-single_module. This flag only
324 # works starting with 10.3.
325 ifeq ($(findstring darwin7, $(GNUSTEP_TARGET_OS)), darwin7)
326 DYLIB_EXTRA_FLAGS += -Wl,-single_module
329 SHARED_LIB_LINK_CMD = \
330 $(CC) $(SHARED_LD_PREFLAGS) \
331 -dynamiclib $(ARCH_FLAGS) \
332 $(DYLIB_COMPATIBILITY_VERSION) \
333 $(DYLIB_CURRENT_VERSION) \
334 -install_name $(LIB_LINK_INSTALL_NAME) \
335 $(DYLIB_EXTRA_FLAGS) \
336 $(ALL_LDFLAGS) -o $@ \
337 $(INTERNAL_LIBRARIES_DEPEND_UPON) $(LIBRARIES_FOUNDATION_DEPEND_UPON) \
338 $^ $(SHARED_LD_POSTFLAGS); \
339 (cd $(LIB_LINK_OBJ_DIR); \
340 rm -f $(LIB_LINK_FILE); \
341 if [ "$(LIB_LINK_SONAME_FILE)" != "$(LIB_LINK_VERSION_FILE)" ]; then\
342 rm -f $(LIB_LINK_SONAME_FILE);\
343 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_SONAME_FILE); \
345 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_FILE))
347 SHARED_CFLAGS += -dynamic
350 BUNDLE_LDFLAGS += -bundle -undefined error $(ARCH_FLAGS)
354 AFTER_INSTALL_SHARED_LIB_CMD = \
355 (cd $(LIB_LINK_INSTALL_DIR); \
356 rm -f $(LIB_LINK_FILE); \
357 if [ "$(LIB_LINK_SONAME_FILE)" != "$(LIB_LINK_VERSION_FILE)" ]; then\
358 rm -f $(LIB_LINK_SONAME_FILE);\
359 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_SONAME_FILE); \
361 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_FILE) )
364 $(CC) -nostdlib -r -d $(ALL_LDFLAGS) -o $(GNUSTEP_OBJ_DIR)/$(SUBPROJECT_PRODUCT) $^ ;
366 STATIC_LIB_LINK_CMD = \
367 /usr/bin/libtool $(STATIC_LD_PREFLAGS) -static $(ARCH_FLAGS) $(ALL_LDFLAGS) -o $@ $^ \
368 $(STATIC_LD_POSTFLAGS)
370 AFTER_INSTALL_STATIC_LIB_CMD = \
371 (cd $(LIB_LINK_INSTALL_DIR); \
372 $(RANLIB) $(LIB_LINK_VERSION_FILE))
374 SHARED_CFLAGS += -fno-common
378 # end MacOSX 10.2, darwin6
380 ####################################################
382 ####################################################
386 ifeq ($(GNUSTEP_TARGET_OS), nextstep4)
387 ifeq ($(OBJC_RUNTIME_LIB), nx)
392 HAVE_SHARED_LIBS = yes
394 ifeq ($(FOUNDATION_LIB), nx)
395 # Use the NeXT compiler
398 ARCH_FLAGS = $(foreach a, $(arch), -arch $(a))
399 INTERNAL_OBJCFLAGS += $(ARCH_FLAGS)
400 INTERNAL_CFLAGS += $(ARCH_FLAGS)
401 INTERNAL_LDFLAGS += $(ARCH_FLAGS)
406 Library/Libraries/$(GNUSTEP_TARGET_LDIR)
408 ifneq ($(OBJC_COMPILER), NeXT)
409 SHARED_LIB_LINK_CMD = \
410 /bin/libtool $(SHARED_LD_PREFLAGS) \
411 -dynamic -read_only_relocs suppress $(ARCH_FLAGS) \
412 -install_name $(GNUSTEP_SYSTEM_ROOT)/$(TARGET_LIB_DIR)/$(LIB_LINK_FILE) \
413 $(ALL_LDFLAGS) -o $@ \
415 $(INTERNAL_LIBRARIES_DEPEND_UPON) $(LIBRARIES_FOUNDATION_DEPEND_UPON) \
416 -lobjc -lgcc $^ $(SHARED_LD_POSTFLAGS); \
417 (cd $(LIB_LINK_OBJ_DIR); rm -f $(LIB_LINK_FILE); \
418 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_FILE))
420 SHARED_LIB_LINK_CMD = \
421 /bin/libtool $(SHARED_LD_PREFLAGS) \
422 -dynamic -read_only_relocs suppress $(ARCH_FLAGS) \
423 -install_name $(GNUSTEP_SYSTEM_ROOT)/$(TARGET_LIB_DIR)/$(LIB_LINK_FILE) \
426 $(INTERNAL_LIBRARIES_DEPEND_UPON) \
427 $(LIBRARIES_FOUNDATION_DEPEND_UPON) $^ \
428 $(SHARED_LD_POSTFLAGS); \
429 (cd $(LIB_LINK_OBJ_DIR); rm -f $(LIB_LINK_FILE); \
430 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_FILE))
433 STATIC_LIB_LINK_CMD = \
434 /bin/libtool $(STATIC_LD_PREFLAGS) -static $(ARCH_FLAGS) $(ALL_LDFLAGS) -o $@ $^ \
435 $(STATIC_LD_POSTFLAGS)
437 # This doesn't work with 4.1, what about others?
438 #ADDITIONAL_LDFLAGS += -Wl,-read_only_relocs,suppress
440 AFTER_INSTALL_STATIC_LIB_CMD =
442 SHARED_CFLAGS += -dynamic
446 BUNDLE_LDFLAGS += -r $(ARCH_FLAGS)
451 ####################################################
453 ####################################################
457 ifeq ($(GNUSTEP_TARGET_OS), nextstep3)
458 ifeq ($(OBJC_RUNTIME_LIB), nx)
463 HAVE_SHARED_LIBS = yes
465 ifeq ($(FOUNDATION_LIB), nx)
466 # Use the NeXT compiler
469 ARCH_FLAGS = $(foreach a, $(arch), -arch $(a))
470 INTERNAL_OBJCFLAGS += $(ARCH_FLAGS)
471 INTERNAL_CFLAGS += $(ARCH_FLAGS)
472 INTERNAL_LDFLAGS += $(ARCH_FLAGS)
477 Library/Libraries/$(GNUSTEP_TARGET_LDIR)
479 ifneq ($(OBJC_COMPILER), NeXT)
480 SHARED_LIB_LINK_CMD = \
481 /bin/libtool $(SHARED_LD_PREFLAGS) -dynamic -read_only_relocs suppress \
482 $(ARCH_FLAGS) $(ALL_LDFLAGS) -o $@ -framework System \
483 $(INTERNAL_LIBRARIES_DEPEND_UPON) -lobjc -lgcc -undefined warning $^ \
484 $(SHARED_LD_POSTFLAGS); \
485 (cd $(LIB_LINK_OBJ_DIR); rm -f $(LIB_LINK_FILE); \
486 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_FILE))
488 SHARED_LIB_LINK_CMD = \
489 /bin/libtool $(SHARED_LD_PREFLAGS) \
490 -dynamic -read_only_relocs suppress $(ARCH_FLAGS) $(ALL_LDFLAGS) -o $@ \
492 $(INTERNAL_LIBRARIES_DEPEND_UPON) $^ \
493 $(SHARED_LD_POSTFLAGS); \
494 (cd $(LIB_LINK_OBJ_DIR); rm -f $(LIB_LINK_FILE); \
495 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_FILE))
498 STATIC_LIB_LINK_CMD = \
499 /bin/libtool $(STATIC_LD_PREFLAGS) \
500 -static $(ARCH_FLAGS) $(ALL_LDFLAGS) -o $@ $^ $(STATIC_LD_POSTFLAGS)
502 ADDITIONAL_LDFLAGS += -Wl,-read_only_relocs,suppress
504 AFTER_INSTALL_STATIC_LIB_CMD =
506 SHARED_CFLAGS += -dynamic
510 BUNDLE_LDFLAGS += -r $(ARCH_FLAGS)
515 ####################################################
517 ####################################################
519 # Linux ELF or GNU/Hurd
521 # The following ifeq matches both 'linux-gnu' (which is GNU/Linux ELF)
522 # and 'gnu0.3' (I've been told GNUSTEP_TARGET_OS is 'gnu0.3' on
523 # GNU/Hurd at the moment). We want the same code in both cases.
524 ifeq ($(findstring gnu, $(GNUSTEP_TARGET_OS)), gnu)
525 HAVE_SHARED_LIBS = yes
526 SHARED_LIB_LINK_CMD = \
527 $(CC) $(SHARED_LD_PREFLAGS) -shared -Wl,-soname,$(LIB_LINK_SONAME_FILE) \
528 $(ALL_LDFLAGS) -o $(LIB_LINK_OBJ_DIR)/$(LIB_LINK_VERSION_FILE) $^ \
529 $(INTERNAL_LIBRARIES_DEPEND_UPON) \
530 $(SHARED_LD_POSTFLAGS);\
531 (cd $(LIB_LINK_OBJ_DIR); \
532 rm -f $(LIB_LINK_FILE); \
533 if [ "$(LIB_LINK_SONAME_FILE)" != "$(LIB_LINK_VERSION_FILE)" ]; then\
534 rm -f $(LIB_LINK_SONAME_FILE);\
535 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_SONAME_FILE); \
537 $(LN_S) $(LIB_LINK_SONAME_FILE) $(LIB_LINK_FILE); \
539 AFTER_INSTALL_SHARED_LIB_CMD = \
540 (cd $(LIB_LINK_INSTALL_DIR); \
541 rm -f $(LIB_LINK_FILE); \
542 if [ "$(LIB_LINK_SONAME_FILE)" != "$(LIB_LINK_VERSION_FILE)" ]; then\
543 rm -f $(LIB_LINK_SONAME_FILE);\
544 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_SONAME_FILE); \
546 $(LN_S) $(LIB_LINK_SONAME_FILE) $(LIB_LINK_FILE); \
548 AFTER_INSTALL_SHARED_LIB_CHOWN = \
549 (cd $(LIB_LINK_INSTALL_DIR); \
550 chown $(CHOWN_TO) $(LIB_LINK_SONAME_FILE); \
551 chown $(CHOWN_TO) $(LIB_LINK_FILE))
554 $(CC) -nostdlib -r $(ALL_LDFLAGS) -o $(GNUSTEP_OBJ_DIR)/$(SUBPROJECT_PRODUCT) $^ ;
556 SHARED_CFLAGS += -fPIC
561 BUNDLE_LDFLAGS += -shared
562 ADDITIONAL_LDFLAGS += -rdynamic
563 STATIC_LDFLAGS += -static
569 ####################################################
571 ####################################################
573 # FreeBSD a.out (2.2.x)
575 ifeq ($(findstring freebsdaout, $(GNUSTEP_TARGET_OS)), freebsdaout)
578 HAVE_SHARED_LIBS = no
579 SHARED_LIB_LINK_CMD = \
580 $(CC) -shared -Wl,-soname,$(LIB_LINK_VERSION_FILE) \
581 $(ALL_LDFLAGS) -o $(LIB_LINK_OBJ_DIR)/$(LIB_LINK_VERSION_FILE) $^ /usr/lib/c++rt0.o;\
582 (cd $(LIB_LINK_OBJ_DIR); \
583 rm -f $(LIB_LINK_FILE); \
584 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_FILE))
586 SHARED_CFLAGS += -fPIC
591 BUNDLE_LDFLAGS += -shared
592 ADDITIONAL_LDFLAGS += -rdynamic
593 STATIC_LDFLAGS += -static
598 ####################################################
600 ####################################################
604 ifeq ($(findstring freebsd, $(GNUSTEP_TARGET_OS)), freebsd)
605 ifneq ($(freebsdaout), yes)
606 HAVE_SHARED_LIBS = yes
607 SHARED_LIB_LINK_CMD = \
608 $(CC) -shared -Wl,-soname,$(LIB_LINK_SONAME_FILE) \
609 $(ALL_LDFLAGS) -o $(LIB_LINK_OBJ_DIR)/$(LIB_LINK_VERSION_FILE) $^ \
610 $(INTERNAL_LIBRARIES_DEPEND_UPON) \
611 $(SHARED_LD_POSTFLAGS);\
612 (cd $(LIB_LINK_OBJ_DIR); \
613 rm -f $(LIB_LINK_FILE); \
614 if [ "$(LIB_LINK_SONAME_FILE)" != "$(LIB_LINK_VERSION_FILE)" ]; then\
615 rm -f $(LIB_LINK_SONAME_FILE);\
616 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_SONAME_FILE); \
618 $(LN_S) $(LIB_LINK_SONAME_FILE) $(LIB_LINK_FILE))
619 AFTER_INSTALL_SHARED_LIB_CMD = \
620 (cd $(LIB_LINK_INSTALL_DIR); \
621 rm -f $(LIB_LINK_FILE); \
622 if [ "$(LIB_LINK_SONAME_FILE)" != "$(LIB_LINK_VERSION_FILE)" ]; then\
623 rm -f $(LIB_LINK_SONAME_FILE);\
624 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_SONAME_FILE); \
626 $(LN_S) $(LIB_LINK_SONAME_FILE) $(LIB_LINK_FILE); \
628 AFTER_INSTALL_SHARED_LIB_CHOWN = \
629 (cd $(LIB_LINK_INSTALL_DIR); \
630 chown $(CHOWN_TO) $(LIB_LINK_SONAME_FILE); \
631 chown $(CHOWN_TO) $(LIB_LINK_FILE))
633 $(CC) -nostdlib -r $(ALL_LDFLAGS) -o $(GNUSTEP_OBJ_DIR)/$(SUBPROJECT_PRODUCT) $^ ;
635 SHARED_CFLAGS += -fPIC
640 BUNDLE_LDFLAGS += -shared
641 ADDITIONAL_LDFLAGS += -rdynamic
642 STATIC_LDFLAGS += -static
648 ####################################################
650 ####################################################
654 ifeq ($(findstring netbsd, $(GNUSTEP_TARGET_OS)), netbsd)
655 # This is disabled temporarily, because I don't know exactly how
656 # to link shared libs. Everything seems to link correctly now but
657 # constructor functions in the shared lib failed to get called
658 # when the lib is loaded in. I don't know why. ASF.
659 HAVE_SHARED_LIBS = no
661 SHARED_LIB_LINK_CMD = \
662 $(SHARED_LD) -x -Bshareable -Bforcearchive \
663 $(ALL_LDFLAGS) -o $(LIB_LINK_OBJ_DIR)/$(LIB_LINK_VERSION_FILE) $^ /usr/lib/c++rt0.o;\
664 (cd $(LIB_LINK_OBJ_DIR); \
665 rm -f $(LIB_LINK_FILE); \
666 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_FILE))
668 SHARED_CFLAGS += -shared -fpic
673 BUNDLE_LDFLAGS += -shared -fpic
674 #ADDITIONAL_LDFLAGS += -rdynamic
675 STATIC_LDFLAGS += -static
680 ####################################################
682 ####################################################
686 ifeq ($(findstring netbsdelf, $(GNUSTEP_TARGET_OS)), netbsdelf)
687 HAVE_SHARED_LIBS = yes
688 SHARED_LD_POSTFLAGS = -Wl,-R/usr/pkg/lib -L/usr/pkg/lib
689 SHARED_LIB_LINK_CMD = \
690 $(CC) -shared -Wl,-soname,$(LIB_LINK_VERSION_FILE) \
691 $(ALL_LDFLAGS) -o $(LIB_LINK_OBJ_DIR)/$(LIB_LINK_VERSION_FILE) \
692 $^ $(INTERNAL_LIBRARIES_DEPEND_UPON) \
693 $(SHARED_LD_POSTFLAGS); \
694 (cd $(LIB_LINK_OBJ_DIR); \
695 rm -f $(LIB_LINK_FILE); \
696 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_FILE))
698 $(CC) -nostdlib -r $(ALL_LDFLAGS) -o $(GNUSTEP_OBJ_DIR)/$(SUBPROJECT_PRODUCT) $^ ;
700 SHARED_CFLAGS += -fPIC
705 BUNDLE_LDFLAGS += -shared
706 ADDITIONAL_LDFLAGS += -rdynamic -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib
707 ADDITIONAL_INCLUDE_DIRS += -I/usr/pkg/include
708 STATIC_LDFLAGS += -static
713 ####################################################
715 ####################################################
717 # OpenBSD 3.x (though set for 3.3)
719 ifeq ($(findstring openbsd, $(GNUSTEP_TARGET_OS)), openbsd)
720 # This is disabled temporarily, because I don't know exactly how
721 # to link shared libs. Everything seems to link correctly now but
722 # constructor functions in the shared lib failed to get called
723 # when the lib is loaded in. I don't know why. ASF.
724 HAVE_SHARED_LIBS = yes
725 SHARED_LIB_LINK_CMD = \
726 $(CC) -shared -Wl,-soname,$(LIB_LINK_SONAME_FILE) \
727 $(ALL_LDFLAGS) -o $(LIB_LINK_OBJ_DIR)/$(LIB_LINK_VERSION_FILE) $^ \
728 $(INTERNAL_LIBRARIES_DEPEND_UPON) \
729 $(SHARED_LD_POSTFLAGS);\
730 (cd $(LIB_LINK_OBJ_DIR); \
731 rm -f $(LIB_LINK_FILE); \
732 if [ "$(LIB_LINK_SONAME_FILE)" != "$(LIB_LINK_VERSION_FILE)" ]; then\
733 rm -f $(LIB_LINK_SONAME_FILE);\
734 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_SONAME_FILE); \
736 $(LN_S) $(LIB_LINK_SONAME_FILE) $(LIB_LINK_FILE))
737 AFTER_INSTALL_SHARED_LIB_CMD = \
738 (cd $(LIB_LINK_INSTALL_DIR); \
739 rm -f $(LIB_LINK_FILE); \
740 if [ "$(LIB_LINK_SONAME_FILE)" != "$(LIB_LINK_VERSION_FILE)" ]; then\
741 rm -f $(LIB_LINK_SONAME_FILE);\
742 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_SONAME_FILE); \
744 $(LN_S) $(LIB_LINK_SONAME_FILE) $(LIB_LINK_FILE); \
748 $(CC) -nostdlib -r $(ALL_LDFLAGS) -o $(GNUSTEP_OBJ_DIR)/$(SUBPROJECT_PRODUCT) $^ ;
750 SHARED_CFLAGS += -fPIC
755 BUNDLE_LDFLAGS += -shared -fPIC
756 #ADDITIONAL_LDFLAGS += -rdynamic
757 STATIC_LDFLAGS += -static
762 ####################################################
764 ####################################################
768 ifeq ($(findstring osf, $(GNUSTEP_TARGET_OS)), osf)
769 HAVE_SHARED_LIBS = yes
770 SHARED_LIB_LINK_CMD = \
771 $(CC) -shared -Wl,-soname,$(LIB_LINK_VERSION_FILE) \
772 $(ALL_LDFLAGS) -o $(LIB_LINK_OBJ_DIR)/$(LIB_LINK_VERSION_FILE) $^ ;\
773 (cd $(LIB_LINK_OBJ_DIR); \
774 rm -f $(LIB_LINK_FILE); \
775 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_FILE))
777 $(CC) -nostdlib -r $(ALL_LDFLAGS) -o $(GNUSTEP_OBJ_DIR)/$(SUBPROJECT_PRODUCT) $^ ;
779 SHARED_CFLAGS += -fPIC
784 BUNDLE_LDFLAGS += -shared
785 ADDITIONAL_LDFLAGS += -rdynamic
786 STATIC_LDFLAGS += -static
787 # Newer gcc's don't define this in Objective-C programs:
788 AUXILIARY_CPPFLAGS += -D__LANGUAGES_C__
793 ####################################################
795 ####################################################
799 ifeq ($(findstring irix, $(GNUSTEP_TARGET_OS)), irix)
800 HAVE_SHARED_LIBS = yes
802 SHARED_LIB_LINK_CMD = \
803 $(CC) $(SHARED_LD_PREFLAGS) -shared -Wl,-soname,$(LIB_LINK_SONAME_FILE) \
804 $(ALL_LDFLAGS) -o $(LIB_LINK_OBJ_DIR)/$(LIB_LINK_VERSION_FILE) $^ \
805 -Wl,-rpath,$(LIB_LINK_INSTALL_DIR) \
806 $(INTERNAL_LIBRARIES_DEPEND_UPON) \
807 $(SHARED_LD_POSTFLAGS);\
808 (cd $(LIB_LINK_OBJ_DIR); \
809 rm -f $(LIB_LINK_FILE); \
810 if [ "$(LIB_LINK_SONAME_FILE)" != "$(LIB_LINK_VERSION_FILE)" ]; then\
811 rm -f $(LIB_LINK_SONAME_FILE);\
812 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_SONAME_FILE); \
814 $(LN_S) $(LIB_LINK_SONAME_FILE) $(LIB_LINK_FILE); \
816 AFTER_INSTALL_SHARED_LIB_CMD = \
817 (cd $(LIB_LINK_INSTALL_DIR); \
818 rm -f $(LIB_LINK_FILE); \
819 if [ "$(LIB_LINK_SONAME_FILE)" != "$(LIB_LINK_VERSION_FILE)" ]; then\
820 rm -f $(LIB_LINK_SONAME_FILE);\
821 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_SONAME_FILE); \
823 $(LN_S) $(LIB_LINK_SONAME_FILE) $(LIB_LINK_FILE); \
825 AFTER_INSTALL_SHARED_LIB_CHOWN = \
826 (cd $(LIB_LINK_INSTALL_DIR); \
827 chown $(CHOWN_TO) $(LIB_LINK_SONAME_FILE); \
828 chown $(CHOWN_TO) $(LIB_LINK_FILE))
830 SHARED_CFLAGS += -fPIC
834 /usr/bin/ld -r $(ALL_LDFLAGS) -o $(GNUSTEP_OBJ_DIR)/$(SUBPROJECT_PRODUCT) $^ ;
836 ADDITIONAL_LDFLAGS +=
841 BUNDLE_LDFLAGS += -shared
846 ####################################################
848 ####################################################
852 ifeq ($(findstring mingw32, $(GNUSTEP_TARGET_OS)), mingw32)
854 HAVE_SHARED_LIBS = yes
864 $(CC) -nostdlib -r $(ALL_LDFLAGS) -o $(GNUSTEP_OBJ_DIR)/$(SUBPROJECT_PRODUCT) $^ ;
868 BUNDLE_LDFLAGS += -nodefaultlibs -Xlinker -r
873 ####################################################
875 ####################################################
879 ifeq ($(findstring cygwin, $(GNUSTEP_TARGET_OS)), cygwin)
881 HAVE_SHARED_LIBS = yes
891 $(CC) -nostdlib -r $(ALL_LDFLAGS) -o $(GNUSTEP_OBJ_DIR)/$(SUBPROJECT_PRODUCT) $^ ;
895 BUNDLE_LDFLAGS += -nodefaultlibs -Xlinker -r
900 ####################################################
903 ####################################################
907 ifeq ($(findstring solaris, $(GNUSTEP_TARGET_OS)), solaris)
908 HAVE_SHARED_LIBS = yes
909 SHARED_LIB_LINK_CMD = \
910 $(CC) $(SHARED_LD_PREFLAGS) -G -Wl,-h,$(LIB_LINK_SONAME_FILE) \
911 $(ALL_LDFLAGS) -o $(LIB_LINK_OBJ_DIR)/$(LIB_LINK_VERSION_FILE) $^ \
912 $(INTERNAL_LIBRARIES_DEPEND_UPON) \
913 $(SHARED_LD_POSTFLAGS);\
914 (cd $(LIB_LINK_OBJ_DIR); \
915 rm -f $(LIB_LINK_FILE); \
916 if [ "$(LIB_LINK_SONAME_FILE)" != "$(LIB_LINK_VERSION_FILE)" ]; then\
917 rm -f $(LIB_LINK_SONAME_FILE);\
918 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_SONAME_FILE); \
920 $(LN_S) $(LIB_LINK_SONAME_FILE) $(LIB_LINK_FILE); \
922 AFTER_INSTALL_SHARED_LIB_CMD = \
923 (cd $(LIB_LINK_INSTALL_DIR); \
924 rm -f $(LIB_LINK_FILE); \
925 if [ "$(LIB_LINK_SONAME_FILE)" != "$(LIB_LINK_VERSION_FILE)" ]; then\
926 rm -f $(LIB_LINK_SONAME_FILE);\
927 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_SONAME_FILE); \
929 $(LN_S) $(LIB_LINK_SONAME_FILE) $(LIB_LINK_FILE); \
931 AFTER_INSTALL_SHARED_LIB_CHOWN = \
932 (cd $(LIB_LINK_INSTALL_DIR); \
933 chown $(CHOWN_TO) $(LIB_LINK_SONAME_FILE); \
934 chown $(CHOWN_TO) $(LIB_LINK_FILE))
937 $(CC) -nostdlib -r $(ALL_LDFLAGS) -o $(GNUSTEP_OBJ_DIR)/$(SUBPROJECT_PRODUCT) $^ ;
939 SHARED_CFLAGS += -fpic -fPIC
944 BUNDLE_LDFLAGS = -shared -mimpure-text
945 #BUNDLE_LDFLAGS = -nodefaultlibs -Xlinker -r
950 ####################################################
953 ####################################################
957 ifeq ($(findstring sysv4.2, $(GNUSTEP_TARGET_OS)), sysv4.2)
958 HAVE_SHARED_LIBS = yes
959 SHARED_LIB_LINK_CMD = \
960 $(CC) $(SHARED_LD_PREFLAGS) -shared $(ALL_LDFLAGS) -o $(LIB_LINK_VERSION_FILE) $^ \
961 $(SHARED_LD_POSTFLAGS);\
962 mv $(LIB_LINK_VERSION_FILE) $(LIB_LINK_OBJ_DIR);\
963 (cd $(LIB_LINK_OBJ_DIR); \
964 rm -f $(LIB_LINK_FILE); \
965 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_FILE))
967 SHARED_CFLAGS += -fpic -fPIC
972 #BUNDLE_LDFLAGS += -shared -mimpure-text
973 BUNDLE_LDFLAGS += -nodefaultlibs -Xlinker -r
978 ####################################################
981 ####################################################
985 ifeq ($(findstring hpux, $(GNUSTEP_TARGET_OS)), hpux)
986 HAVE_SHARED_LIBS = yes
987 SHARED_LIB_LINK_CMD = \
988 (cd $(LIB_LINK_OBJ_DIR); \
989 $(CC) $(SHARED_LD_PREFLAGS) \
990 -v $(SHARED_CFLAGS) -shared \
991 $(ALL_LDFLAGS) -o $(LIB_LINK_VERSION_FILE) `ls -1 *\.o */*\.o` \
992 $(SHARED_LD_POSTFLAGS) ;\
993 rm -f $(LIB_LINK_FILE); \
994 $(LN_S) $(LIB_LINK_VERSION_FILE) $(LIB_LINK_FILE))
999 SHARED_CFLAGS += -fPIC
1002 ifeq ($(GNUSTEP_HOST_CPU), ia64)
1010 BUNDLE_LDFLAGS += -nodefaultlibs -Xlinker -r
1011 ADDITIONAL_LDFLAGS += -Xlinker +s
1012 STATIC_LDFLAGS += -static
1017 ####################################################