2 # Copyright (c) 2014 Intel Corporation. All Rights Reserved.
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions
8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above copyright
11 # notice, this list of conditions and the following disclaimer in the
12 # documentation and/or other materials provided with the distribution.
13 # * Neither the name of Intel Corporation nor the names of its
14 # contributors may be used to endorse or promote products derived
15 # from this software without specific prior written permission.
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 AUTOMAKE_OPTIONS = foreign
32 ACLOCAL_AMFLAGS = -I .. -I ../config
34 # Build plugin for Intel MIC
38 build_dir = $(top_builddir)
39 coi_inc_dir = $(top_srcdir)/include/coi
40 libgomp_dir = $(build_dir)/../libgomp
41 source_dir = $(top_srcdir)/runtime
43 # May be used by toolexeclibdir.
44 gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
45 libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
49 nodist_toolexeclib_HEADERS = liboffloadmic_host.spec
50 toolexeclib_LTLIBRARIES = libcoi_host.la liboffloadmic_host.la
51 nodist_libsubinclude_HEADERS = runtime/compiler_if_host.h
53 else # LIBOFFLOADMIC_TARGET
54 nodist_toolexeclib_HEADERS = liboffloadmic_target.spec
55 toolexeclib_LTLIBRARIES = libcoi_device.la liboffloadmic_target.la
56 nodist_libsubinclude_HEADERS = runtime/compiler_if_target.h
57 ofld_obj = ofldbegin.o ofldend.o
61 liboffloadmic_sources = runtime/dv_util.cpp \
62 runtime/liboffload_error.c \
63 runtime/liboffload_msg.c \
64 runtime/offload_common.cpp \
65 runtime/offload_table.cpp \
66 runtime/offload_trace.cpp \
67 runtime/offload_util.cpp
69 liboffloadmic_cppflags = -DLINUX -DCOI_LIBRARY_VERSION=2 -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -I$(coi_inc_dir) -I$(source_dir) -I$(libgomp_dir)
71 liboffloadmic_host_la_SOURCES = $(liboffloadmic_sources) \
72 runtime/cean_util.cpp \
73 runtime/coi/coi_client.cpp \
74 runtime/compiler_if_host.cpp \
75 runtime/offload_engine.cpp \
76 runtime/offload_env.cpp \
77 runtime/offload_host.cpp \
78 runtime/offload_omp_host.cpp \
79 runtime/offload_orsl.cpp \
80 runtime/offload_timer_host.cpp \
81 runtime/orsl-lite/lib/orsl-lite.c
83 liboffloadmic_host_la_CPPFLAGS = $(liboffloadmic_cppflags) -DHOST_LIBRARY=1
84 liboffloadmic_host_la_LDFLAGS = @lt_cv_dlopen_libs@ -version-info 5:0:0
86 liboffloadmic_target_la_SOURCES = $(liboffloadmic_sources) \
87 runtime/coi/coi_server.cpp \
88 runtime/compiler_if_target.cpp \
89 runtime/offload_omp_target.cpp \
90 runtime/offload_target.cpp \
91 runtime/offload_timer_target.cpp
93 liboffloadmic_target_la_CPPFLAGS = $(liboffloadmic_cppflags) -DHOST_LIBRARY=0
94 liboffloadmic_target_la_LDFLAGS = @lt_cv_dlopen_libs@ -version-info 5:0:0
95 liboffloadmic_target_la_LIBADD = libcoi_device.la
96 liboffloadmic_target_la_DEPENDENCIES = $(liboffloadmic_target_la_LIBADD)
99 libcoi_host_la_SOURCES = runtime/emulator/coi_host.cpp
100 libcoi_device_la_SOURCES = runtime/emulator/coi_device.cpp
102 libcoi_host_la_DEPENDENCIES = runtime/emulator/coi_version_linker_script.map
103 libcoi_device_la_DEPENDENCIES = runtime/emulator/coi_version_linker_script.map
105 libcoi_host_la_CPPFLAGS = -I$(coi_inc_dir)
106 libcoi_device_la_CPPFLAGS = -I$(coi_inc_dir)
108 libcoi_host_la_LDFLAGS = -lrt -Wl,--version-script=$(source_dir)/emulator/coi_version_linker_script.map
109 libcoi_device_la_LDFLAGS = -lrt -Wl,--version-script=$(source_dir)/emulator/coi_version_linker_script.map
112 all-local: $(ofld_obj)
114 ofldbegin.o: runtime/ofldbegin.cpp
115 $(CXXCOMPILE) $(liboffloadmic_target_la_CPPFLAGS) -c $< -o $@
117 ofldend.o: runtime/ofldend.cpp
118 $(CXXCOMPILE) $(liboffloadmic_target_la_CPPFLAGS) -c $< -o $@
120 # Work around what appears to be a GNU make bug handling MAKEFLAGS
121 # values defined in terms of make variables, as is the case for CC and
122 # friends when we are called from the top level Makefile.
124 "AR_FLAGS=$(AR_FLAGS)" \
125 "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
127 "CXXFLAGS=$(CXXFLAGS)" \
128 "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
129 "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
130 "INSTALL=$(INSTALL)" \
131 "INSTALL_DATA=$(INSTALL_DATA)" \
132 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
133 "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
134 "JC1FLAGS=$(JC1FLAGS)" \
135 "LDFLAGS=$(LDFLAGS)" \
136 "LIBCFLAGS=$(LIBCFLAGS)" \
137 "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
139 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
140 "PICFLAG=$(PICFLAG)" \
141 "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
143 "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
144 "exec_prefix=$(exec_prefix)" \
145 "infodir=$(infodir)" \
148 "includedir=$(includedir)" \
152 "LIBCFLAGS=$(LIBCFLAGS)" \
154 "PICFLAG=$(PICFLAG)" \
160 include $(top_srcdir)/../multilib.am