]>
Commit | Line | Data |
---|---|---|
9d73ec14 IV |
1 | # Plugin for offload execution on Intel MIC devices. |
2 | # | |
73aa401e | 3 | # Copyright (C) 2014-2017 Free Software Foundation, Inc. |
9d73ec14 IV |
4 | # |
5 | # Contributed by Ilya Verbin <ilya.verbin@intel.com> and | |
6 | # Andrey Turetskiy <andrey.turetskiy@intel.com>. | |
7 | # | |
f1f3453e TS |
8 | # This file is part of the GNU Offloading and Multi Processing Library |
9 | # (libgomp). | |
9d73ec14 IV |
10 | # |
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) | |
14 | # any later version. | |
15 | # | |
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 | |
19 | # more details. | |
20 | # | |
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. | |
24 | # | |
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/>. | |
29 | ||
30 | ||
31 | AUTOMAKE_OPTIONS = foreign | |
32 | ACLOCAL_AMFLAGS = -I ../.. -I ../../config | |
33 | ||
34 | # Directories | |
35 | build_dir = $(top_builddir) | |
36 | source_dir = $(top_srcdir) | |
37 | coi_inc_dir = $(top_srcdir)/../include/coi | |
8e87588a | 38 | include_src_dir = $(top_srcdir)/../../include |
9d73ec14 IV |
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)/.. | |
43 | ||
44 | # May be used by toolexeclibdir. | |
73aa401e | 45 | gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../../gcc/BASE-VER) |
9d73ec14 IV |
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) | |
51 | ||
52 | if PLUGIN_HOST | |
53 | toolexeclib_LTLIBRARIES = libgomp-plugin-intelmic.la | |
54 | libgomp_plugin_intelmic_la_SOURCES = libgomp-plugin-intelmic.cpp | |
2eab9666 | 55 | libgomp_plugin_intelmic_la_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=1 -I$(coi_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_src_dir) -I$(libgomp_dir) -I$(include_src_dir) -I$(target_prefix_dir)/include -I$(target_build_dir) -I$(target_install_dir)/include |
9d73ec14 IV |
56 | libgomp_plugin_intelmic_la_LDFLAGS = -L$(liboffload_dir)/.libs -loffloadmic_host -version-info 1:0:0 |
57 | else # PLUGIN_TARGET | |
58 | plugin_includedir = $(libsubincludedir) | |
59 | plugin_include_HEADERS = main_target_image.h | |
2eab9666 | 60 | AM_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=0 -I$(coi_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_dir) |
9d73ec14 | 61 | AM_CXXFLAGS = $(CXXFLAGS) |
df26a50d | 62 | AM_LDFLAGS = -L$(liboffload_dir)/.libs -L$(libgomp_dir)/.libs -loffloadmic_target -lcoi_device -lgomp -rdynamic |
9d73ec14 IV |
63 | endif |
64 | ||
65 | main_target_image.h: offload_target_main | |
66 | @echo -n "const int image_size = " > $@ | |
67 | @stat -c '%s' $< >> $@ | |
68 | @echo ";" >> $@ | |
69 | @echo "struct MainTargetImage {" >> $@ | |
70 | @echo " int64_t size;" >> $@ | |
71 | @echo " char name[sizeof \"offload_target_main\"];" >> $@ | |
bb927664 | 72 | @echo " uint8_t data[image_size];" >> $@ |
9d73ec14 IV |
73 | @echo "};" >> $@ |
74 | @echo "extern \"C\" const MainTargetImage main_target_image = {" >> $@ | |
75 | @echo " image_size, \"offload_target_main\"," >> $@ | |
76 | @cat $< | xxd -include >> $@ | |
77 | @echo "};" >> $@ | |
78 | ||
79 | offload_target_main: $(liboffload_dir)/ofldbegin.o offload_target_main.o $(liboffload_dir)/ofldend.o | |
80 | $(CXX) $(AM_LDFLAGS) $^ -o $@ | |
81 | ||
82 | offload_target_main.o: offload_target_main.cpp | |
83 | $(CXX) $(AM_CXXFLAGS) $(AM_CPPFLAGS) -c $< -o $@ | |
84 | ||
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. | |
88 | AM_MAKEFLAGS = \ | |
89 | "AR_FLAGS=$(AR_FLAGS)" \ | |
90 | "CC_FOR_BUILD=$(CC_FOR_BUILD)" \ | |
91 | "CFLAGS=$(CFLAGS)" \ | |
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)" \ | |
103 | "MAKE=$(MAKE)" \ | |
104 | "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \ | |
105 | "PICFLAG=$(PICFLAG)" \ | |
106 | "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \ | |
107 | "SHELL=$(SHELL)" \ | |
108 | "RUNTESTFLAGS=$(RUNTESTFLAGS)" \ | |
109 | "exec_prefix=$(exec_prefix)" \ | |
110 | "infodir=$(infodir)" \ | |
111 | "libdir=$(libdir)" \ | |
112 | "prefix=$(prefix)" \ | |
113 | "includedir=$(includedir)" \ | |
114 | "AR=$(AR)" \ | |
115 | "AS=$(AS)" \ | |
116 | "LD=$(LD)" \ | |
117 | "LIBCFLAGS=$(LIBCFLAGS)" \ | |
118 | "NM=$(NM)" \ | |
119 | "PICFLAG=$(PICFLAG)" \ | |
120 | "RANLIB=$(RANLIB)" \ | |
121 | "DESTDIR=$(DESTDIR)" | |
122 | ||
123 | MAKEOVERRIDES = | |
124 | ||
22e05272 | 125 | include $(top_srcdir)/../../multilib.am |