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