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
87 liboffloadmic_host_la_LIBADD = libcoi_host.la libmyo-client.la
88 liboffloadmic_host_la_DEPENDENCIES = $(liboffloadmic_host_la_LIBADD)
90 liboffloadmic_target_la_SOURCES = $(liboffloadmic_sources) \
91 runtime/coi/coi_server.cpp \
92 runtime/compiler_if_target.cpp \
93 runtime/offload_myo_target.cpp \
94 runtime/offload_omp_target.cpp \
95 runtime/offload_target.cpp \
96 runtime/offload_timer_target.cpp
98 liboffloadmic_target_la_CPPFLAGS = $(liboffloadmic_cppflags) -DHOST_LIBRARY=0
99 liboffloadmic_target_la_LDFLAGS = @lt_cv_dlopen_libs@ -version-info 5:0:0
100 liboffloadmic_target_la_LIBADD = libcoi_device.la libmyo-service.la
101 liboffloadmic_target_la_DEPENDENCIES = $(liboffloadmic_target_la_LIBADD)
104 libcoi_host_la_SOURCES = runtime/emulator/coi_host.cpp
105 libcoi_device_la_SOURCES = runtime/emulator/coi_device.cpp
106 libmyo_client_la_SOURCES = runtime/emulator/myo_client.cpp
107 libmyo_service_la_SOURCES = runtime/emulator/myo_service.cpp
109 libcoi_host_la_DEPENDENCIES = runtime/emulator/coi_version_linker_script.map
110 libcoi_device_la_DEPENDENCIES = runtime/emulator/coi_version_linker_script.map
111 libmyo_client_la_DEPENDENCIES = runtime/emulator/myo_version_linker_script.map
112 libmyo_service_la_DEPENDENCIES = runtime/emulator/myo_version_linker_script.map
114 libcoi_host_la_CPPFLAGS = -I$(coi_inc_dir)
115 libcoi_device_la_CPPFLAGS = -I$(coi_inc_dir)
116 libmyo_client_la_CPPFLAGS = -I$(myo_inc_dir)
117 libmyo_service_la_CPPFLAGS = -I$(myo_inc_dir)
119 libcoi_host_la_LDFLAGS = -lrt -Wl,--version-script=$(source_dir)/emulator/coi_version_linker_script.map
120 libcoi_device_la_LDFLAGS = -lrt -Wl,--version-script=$(source_dir)/emulator/coi_version_linker_script.map
121 libmyo_client_la_LDFLAGS = -lrt -Wl,--version-script=$(source_dir)/emulator/myo_version_linker_script.map
122 libmyo_service_la_LDFLAGS = -lrt -Wl,--version-script=$(source_dir)/emulator/myo_version_linker_script.map
125 all-local: $(ofld_obj)
127 ofldbegin.o: runtime/ofldbegin.cpp
128 $(CXXCOMPILE) $(liboffloadmic_target_la_CPPFLAGS) -c $< -o $@
130 ofldend.o: runtime/ofldend.cpp
131 $(CXXCOMPILE) $(liboffloadmic_target_la_CPPFLAGS) -c $< -o $@
133 # Work around what appears to be a GNU make bug handling MAKEFLAGS
134 # values defined in terms of make variables, as is the case for CC and
135 # friends when we are called from the top level Makefile.
137 "AR_FLAGS=$(AR_FLAGS)" \
138 "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
140 "CXXFLAGS=$(CXXFLAGS)" \
141 "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
142 "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
143 "INSTALL=$(INSTALL)" \
144 "INSTALL_DATA=$(INSTALL_DATA)" \
145 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
146 "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
147 "JC1FLAGS=$(JC1FLAGS)" \
148 "LDFLAGS=$(LDFLAGS)" \
149 "LIBCFLAGS=$(LIBCFLAGS)" \
150 "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
152 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
153 "PICFLAG=$(PICFLAG)" \
154 "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
156 "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
157 "exec_prefix=$(exec_prefix)" \
158 "infodir=$(infodir)" \
161 "includedir=$(includedir)" \
165 "LIBCFLAGS=$(LIBCFLAGS)" \
167 "PICFLAG=$(PICFLAG)" \