about summary refs log tree commit diff homepage
path: root/runtime/Runtest/Makefile
blob: 82e213459cb680cd44c9725658445a8a40ff426a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#===-- runtime/Runtest/Makefile ----------------------------*- Makefile -*--===#
#
#                     The KLEE Symbolic Virtual Machine
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#

LEVEL=../..

USEDLIBS=kleeBasic.a
LIBRARYNAME=kleeRuntest
SHARED_LIBRARY=1
LINK_LIBS_IN_SHARED = 1
DONT_BUILD_RELINKED = 1
NO_PEDANTIC=1
# Increment version appropriately if ABI/API changes, more details:
# http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN135
SHARED_VERSION=1.0

include $(LEVEL)/Makefile.common

#LDFLAGS += -Wl,-soname,lib$(LIBRARYNAME)$(SHLIBEXT)
ifeq ($(HOST_OS),Darwin)
    # set dylib internal version number to llvmCore submission number
    ifdef LLVM_SUBMIT_VERSION
        LLVMLibsOptions := $(LLVMLibsOptions) -Wl,-current_version \
                        -Wl,$(SHARED_VERSION) \
                        -Wl,-compatibility_version -Wl,1
    endif
    # Include everything from the .a's into the shared library.
    LLVMLibsOptions    := $(LLVMLibsOptions) -all_load
    # extra options to override libtool defaults
    LLVMLibsOptions    := $(LLVMLibsOptions)  \
                         -Wl,-dead_strip

    # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
    DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
    ifneq ($(DARWIN_VERS),8)
       LLVMLibsOptions    := $(LLVMLibsOptions)  \
                            -Wl,-install_name \
                            -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)"
    endif
endif

ifeq ($(HOST_OS), $(filter $(HOST_OS), DragonFly Linux FreeBSD GNU/kFreeBSD OpenBSD GNU Bitrig))
    # Include everything from the .a's into the shared library.
    LLVMLibsOptions := -Wl,--whole-archive $(LLVMLibsOptions) \
                       -Wl,--no-whole-archive
endif

ifeq ($(HOST_OS), $(filter $(HOST_OS), DragonFly Linux FreeBSD GNU/kFreeBSD GNU))
    # Add soname to the library.
    LLVMLibsOptions += -Wl,--soname,lib$(LIBRARYNAME)$(SHLIBEXT).$(SHARED_VERSION)
endif

ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux GNU GNU/kFreeBSD))
    # Don't allow unresolved symbols.
    LLVMLibsOptions += -Wl,--no-undefined
endif

ifeq ($(HOST_OS), Linux)
	# HACK: Setup symlinks that `ldconfig` would set up
	# so that libkleeRuntest can be used from the build directory.
	# This is needed to run tests.
	sym_link_name := $(SharedLibDir)/$(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT).$(SHARED_VERSION)

all:: $(LibName.SO)
	$(Verb) [ ! -e "$(sym_link_name)" ] && ln -s $(LibName.SO) "$(sym_link_name)" || echo ""

endif