1 # Plugin for offload execution on Intel MIC devices.
3 # Copyright (C) 2014 Free Software Foundation, Inc.
5 # Contributed by Ilya Verbin <ilya.verbin@intel.com> and
6 # Andrey Turetskiy <andrey.turetskiy@intel.com>.
8 # This file is part of the GNU Offloading and Multi Processing Library
11 # Libgomp is free software; you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 3, or (at your option)
16 # Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for
21 # Under Section 7 of GPL version 3, you are granted additional
22 # permissions described in the GCC Runtime Library Exception, version
23 # 3.1, as published by the Free Software Foundation.
25 # You should have received a copy of the GNU General Public License and
26 # a copy of the GCC Runtime Library Exception along with this program;
27 # see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
28 # <http://www.gnu.org/licenses/>.
31 AUTOMAKE_OPTIONS = foreign
32 ACLOCAL_AMFLAGS = -I ../.. -I ../../config
35 build_dir = $(top_builddir)
36 source_dir = $(top_srcdir)
37 coi_inc_dir = $(top_srcdir)/../include/coi
38 myo_inc_dir = $(top_srcdir)/../include/myo
39 libgomp_src_dir = $(top_srcdir)/../../libgomp
40 libgomp_dir = $(build_dir)/../../libgomp
41 liboffload_src_dir = $(top_srcdir)/../runtime
42 liboffload_dir = $(top_builddir)/..
44 # May be used by toolexeclibdir.
45 gcc_version := $(shell cat $(top_srcdir)/../../gcc/BASE-VER)
46 libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)/include
47 # Search for main_target_image.h in these directories
48 target_prefix_dir = $(libdir)/gcc/$(accel_target)/$(gcc_version)$(MULTISUBDIR)
49 target_build_dir = $(accel_search_dir)/$(accel_target)$(MULTISUBDIR)/liboffloadmic/plugin
50 target_install_dir = $(accel_search_dir)/lib/gcc/$(accel_target)/$(gcc_version)$(MULTISUBDIR)
53 toolexeclib_LTLIBRARIES = libgomp-plugin-intelmic.la
54 libgomp_plugin_intelmic_la_SOURCES = libgomp-plugin-intelmic.cpp
55 libgomp_plugin_intelmic_la_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=1 -I$(coi_inc_dir) -I$(myo_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_src_dir) -I$(libgomp_dir) -I$(target_prefix_dir)/include -I$(target_build_dir) -I$(target_install_dir)/include
56 libgomp_plugin_intelmic_la_LDFLAGS = -L$(liboffload_dir)/.libs -loffloadmic_host -version-info 1:0:0
58 plugin_includedir = $(libsubincludedir)
59 plugin_include_HEADERS = main_target_image.h
60 AM_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=0 -I$(coi_inc_dir) -I$(myo_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_dir)
61 AM_CXXFLAGS = $(CXXFLAGS)
62 AM_LDFLAGS = -L$(liboffload_dir)/.libs -L$(libgomp_dir)/.libs -loffloadmic_target -lcoi_device -lmyo-service -lgomp -rdynamic
65 main_target_image.h: offload_target_main
66 @echo -n "const int image_size = " > $@
67 @stat -c '%s' $< >> $@
69 @echo "struct MainTargetImage {" >> $@
70 @echo " int64_t size;" >> $@
71 @echo " char name[sizeof \"offload_target_main\"];" >> $@
72 @echo " char data[image_size];" >> $@
74 @echo "extern \"C\" const MainTargetImage main_target_image = {" >> $@
75 @echo " image_size, \"offload_target_main\"," >> $@
76 @cat $< | xxd -include >> $@
79 offload_target_main: $(liboffload_dir)/ofldbegin.o offload_target_main.o $(liboffload_dir)/ofldend.o
80 $(CXX) $(AM_LDFLAGS) $^ -o $@
82 offload_target_main.o: offload_target_main.cpp
83 $(CXX) $(AM_CXXFLAGS) $(AM_CPPFLAGS) -c $< -o $@
85 # Work around what appears to be a GNU make bug handling MAKEFLAGS
86 # values defined in terms of make variables, as is the case for CC and
87 # friends when we are called from the top level Makefile.
89 "AR_FLAGS=$(AR_FLAGS)" \
90 "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
92 "CXXFLAGS=$(CXXFLAGS)" \
93 "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
94 "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
95 "INSTALL=$(INSTALL)" \
96 "INSTALL_DATA=$(INSTALL_DATA)" \
97 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
98 "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
99 "JC1FLAGS=$(JC1FLAGS)" \
100 "LDFLAGS=$(LDFLAGS)" \
101 "LIBCFLAGS=$(LIBCFLAGS)" \
102 "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
104 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
105 "PICFLAG=$(PICFLAG)" \
106 "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
108 "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
109 "exec_prefix=$(exec_prefix)" \
110 "infodir=$(infodir)" \
113 "includedir=$(includedir)" \
117 "LIBCFLAGS=$(LIBCFLAGS)" \
119 "PICFLAG=$(PICFLAG)" \