Makefile.am 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. # Plugin for offload execution on Intel MIC devices.
  2. #
  3. # Copyright (C) 2014-2017 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 Offloading and Multi Processing Library
  9. # (libgomp).
  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. AUTOMAKE_OPTIONS = foreign
  30. ACLOCAL_AMFLAGS = -I ../.. -I ../../config
  31. # Directories
  32. build_dir = $(top_builddir)
  33. source_dir = $(top_srcdir)
  34. coi_inc_dir = $(top_srcdir)/../include/coi
  35. include_src_dir = $(top_srcdir)/../../include
  36. libgomp_src_dir = $(top_srcdir)/../../libgomp
  37. libgomp_dir = $(build_dir)/../../libgomp
  38. liboffload_src_dir = $(top_srcdir)/../runtime
  39. liboffload_dir = $(top_builddir)/..
  40. # May be used by toolexeclibdir.
  41. gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../../gcc/BASE-VER)
  42. libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)/include
  43. # Search for main_target_image.h in these directories
  44. target_prefix_dir = $(libdir)/gcc/$(accel_target)/$(gcc_version)$(MULTISUBDIR)
  45. target_build_dir = $(accel_search_dir)/$(accel_target)$(MULTISUBDIR)/liboffloadmic/plugin
  46. target_install_dir = $(accel_search_dir)/lib/gcc/$(accel_target)/$(gcc_version)$(MULTISUBDIR)
  47. if PLUGIN_HOST
  48. toolexeclib_LTLIBRARIES = libgomp-plugin-intelmic.la
  49. libgomp_plugin_intelmic_la_SOURCES = libgomp-plugin-intelmic.cpp
  50. 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
  51. libgomp_plugin_intelmic_la_LDFLAGS = -L$(liboffload_dir)/.libs -loffloadmic_host -version-info 1:0:0
  52. else # PLUGIN_TARGET
  53. plugin_includedir = $(libsubincludedir)
  54. plugin_include_HEADERS = main_target_image.h
  55. 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)
  56. AM_CXXFLAGS = $(CXXFLAGS)
  57. AM_LDFLAGS = -L$(liboffload_dir)/.libs -L$(libgomp_dir)/.libs -loffloadmic_target -lcoi_device -lgomp -rdynamic
  58. endif
  59. main_target_image.h: offload_target_main
  60. @echo -n "const int image_size = " > $@
  61. @stat -c '%s' $< >> $@
  62. @echo ";" >> $@
  63. @echo "struct MainTargetImage {" >> $@
  64. @echo " int64_t size;" >> $@
  65. @echo " char name[sizeof \"offload_target_main\"];" >> $@
  66. @echo " uint8_t data[image_size];" >> $@
  67. @echo "};" >> $@
  68. @echo "extern \"C\" const MainTargetImage main_target_image = {" >> $@
  69. @echo " image_size, \"offload_target_main\"," >> $@
  70. @cat $< | xxd -include >> $@
  71. @echo "};" >> $@
  72. offload_target_main: $(liboffload_dir)/ofldbegin.o offload_target_main.o $(liboffload_dir)/ofldend.o
  73. $(CXX) $(AM_LDFLAGS) $^ -o $@
  74. offload_target_main.o: offload_target_main.cpp
  75. $(CXX) $(AM_CXXFLAGS) $(AM_CPPFLAGS) -c $< -o $@
  76. # Work around what appears to be a GNU make bug handling MAKEFLAGS
  77. # values defined in terms of make variables, as is the case for CC and
  78. # friends when we are called from the top level Makefile.
  79. AM_MAKEFLAGS = \
  80. "AR_FLAGS=$(AR_FLAGS)" \
  81. "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
  82. "CFLAGS=$(CFLAGS)" \
  83. "CXXFLAGS=$(CXXFLAGS)" \
  84. "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
  85. "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
  86. "INSTALL=$(INSTALL)" \
  87. "INSTALL_DATA=$(INSTALL_DATA)" \
  88. "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
  89. "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
  90. "JC1FLAGS=$(JC1FLAGS)" \
  91. "LDFLAGS=$(LDFLAGS)" \
  92. "LIBCFLAGS=$(LIBCFLAGS)" \
  93. "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
  94. "MAKE=$(MAKE)" \
  95. "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
  96. "PICFLAG=$(PICFLAG)" \
  97. "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
  98. "SHELL=$(SHELL)" \
  99. "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
  100. "exec_prefix=$(exec_prefix)" \
  101. "infodir=$(infodir)" \
  102. "libdir=$(libdir)" \
  103. "prefix=$(prefix)" \
  104. "includedir=$(includedir)" \
  105. "AR=$(AR)" \
  106. "AS=$(AS)" \
  107. "LD=$(LD)" \
  108. "LIBCFLAGS=$(LIBCFLAGS)" \
  109. "NM=$(NM)" \
  110. "PICFLAG=$(PICFLAG)" \
  111. "RANLIB=$(RANLIB)" \
  112. "DESTDIR=$(DESTDIR)"
  113. MAKEOVERRIDES =
  114. include $(top_srcdir)/../../multilib.am