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 myo_inc_dir = $(top_srcdir)/include/myo
41 libgomp_dir = $(build_dir)/../libgomp
42 source_dir = $(top_srcdir)/runtime
44 # May be used by toolexeclibdir.
45 gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
46 libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
50 nodist_toolexeclib_HEADERS = liboffloadmic_host.spec
51 toolexeclib_LTLIBRARIES = libcoi_host.la libmyo-client.la liboffloadmic_host.la
52 nodist_libsubinclude_HEADERS = runtime/compiler_if_host.h
54 else # LIBOFFLOADMIC_TARGET
55 nodist_toolexeclib_HEADERS = liboffloadmic_target.spec
56 toolexeclib_LTLIBRARIES = libcoi_device.la libmyo-service.la liboffloadmic_target.la
57 nodist_libsubinclude_HEADERS = runtime/compiler_if_target.h
58 ofld_obj = ofldbegin.o ofldend.o
62 liboffloadmic_sources = runtime/dv_util.cpp \
63 runtime/liboffload_error.c \
64 runtime/liboffload_msg.c \
65 runtime/offload_common.cpp \
66 runtime/offload_table.cpp \
67 runtime/offload_trace.cpp \
68 runtime/offload_util.cpp
70 liboffloadmic_cppflags = -DLINUX -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -I$(coi_inc_dir) -I$(myo_inc_dir) -I$(source_dir) -I$(libgomp_dir)
72 liboffloadmic_host_la_SOURCES = $(liboffloadmic_sources) \
73 runtime/cean_util.cpp \
74 runtime/coi/coi_client.cpp \
75 runtime/compiler_if_host.cpp \
76 runtime/offload_engine.cpp \
77 runtime/offload_env.cpp \
78 runtime/offload_host.cpp \
79 runtime/offload_myo_host.cpp \
80 runtime/offload_omp_host.cpp \
81 runtime/offload_orsl.cpp \
82 runtime/offload_timer_host.cpp \
83 runtime/orsl-lite/lib/orsl-lite.c
85 liboffloadmic_host_la_CPPFLAGS = $(liboffloadmic_cppflags) -DHOST_LIBRARY=1
86 liboffloadmic_host_la_LDFLAGS = @lt_cv_dlopen_libs@ -version-info 5:0:0
88 liboffloadmic_target_la_SOURCES = $(liboffloadmic_sources) \
89 runtime/coi/coi_server.cpp \
90 runtime/compiler_if_target.cpp \
91 runtime/offload_myo_target.cpp \
92 runtime/offload_omp_target.cpp \
93 runtime/offload_target.cpp \
94 runtime/offload_timer_target.cpp
96 liboffloadmic_target_la_CPPFLAGS = $(liboffloadmic_cppflags) -DHOST_LIBRARY=0
97 liboffloadmic_target_la_LDFLAGS = @lt_cv_dlopen_libs@ -version-info 5:0:0
98 liboffloadmic_target_la_LIBADD = libcoi_device.la libmyo-service.la
99 liboffloadmic_target_la_DEPENDENCIES = $(liboffloadmic_target_la_LIBADD)
102 libcoi_host_la_SOURCES = runtime/emulator/coi_host.cpp
103 libcoi_device_la_SOURCES = runtime/emulator/coi_device.cpp
104 libmyo_client_la_SOURCES = runtime/emulator/myo_client.cpp
105 libmyo_service_la_SOURCES = runtime/emulator/myo_service.cpp
107 libcoi_host_la_DEPENDENCIES = runtime/emulator/coi_version_linker_script.map
108 libcoi_device_la_DEPENDENCIES = runtime/emulator/coi_version_linker_script.map
109 libmyo_client_la_DEPENDENCIES = runtime/emulator/myo_version_linker_script.map
110 libmyo_service_la_DEPENDENCIES = runtime/emulator/myo_version_linker_script.map
112 libcoi_host_la_CPPFLAGS = -I$(coi_inc_dir)
113 libcoi_device_la_CPPFLAGS = -I$(coi_inc_dir)
114 libmyo_client_la_CPPFLAGS = -I$(myo_inc_dir)
115 libmyo_service_la_CPPFLAGS = -I$(myo_inc_dir)
117 libcoi_host_la_LDFLAGS = -lrt -Wl,--version-script=$(source_dir)/emulator/coi_version_linker_script.map
118 libcoi_device_la_LDFLAGS = -lrt -Wl,--version-script=$(source_dir)/emulator/coi_version_linker_script.map
119 libmyo_client_la_LDFLAGS = -lrt -Wl,--version-script=$(source_dir)/emulator/myo_version_linker_script.map
120 libmyo_service_la_LDFLAGS = -lrt -Wl,--version-script=$(source_dir)/emulator/myo_version_linker_script.map
123 all-local: $(ofld_obj)
125 ofldbegin.o: runtime/ofldbegin.cpp
126 $(CXXCOMPILE) $(liboffloadmic_target_la_CPPFLAGS) -c $< -o $@
128 ofldend.o: runtime/ofldend.cpp
129 $(CXXCOMPILE) $(liboffloadmic_target_la_CPPFLAGS) -c $< -o $@
131 # Work around what appears to be a GNU make bug handling MAKEFLAGS
132 # values defined in terms of make variables, as is the case for CC and
133 # friends when we are called from the top level Makefile.
135 "AR_FLAGS=$(AR_FLAGS)" \
136 "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
138 "CXXFLAGS=$(CXXFLAGS)" \
139 "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
140 "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
141 "INSTALL=$(INSTALL)" \
142 "INSTALL_DATA=$(INSTALL_DATA)" \
143 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
144 "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
145 "JC1FLAGS=$(JC1FLAGS)" \
146 "LDFLAGS=$(LDFLAGS)" \
147 "LIBCFLAGS=$(LIBCFLAGS)" \
148 "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
150 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
151 "PICFLAG=$(PICFLAG)" \
152 "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
154 "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
155 "exec_prefix=$(exec_prefix)" \
156 "infodir=$(infodir)" \
159 "includedir=$(includedir)" \
163 "LIBCFLAGS=$(LIBCFLAGS)" \
165 "PICFLAG=$(PICFLAG)" \