diff options
Diffstat (limited to 'openmp/runtime')
31 files changed, 30 insertions, 7277 deletions
diff --git a/openmp/runtime/Makefile b/openmp/runtime/Makefile deleted file mode 100644 index 5f025b4411c..00000000000 --- a/openmp/runtime/Makefile +++ /dev/null @@ -1,78 +0,0 @@ -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -omp_root?=. -include $(omp_root)/tools/common.inc -.PHONY: default all omp - -default: omp - -all: omp stubs - -omp: info mkdir - @echo $(omp_root)/tools/build.pl $(build_args) --arch=$(arch) --mode=$(mode) lib inc common -- -j$(jobs) - $(omp_root)/tools/build.pl $(build_args) --arch=$(arch) --mode=$(mode) lib inc common -- -j$(jobs) - -stubs: mkdir - @echo $(omp_root)/tools/build.pl $(build_args) --arch=$(arch) --mode=$(mode) --stubs lib inc common -- -j$(jobs) - $(omp_root)/tools/build.pl $(build_args) --arch=$(arch) --mode=$(mode) --stubs lib inc common -- -j$(jobs) - -.PHONY: clean info - -clean: - $(shell $(RM) -rf $(omp_root)$(SLASH)tmp) - @echo clean done - -mkdir: - $(shell $(MD) $(omp_root)$(SLASH)tmp >$(NUL) 2>$(NUL)) - @echo Created $(omp_root)$(SLASH)tmp directory - -info: - @echo omp_root=$(omp_root) - @echo omp_os=$(omp_os) - @echo arch=$(arch) -ifeq "$(arch)" "mic" - @echo mic_arch=$(mic_arch) -endif - @echo compiler=$(compiler) - @echo mic=$(mic) - @echo mode=$(mode) - @echo jobs=$(jobs) - - - -libomp_path=$(shell $(omp_root)/tools/check-openmp.pl) -test_path=$(shell $(omp_root)/tools/check-openmp-test.pl) - -# Please do not change this rule. -# ------------------------------- -# Intentionally changing directory into "testsuite" in order to generate output results and errors -# over there and keep this directory clean. -test: omp - @$(Verb) if which llvm-lit &> /dev/null; then \ - if [ -d "$(omp_root)$(SLASH)..$(SLASH)testsuite$(SLASH)LLVM-IR" ] ; then \ - export TESTSUITE_TEMP=$(realpath $(omp_root))$(SLASH)tmp ; \ - export LIBRARY_PATH=$(libomp_path):$(LIBRARY_PATH) ; \ - export C_INCLUDE_PATH=$(libomp_path)$(SLASH)..$(SLASH)..$(SLASH)common$(SLASH)include:$(C_INCLUDE_PATH) ; \ - export LD_LIBRARY_PATH=$(libomp_path):$(LD_LIBRARY_PATH) ; \ - export DYLD_LIBRARY_PATH=$(libomp_path):$(DYLD_LIBRARY_PATH) ; \ - cd $(omp_root)$(SLASH)..$(SLASH)testsuite ; \ - make ctest ; \ - python adding_xfails.py ; \ - llvm-lit -j 1 $(realpath $(omp_root))$(SLASH)..$(SLASH)testsuite$(SLASH)LLVM-IR$(SLASH)$(test_path) -v ; \ - else \ - echo "No test directory" ; exit 1; \ - fi; else echo "No llvm-lit in $(PATH)"; exit 1; fi - -test-clean: - make -C ..$(SLASH)testsuite cleanall - - diff --git a/openmp/runtime/README.txt b/openmp/runtime/README.txt index 4672dd1b147..f4d3bd97c8f 100644 --- a/openmp/runtime/README.txt +++ b/openmp/runtime/README.txt @@ -23,77 +23,35 @@ www.doxygen.org. How to Build the LLVM* OpenMP* Runtime Library ============================================== - -The library can be built either using Cmake, or using a makefile that -in turn invokes various Perl scripts. For porting, non X86 -architectures, and for those already familiar with Cmake that may be -an easier route to take than the one described here. - -Building with CMake -=================== -The runtime/Build_With_CMake.txt file has a description of how to -build with Cmake. - -Building with the Makefile -========================== -The Makefile at the top-level will attempt to detect what it needs to -build the LLVM* OpenMP* Runtime Library. To see the default settings, -type: - -make info - -You can change the Makefile's behavior with the following options: - -omp_root: The path to the top-level directory containing the top-level - Makefile. By default, this will take on the value of the - current working directory. - -omp_os: Operating system. By default, the build will attempt to - detect this. Currently supports "linux", "freebsd", "macos", and - "windows". - -arch: Architecture. By default, the build will attempt to - detect this if not specified by the user. Currently - supported values are - "32" for IA-32 architecture - "32e" for Intel(R) 64 architecture - "mic" for Intel(R) Many Integrated Core Architecture - "arm" for ARM* architecture - "aarch64" for Aarch64 (64-bit ARM) architecture - "ppc64" for IBM(R) Power architecture (big endian) - "ppc64le" for IBM(R) Power architecture (little endian) - - If "mic" is specified then "icc" will be used as the - compiler, and appropriate k1om binutils will be used. The - necessary packages must be installed on the build machine - for this to be possible (but an Intel(R) Xeon Phi(TM) - coprocessor card is not required to build the library). - -compiler: Which compiler to use for the build. Defaults to "icc" - or "icl" depending on the value of omp_os. Also supports - some versions of "gcc"* when omp_os is "linux". The selected - compiler should be installed and in the user's path. The - corresponding Fortran compiler should also be in the path. - See "Supported RTL Build Configurations" below for more - information on compiler versions. - -mode: Library mode: default is "release". Also supports "debug". - -jobs: The number of parallel jobs for the underlying call to make. - This value is sent as the parameter to the -j flag for make. - This value defaults to "1", but can be set to any positive integer. - -To use any of the options above, simple add <option_name>=<value>. For -example, if you want to build with gcc instead of icc, type: - -make compiler=gcc - -On OS X* machines, it is possible to build universal (or fat) libraries which -include both IA-32 architecture and Intel(R) 64 architecture objects in a -single archive; just build the 32 and 32e libraries separately, then invoke -make again with a special argument as follows: - -make compiler=clang build_args=fat +In-tree build: + +$ cd where-you-want-to-live +Check out openmp into llvm/projects +$ cd where-you-want-to-build +$ mkdir build && cd build +$ cmake path/to/llvm -DCMAKE_C_COMPILER=<C compiler> -DCMAKE_CXX_COMPILER=<C++ compiler> +$ make omp + +Out-of-tree build: + +$ cd where-you-want-to-live +Check out openmp +$ cd where-you-want-to-live/openmp/runtime +$ mkdir build && cd build +$ cmake path/to/openmp -DCMAKE_C_COMPILER=<C compiler> -DCMAKE_CXX_COMPILER=<C++ compiler> +$ make + +For details about building, please look at Build_With_CMake.txt + +Architectures Supported +======================= +* IA-32 architecture +* Intel(R) 64 architecture +* Intel(R) Many Integrated Core Architecture +* ARM* architecture +* Aarch64 (64-bit ARM) architecture +* IBM(R) Power architecture (big endian) +* IBM(R) Power architecture (little endian) Supported RTL Build Configurations ================================== @@ -112,7 +70,7 @@ Intel(R) Many Integrated Core Architecture (1) On IA-32 architecture and Intel(R) 64, icc/icl versions 12.x are supported (12.1 is recommended). -(2) GCC* version 4.6.2 is supported. +(2) GCC* version 4.7 is supported. (3) For icc on OS X*, OS X* version 10.5.8 is supported. (4) Intel(R) Many Integrated Core Architecture not supported. (5) On Intel(R) Many Integrated Core Architecture, icc/icl versions 13.0 diff --git a/openmp/runtime/src/defs.mk b/openmp/runtime/src/defs.mk deleted file mode 100644 index 2bf82ac9df3..00000000000 --- a/openmp/runtime/src/defs.mk +++ /dev/null @@ -1,67 +0,0 @@ -# defs.mk - -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -# -------------------------------------------------------------------------------------------------- -# This file contains definitions common for OpenMP RTL and DSL makefiles. -# -------------------------------------------------------------------------------------------------- - -# Include really common definitions. -include $(LIBOMP_WORK)tools/src/common-defs.mk - -# -# Directories. -# - -# Check and normalize LIBOMP_EXPORTS. -ifeq "$(LIBOMP_EXPORTS)" "" - $(error LIBOMP_EXPORTS environment variable must be set) -endif -ifneq "$(words $(LIBOMP_EXPORTS))" "1" - $(error LIBOMP_EXPORTS must not contain spaces) -endif -override LIBOMP_EXPORTS := $(subst \,/,$(LIBOMP_EXPORTS)) -ifeq "$(filter %/,$(LIBOMP_EXPORTS))" "" - override LIBOMP_EXPORTS := $(LIBOMP_EXPORTS)/ -endif -# Output directories. -out_dir = $(LIBOMP_EXPORTS) -out_cmn_dir = $(out_dir)common$(suffix)/ -out_ptf_dir = $(out_dir)$(platform)$(suffix)/ -_out_lib_dir = $(out_dir)$(1)$(suffix)/lib$(if $(filter mac_%,$(1)),.thin)/ -out_lib_dir = $(call _out_lib_dir,$(platform)) -ifneq "$(arch)" "mic" -out_l10n_dir = $(out_lib_dir)$(if $(filter lin mac,$(os)),locale/) -else -out_l10n_dir = $(out_lib_dir) -endif -ifeq "$(os)" "mac" - _out_lib_fat_dir = $(out_dir)$(1)$(suffix)/lib/ - out_lib_fat_dir = $(call _out_lib_fat_dir,$(platform)) - out_l10n_fat_dir = $(out_lib_fat_dir)locale/ -endif - -# -# Retrieve build number, -# - -ifeq "$(clean)" "" - # Parse kmp_version.c file, look for "#define KMP_VERSION_BUILD yyyymmdd" string, - # leave only "yyyymmdd". Note: Space after $$1 is important, it helps to detect possible errors. - build := $(strip $(shell $(perl) -p -e '$$_ =~ s{^(?:\s*\#define\s+KMP_VERSION_BUILD\s+([0-9]{8})|.*)\s*\n}{$$1 }' $(LIBOMP_WORK)src/kmp_version.c)) - ifneq "$(words $(build))" "1" - $(error Failed to pase "kmp_version.c", cannot extract build number) - endif - $(call say,Build : $(build)$(if $(filter 00000000,$(build)), (development))) -endif - -# end of file # diff --git a/openmp/runtime/src/include/30/iomp.h.var b/openmp/runtime/src/include/30/iomp.h.var deleted file mode 100644 index c182486f1a1..00000000000 --- a/openmp/runtime/src/include/30/iomp.h.var +++ /dev/null @@ -1,96 +0,0 @@ -/* - * include/30/iomp.h.var - */ - - -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.txt for details. -// -//===----------------------------------------------------------------------===// - - -#ifndef __IOMP_H -# define __IOMP_H - -# define KMP_VERSION_MAJOR $KMP_VERSION_MAJOR -# define KMP_VERSION_MINOR $KMP_VERSION_MINOR -# define KMP_VERSION_BUILD $KMP_VERSION_BUILD -# define KMP_BUILD_DATE "$KMP_BUILD_DATE" - -# ifdef __cplusplus - extern "C" { -# endif - -# define kmp_set_stacksize kmpc_set_stacksize -# define kmp_set_stacksize_s kmpc_set_stacksize_s -# define kmp_set_blocktime kmpc_set_blocktime -# define kmp_set_library kmpc_set_library -# define kmp_set_defaults kmpc_set_defaults -# define kmp_set_affinity_mask_proc kmpc_set_affinity_mask_proc -# define kmp_unset_affinity_mask_proc kmpc_unset_affinity_mask_proc -# define kmp_get_affinity_mask_proc kmpc_get_affinity_mask_proc - -# define kmp_malloc kmpc_malloc -# define kmp_calloc kmpc_calloc -# define kmp_realloc kmpc_realloc -# define kmp_free kmpc_free - -# if defined(_WIN32) -# define __KAI_KMPC_CONVENTION __cdecl -# else -# define __KAI_KMPC_CONVENTION -# endif - -# include <stdlib.h> - /* kmp API functions */ - extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void); - extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int); - extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void); - extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t); - extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void); - extern int __KAI_KMPC_CONVENTION kmp_get_library (void); - extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int); - extern void __KAI_KMPC_CONVENTION kmp_set_library (int); - extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void); - extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void); - extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void); - extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *); - - /* affinity API functions */ - typedef void * kmp_affinity_mask_t; - - extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *); - extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *); - extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void); - extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *); - extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *); - extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *); - extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *); - extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *); - - extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t); - extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t); - extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t); - extern void __KAI_KMPC_CONVENTION kmp_free (void *); - - extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void); - extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void); - -# undef __KAI_KMPC_CONVENTION - - /* Warning: - The following typedefs are not standard, deprecated and will be removed in a future release. - */ - typedef int omp_int_t; - typedef double omp_wtime_t; - -# ifdef __cplusplus - } -# endif - -#endif /* __IOMP_H */ - diff --git a/openmp/runtime/src/include/30/iomp_lib.h.var b/openmp/runtime/src/include/30/iomp_lib.h.var deleted file mode 100644 index 9abbd60016c..00000000000 --- a/openmp/runtime/src/include/30/iomp_lib.h.var +++ /dev/null @@ -1,81 +0,0 @@ -! include/30/iomp_lib.h.var - -! -!//===----------------------------------------------------------------------===// -!// -!// The LLVM Compiler Infrastructure -!// -!// This file is dual licensed under the MIT and the University of Illinois Open -!// Source Licenses. See LICENSE.txt for details. -!// -!//===----------------------------------------------------------------------===// -! - -!*** -!*** omp_integer_kind and omp_logical_kind appear to be predefined by gcc and -!*** gfortran (definitions do not appear in the omp.h / omp_lib.h /omp_lib.f). -!*** omp_real_kind is not predefined, however. -!*** - - integer, parameter :: kmp_version_major = $KMP_VERSION_MAJOR - integer, parameter :: kmp_version_minor = $KMP_VERSION_MINOR - integer, parameter :: kmp_version_build = $KMP_VERSION_BUILD - character(*) kmp_build_date - parameter( kmp_build_date = '$KMP_BUILD_DATE' ) - - integer, parameter :: omp_real_kind = 4 - -!*** -!*** kmp_* type extensions -!*** - - integer, parameter :: kmp_pointer_kind = $KMP_INT_PTR_KIND - integer, parameter :: kmp_size_t_kind = $KMP_INT_PTR_KIND - integer, parameter :: kmp_affinity_mask_kind = $KMP_INT_PTR_KIND - -!*** -!*** kmp_* entry points -!*** - - external kmp_set_stacksize - external kmp_set_stacksize_s - external kmp_set_blocktime - external kmp_set_library_serial - external kmp_set_library_turnaround - external kmp_set_library_throughput - external kmp_set_library - external kmp_set_defaults - external kmp_get_stacksize - integer kmp_get_stacksize - external kmp_get_stacksize_s - integer (kind = kmp_size_t_kind) kmp_get_stacksize_s - external kmp_get_blocktime - integer kmp_get_blocktime - external kmp_get_library - integer kmp_get_library - external kmp_set_affinity - integer kmp_set_affinity - external kmp_get_affinity - integer kmp_get_affinity - external kmp_get_affinity_max_proc - integer kmp_get_affinity_max_proc - external kmp_create_affinity_mask - external kmp_destroy_affinity_mask - external kmp_set_affinity_mask_proc - integer kmp_set_affinity_mask_proc - external kmp_unset_affinity_mask_proc - integer kmp_unset_affinity_mask_proc - external kmp_get_affinity_mask_proc - integer kmp_get_affinity_mask_proc - external kmp_malloc - integer (kind = kmp_pointer_kind) kmp_malloc - external kmp_calloc - integer (kind = kmp_pointer_kind) kmp_calloc - external kmp_realloc - integer (kind = kmp_pointer_kind) kmp_realloc - external kmp_free - - external kmp_set_warnings_on - external kmp_set_warnings_off - - diff --git a/openmp/runtime/src/include/40/iomp.h.var b/openmp/runtime/src/include/40/iomp.h.var deleted file mode 100644 index 860c18e0e75..00000000000 --- a/openmp/runtime/src/include/40/iomp.h.var +++ /dev/null @@ -1,106 +0,0 @@ -/* - * include/40/iomp.h.var - */ - - -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.txt for details. -// -//===----------------------------------------------------------------------===// - - -#ifndef __IOMP_H -# define __IOMP_H - -# define KMP_VERSION_MAJOR $KMP_VERSION_MAJOR -# define KMP_VERSION_MINOR $KMP_VERSION_MINOR -# define KMP_VERSION_BUILD $KMP_VERSION_BUILD -# define KMP_BUILD_DATE "$KMP_BUILD_DATE" - -# ifdef __cplusplus - extern "C" { -# endif - -# define kmp_set_stacksize kmpc_set_stacksize -# define kmp_set_stacksize_s kmpc_set_stacksize_s -# define kmp_set_blocktime kmpc_set_blocktime -# define kmp_set_library kmpc_set_library -# define kmp_set_defaults kmpc_set_defaults -# define kmp_set_affinity_mask_proc kmpc_set_affinity_mask_proc -# define kmp_unset_affinity_mask_proc kmpc_unset_affinity_mask_proc -# define kmp_get_affinity_mask_proc kmpc_get_affinity_mask_proc - -# define kmp_malloc kmpc_malloc -# define kmp_calloc kmpc_calloc -# define kmp_realloc kmpc_realloc -# define kmp_free kmpc_free - -# if defined(_WIN32) -# define __KAI_KMPC_CONVENTION __cdecl -# else -# define __KAI_KMPC_CONVENTION -# endif - -# include <stdlib.h> - /* kmp API functions */ - extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void); - extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int); - extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void); - extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t); - extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void); - extern int __KAI_KMPC_CONVENTION kmp_get_library (void); - extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int); - extern void __KAI_KMPC_CONVENTION kmp_set_library (int); - extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void); - extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void); - extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void); - extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *); - - /* affinity API functions */ - typedef void * kmp_affinity_mask_t; - - extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *); - extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *); - extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void); - extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *); - extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *); - extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *); - extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *); - extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *); - - extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t); - extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t); - extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t); - extern void __KAI_KMPC_CONVENTION kmp_free (void *); - - extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void); - extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void); - - /* schedule kind constants */ - typedef enum kmp_cancel_kind_t { - kmp_cancel_parallel = 1, - kmp_cancel_loop = 2, - kmp_cancel_sections = 3, - kmp_cancel_taskgroup = 4 - } kmp_cancel_kind_t; - - extern int __KAI_KMPC_CONVENTION kmp_get_cancellation_status(kmp_cancel_kind_t); - -# undef __KAI_KMPC_CONVENTION - - /* Warning: - The following typedefs are not standard, deprecated and will be removed in a future release. - */ - typedef int omp_int_t; - typedef double omp_wtime_t; - -# ifdef __cplusplus - } -# endif - -#endif /* __IOMP_H */ - diff --git a/openmp/runtime/src/include/40/iomp_lib.h.var b/openmp/runtime/src/include/40/iomp_lib.h.var deleted file mode 100644 index 1804a319798..00000000000 --- a/openmp/runtime/src/include/40/iomp_lib.h.var +++ /dev/null @@ -1,81 +0,0 @@ -! include/40/iomp_lib.h.var - -! -!//===----------------------------------------------------------------------===// -!// -!// The LLVM Compiler Infrastructure -!// -!// This file is dual licensed under the MIT and the University of Illinois Open -!// Source Licenses. See LICENSE.txt for details. -!// -!//===----------------------------------------------------------------------===// -! - -!*** -!*** omp_integer_kind and omp_logical_kind appear to be predefined by gcc and -!*** gfortran (definitions do not appear in the omp.h / omp_lib.h /omp_lib.f). -!*** omp_real_kind is not predefined, however. -!*** - - integer, parameter :: kmp_version_major = $KMP_VERSION_MAJOR - integer, parameter :: kmp_version_minor = $KMP_VERSION_MINOR - integer, parameter :: kmp_version_build = $KMP_VERSION_BUILD - character(*) kmp_build_date - parameter( kmp_build_date = '$KMP_BUILD_DATE' ) - - integer, parameter :: omp_real_kind = 4 - -!*** -!*** kmp_* type extensions -!*** - - integer, parameter :: kmp_pointer_kind = $KMP_INT_PTR_KIND - integer, parameter :: kmp_size_t_kind = $KMP_INT_PTR_KIND - integer, parameter :: kmp_affinity_mask_kind = $KMP_INT_PTR_KIND - -!*** -!*** kmp_* entry points -!*** - - external kmp_set_stacksize - external kmp_set_stacksize_s - external kmp_set_blocktime - external kmp_set_library_serial - external kmp_set_library_turnaround - external kmp_set_library_throughput - external kmp_set_library - external kmp_set_defaults - external kmp_get_stacksize - integer kmp_get_stacksize - external kmp_get_stacksize_s - integer (kind = kmp_size_t_kind) kmp_get_stacksize_s - external kmp_get_blocktime - integer kmp_get_blocktime - external kmp_get_library - integer kmp_get_library - external kmp_set_affinity - integer kmp_set_affinity - external kmp_get_affinity - integer kmp_get_affinity - external kmp_get_affinity_max_proc - integer kmp_get_affinity_max_proc - external kmp_create_affinity_mask - external kmp_destroy_affinity_mask - external kmp_set_affinity_mask_proc - integer kmp_set_affinity_mask_proc - external kmp_unset_affinity_mask_proc - integer kmp_unset_affinity_mask_proc - external kmp_get_affinity_mask_proc - integer kmp_get_affinity_mask_proc - external kmp_malloc - integer (kind = kmp_pointer_kind) kmp_malloc - external kmp_calloc - integer (kind = kmp_pointer_kind) kmp_calloc - external kmp_realloc - integer (kind = kmp_pointer_kind) kmp_realloc - external kmp_free - - external kmp_set_warnings_on - external kmp_set_warnings_off - - diff --git a/openmp/runtime/src/include/41/iomp.h.var b/openmp/runtime/src/include/41/iomp.h.var deleted file mode 100644 index 28ebeca2a53..00000000000 --- a/openmp/runtime/src/include/41/iomp.h.var +++ /dev/null @@ -1,106 +0,0 @@ -/* - * include/41/iomp.h.var - */ - - -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.txt for details. -// -//===----------------------------------------------------------------------===// - - -#ifndef __IOMP_H -# define __IOMP_H - -# define KMP_VERSION_MAJOR $KMP_VERSION_MAJOR -# define KMP_VERSION_MINOR $KMP_VERSION_MINOR -# define KMP_VERSION_BUILD $KMP_VERSION_BUILD -# define KMP_BUILD_DATE "$KMP_BUILD_DATE" - -# ifdef __cplusplus - extern "C" { -# endif - -# define kmp_set_stacksize kmpc_set_stacksize -# define kmp_set_stacksize_s kmpc_set_stacksize_s -# define kmp_set_blocktime kmpc_set_blocktime -# define kmp_set_library kmpc_set_library -# define kmp_set_defaults kmpc_set_defaults -# define kmp_set_affinity_mask_proc kmpc_set_affinity_mask_proc -# define kmp_unset_affinity_mask_proc kmpc_unset_affinity_mask_proc -# define kmp_get_affinity_mask_proc kmpc_get_affinity_mask_proc - -# define kmp_malloc kmpc_malloc -# define kmp_calloc kmpc_calloc -# define kmp_realloc kmpc_realloc -# define kmp_free kmpc_free - -# if defined(_WIN32) -# define __KAI_KMPC_CONVENTION __cdecl -# else -# define __KAI_KMPC_CONVENTION -# endif - -# include <stdlib.h> - /* kmp API functions */ - extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void); - extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int); - extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void); - extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t); - extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void); - extern int __KAI_KMPC_CONVENTION kmp_get_library (void); - extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int); - extern void __KAI_KMPC_CONVENTION kmp_set_library (int); - extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void); - extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void); - extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void); - extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *); - - /* affinity API functions */ - typedef void * kmp_affinity_mask_t; - - extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *); - extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *); - extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void); - extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *); - extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *); - extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *); - extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *); - extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *); - - extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t); - extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t); - extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t); - extern void __KAI_KMPC_CONVENTION kmp_free (void *); - - extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void); - extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void); - - /* schedule kind constants */ - typedef enum kmp_cancel_kind_t { - kmp_cancel_parallel = 1, - kmp_cancel_loop = 2, - kmp_cancel_sections = 3, - kmp_cancel_taskgroup = 4 - } kmp_cancel_kind_t; - - extern int __KAI_KMPC_CONVENTION kmp_get_cancellation_status(kmp_cancel_kind_t); - -# undef __KAI_KMPC_CONVENTION - - /* Warning: - The following typedefs are not standard, deprecated and will be removed in a future release. - */ - typedef int omp_int_t; - typedef double omp_wtime_t; - -# ifdef __cplusplus - } -# endif - -#endif /* __IOMP_H */ - diff --git a/openmp/runtime/src/include/41/iomp_lib.h.var b/openmp/runtime/src/include/41/iomp_lib.h.var deleted file mode 100644 index dc025968435..00000000000 --- a/openmp/runtime/src/include/41/iomp_lib.h.var +++ /dev/null @@ -1,81 +0,0 @@ -! include/41/iomp_lib.h.var - -! -!//===----------------------------------------------------------------------===// -!// -!// The LLVM Compiler Infrastructure -!// -!// This file is dual licensed under the MIT and the University of Illinois Open -!// Source Licenses. See LICENSE.txt for details. -!// -!//===----------------------------------------------------------------------===// -! - -!*** -!*** omp_integer_kind and omp_logical_kind appear to be predefined by gcc and -!*** gfortran (definitions do not appear in the omp.h / omp_lib.h /omp_lib.f). -!*** omp_real_kind is not predefined, however. -!*** - - integer, parameter :: kmp_version_major = $KMP_VERSION_MAJOR - integer, parameter :: kmp_version_minor = $KMP_VERSION_MINOR - integer, parameter :: kmp_version_build = $KMP_VERSION_BUILD - character(*) kmp_build_date - parameter( kmp_build_date = '$KMP_BUILD_DATE' ) - - integer, parameter :: omp_real_kind = 4 - -!*** -!*** kmp_* type extensions -!*** - - integer, parameter :: kmp_pointer_kind = $KMP_INT_PTR_KIND - integer, parameter :: kmp_size_t_kind = $KMP_INT_PTR_KIND - integer, parameter :: kmp_affinity_mask_kind = $KMP_INT_PTR_KIND - -!*** -!*** kmp_* entry points -!*** - - external kmp_set_stacksize - external kmp_set_stacksize_s - external kmp_set_blocktime - external kmp_set_library_serial - external kmp_set_library_turnaround - external kmp_set_library_throughput - external kmp_set_library - external kmp_set_defaults - external kmp_get_stacksize - integer kmp_get_stacksize - external kmp_get_stacksize_s - integer (kind = kmp_size_t_kind) kmp_get_stacksize_s - external kmp_get_blocktime - integer kmp_get_blocktime - external kmp_get_library - integer kmp_get_library - external kmp_set_affinity - integer kmp_set_affinity - external kmp_get_affinity - integer kmp_get_affinity - external kmp_get_affinity_max_proc - integer kmp_get_affinity_max_proc - external kmp_create_affinity_mask - external kmp_destroy_affinity_mask - external kmp_set_affinity_mask_proc - integer kmp_set_affinity_mask_proc - external kmp_unset_affinity_mask_proc - integer kmp_unset_affinity_mask_proc - external kmp_get_affinity_mask_proc - integer kmp_get_affinity_mask_proc - external kmp_malloc - integer (kind = kmp_pointer_kind) kmp_malloc - external kmp_calloc - integer (kind = kmp_pointer_kind) kmp_calloc - external kmp_realloc - integer (kind = kmp_pointer_kind) kmp_realloc - external kmp_free - - external kmp_set_warnings_on - external kmp_set_warnings_off - - diff --git a/openmp/runtime/src/libiomp.rc.var b/openmp/runtime/src/libiomp.rc.var deleted file mode 100644 index c5f81e8b462..00000000000 --- a/openmp/runtime/src/libiomp.rc.var +++ /dev/null @@ -1,70 +0,0 @@ -// libiomp.rc.var - -// -////===----------------------------------------------------------------------===// -//// -//// The LLVM Compiler Infrastructure -//// -//// This file is dual licensed under the MIT and the University of Illinois Open -//// Source Licenses. See LICENSE.txt for details. -//// -////===----------------------------------------------------------------------===// -// - -#include "winres.h" - -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // English (U.S.) resources -#pragma code_page(1252) - -VS_VERSION_INFO VERSIONINFO - // Parts of FILEVERSION and PRODUCTVERSION are 16-bit fields, entire build date yyyymmdd - // does not fit into one version part, so we need to split it into yyyy and mmdd: - FILEVERSION $KMP_VERSION_MAJOR,$KMP_VERSION_MINOR,${{ our $KMP_VERSION_BUILD; int( $KMP_VERSION_BUILD / 10000 ) . "," . ( $KMP_VERSION_BUILD % 10000 ) }} - PRODUCTVERSION $KMP_VERSION_MAJOR,$KMP_VERSION_MINOR,${{ our $KMP_VERSION_BUILD; int( $KMP_VERSION_BUILD / 10000 ) . "," . ( $KMP_VERSION_BUILD % 10000 ) }} - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK - FILEFLAGS 0 - #if $KMP_DIAG || $KMP_DEBUG_INFO - | VS_FF_DEBUG - #endif - #if $KMP_VERSION_BUILD == 0 - | VS_FF_PRIVATEBUILD | VS_FF_PRERELEASE - #endif - FILEOS VOS_NT_WINDOWS32 // Windows* Server* 2003, XP*, 2000, or NT* - FILETYPE VFT_DLL - BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" // U.S. English, Unicode (0x04b0 == 1200) - BEGIN - - // FileDescription and LegalCopyright should be short. - VALUE "FileDescription", "Intel(R) OpenMP* Runtime Library${{ our $MESSAGE_CATALOG; $MESSAGE_CATALOG ? " Message Catalog" : "" }}\0" - // Following values may be relatively long. - VALUE "CompanyName", "Intel Corporation\0" - // VALUE "LegalTrademarks", "\0" // Not used for now. - VALUE "ProductName", "Intel(R) OpenMP* Runtime Library\0" - VALUE "ProductVersion", "$KMP_VERSION_MAJOR.$KMP_VERSION_MINOR\0" - VALUE "FileVersion", "$KMP_VERSION_BUILD\0" - VALUE "InternalName", "$KMP_FILE\0" - VALUE "OriginalFilename", "$KMP_FILE\0" - VALUE "Comments", - "Intel(R) OpenMP* ${{ our ( $MESSAGE_CATALOG, $KMP_TYPE ); $MESSAGE_CATALOG ? "Runtime Library Message Catalog" : "$KMP_TYPE Library" }} " - "version $KMP_VERSION_MAJOR.$KMP_VERSION_MINOR.$KMP_VERSION_BUILD " - "for $KMP_ARCH architecture built on $KMP_BUILD_DATE.\0" - #if $KMP_VERSION_BUILD == 0 - VALUE "PrivateBuild", - "This is a development build for internal testing purposes only. " - "Do not distribute it outside of Intel.\0" - #endif - // VALUE "SpecialBuild", "\0" // Not used for now. - - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", ${{ our ( $MESSAGE_CATALOG, $LANGUAGE ); $MESSAGE_CATALOG ? $LANGUAGE : 1033 }}, 1200 - // 1033 -- U.S. English, 1200 -- Unicode - END - END - -// end of file // diff --git a/openmp/runtime/src/makefile.mk b/openmp/runtime/src/makefile.mk deleted file mode 100644 index 0210102d85e..00000000000 --- a/openmp/runtime/src/makefile.mk +++ /dev/null @@ -1,1565 +0,0 @@ -# makefile.mk # - -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -# Check and normalize LIBOMP_WORK. -# This piece of code is common, but it cannot be moved to common file. -ifeq "$(LIBOMP_WORK)" "" - $(error LIBOMP_WORK environment variable must be set) -endif -ifneq "$(words $(LIBOMP_WORK))" "1" - $(error LIBOMP_WORK must not contain spaces) -endif -override LIBOMP_WORK := $(subst \,/,$(LIBOMP_WORK)) -ifeq "$(filter %/,$(LIBOMP_WORK))" "" - override LIBOMP_WORK := $(LIBOMP_WORK)/ -endif - -# Include definitions common for RTL and DSL. -include $(LIBOMP_WORK)src/defs.mk - -src_dir = $(LIBOMP_WORK)src/ -inc_dir = $(LIBOMP_WORK)src/include/$(OMP_VERSION)/ - -# -------------------------------------------------------------------------------------------------- -# Configuration options. -# -------------------------------------------------------------------------------------------------- - -# Build compiler -BUILD_COMPILER := $(call check_variable,BUILD_COMPILER,icc gcc clang icl icl.exe) -# Distribution type: com (commercial) or oss (open-source) -DISTRIBUTION := $(call check_variable,DISTRIBUTION,com oss) - -ifeq "$(c)" "" - c = $(BUILD_COMPILER) - ifeq "$(os)" "win" - c = icl.exe - endif -endif -ifeq "$(dist)" "" - dist = $(DISTRIBUTION) -endif -ifeq "$(dist)" "" - dist = com -endif - -# Compile all C files as C++ source. -CPLUSPLUS := $(call check_variable,CPLUSPLUS,on) -# Turn on instrumentation for code coverage. -COVERAGE := $(call check_variable,COVERAGE,off on) -# Instruct compiler to emit debug information. -DEBUG_INFO := $(call check_variable,DEBUG_INFO,on off) -# Turn on debug support in library code, assertions and traces. -DIAG := $(call check_variable,DIAG,on off) -LIB_TYPE := $(call check_variable,LIB_TYPE,norm prof stub) -# Type of library: dynamic or static linking. -LINK_TYPE := $(call check_variable,LINK_TYPE,dyna stat) -# Supported OpenMP version, 2.5 or 3.0. -OMP_VERSION := $(call check_variable,OMP_VERSION,41 40 30 25) -# Generate optimized code. -OPTIMIZATION := $(call check_variable,OPTIMIZATION,off on) -# Library version: 4 -- legacy, 5 -- compat. -VERSION := $(call check_variable,VERSION,5 4) -# quad precision floating point -HAVE_QUAD = 1 - -VPATH += $(src_dir) -VPATH += $(src_dir)i18n/ -VPATH += $(inc_dir) -VPATH += $(src_dir)thirdparty/ittnotify/ - - -# Define config. -define curr_config - CPLUSPLUS=$(CPLUSPLUS) - COVERAGE=$(COVERAGE) - DEBUG_INFO=$(DEBUG_INFO) - DIAG=$(DIAG) - LIB_TYPE=$(LIB_TYPE) - LINK_TYPE=$(LINK_TYPE) - OMP_VERSION=$(OMP_VERSION) - OPTIMIZATION=$(OPTIMIZATION) - VERSION=$(VERSION) - CPPFLAGS=$(subst $(space),_,$(CPPFLAGS)) - CFLAGS=$(subst $(space),_,$(CFLAGS)) - CXXFLAGS=$(subst $(space),_,$(CXXFLAGS)) - FFLAGS=$(subst $(space),_,$(FFLAGS)) - LDFLAGS=$(subst $(space),_,$(LDFLAGS)) - OMPT_SUPPORT=$(OMPT_SUPPORT) - OMPT_BLAME=$(OMPT_BLAME) - OMPT_TRACE=$(OMPT_TRACE) -endef -# And check it. -include $(tools_dir)src/common-checks.mk - -# Function to convert LIB_TYPE to printable one. -legal_type = $(if $(filter norm,$(LIB_TYPE)),Performance,$(if $(filter prof,$(LIB_TYPE)),Profiling,Stub)) - -# Check the OS X version (we need it to decide which tool use for objects accumulation) -ifeq "$(os)" "mac" - mac_os_new := $(shell /bin/sh -c 'if [[ `sw_vers -productVersion` > 10.6 ]]; then echo "1"; else echo "0"; fi') -endif - - -# -------------------------------------------------------------------------------------------------- -# Dev tools and general options (like -fpic, -O2 or -g). -# -------------------------------------------------------------------------------------------------- -include $(tools_dir)src/common-tools.mk - -# -------------------------------------------------------------------------------------------------- -# Project-specific tools options. -# -------------------------------------------------------------------------------------------------- - -# --- Assembler options --- - -ifeq "$(os)" "win" - ifeq "$(arch)" "32" - as-flags += -coff - as-flags += -D_M_IA32 - endif - ifeq "$(arch)" "32e" - as-flags += -D_M_AMD64 - endif - ifeq "$(arch)" "64" - endif -endif - -# --- C/C++ options --- - -# Enable _Quad type. -ifneq "$(filter icc icl icl.exe,$(c))" "" - c-flags += -Qoption,cpp,--extended_float_types - cxx-flags += -Qoption,cpp,--extended_float_types -endif - -ifeq "$(c)" "gcc" - ifeq "$(arch)" "32" - c-flags += -m32 -msse - cxx-flags += -m32 -msse - fort-flags += -m32 -msse - ld-flags += -m32 -msse - as-flags += -m32 -msse - endif -endif - -ifeq "$(c)" "clang" - c-flags += -Wno-unused-value -Wno-switch -Wno-deprecated-register - cxx-flags += -Wno-unused-value -Wno-switch -Wno-deprecated-register - ifeq "$(arch)" "32" - c-flags += -m32 -msse - cxx-flags += -m32 -msse - fort-flags += -m32 -msse - ld-flags += -m32 -msse - as-flags += -m32 -msse - endif - HAVE_QUAD = 0 -endif - -ifeq "$(LINK_TYPE)" "dyna" -# debug-info - ifeq "$(os)" "win" - c-flags += -Zi - cxx-flags += -Zi - fort-flags += -Zi - else - ifneq "$(os)" "mac" - c-flags += -g - cxx-flags += -g - fort-flags += -g - ld-flags += -g - endif - endif -endif - -# Enable 80-bit "long double". -# ??? In original makefile, it was enabled for all files on win_32 and win_64, and only for one -# file kmp_atomic.c on win_32e. -ifeq "$(os)" "win" - c-flags += -Qlong_double - cxx-flags += -Qlong_double -endif - -# Enable saving compiler options and version in object files and libraries. -ifeq "$(filter gcc clang,$(c))" "" - ifeq "$(os)" "win" - # Newer MS linker issues warnings if -Qsox is used: - # "warning LNK4224: /COMMENT is no longer supported; ignored" - # so let us comment it out (and delete later). - # ifneq "$(arch)" "32e" - # c-flags += -Qsox - # cxx-flags += -Qsox - # endif - fort-flags += -Qsox - else - # For unknown reason, icc and ifort on mac does not accept this option. - ifneq "$(filter lin,$(os))" "" - c-flags += -sox - cxx-flags += -sox - fort-flags += -sox - endif - endif -endif - -# On Linux and Windows Intel64 we need offload attribute for all Fortran entries -# in order to support OpenMP function calls inside Device constructs -ifeq "$(fort)" "ifort" - ifeq "$(os)_$(arch)" "lin_32e" - # TODO: change to -qoffload... when we stop supporting 14.0 compiler (-offload is deprecated) - fort-flags += -offload-attribute-target=mic - endif - ifeq "$(os)_$(arch)" "win_32e" - fort-flags += /Qoffload-attribute-target:mic - endif -endif - -ifeq "$(arch)" "mic" - c-flags += -mmic - cxx-flags += -mmic - fort-flags += -mmic - ld-flags += -mmic - as-flags += -mmic - cpp-flags += -mmic -endif - -# Exception handling. -ifeq "$(os)" "win" - # ??? Enable exception handling? - ifeq "$(LINK_TYPE)" "dyna" - c-flags += -EHsc - cxx-flags += -EHsc - endif -else - # Disable exception handling. - c-flags += -fno-exceptions - cxx-flags += -fno-exceptions -endif - -# Disable use of EBP as general purpose register. -ifeq "$(os)" "win" - ifeq "$(arch)" "32" - c-flags += -Oy- - cxx-flags += -Oy- - endif -endif - -ifeq "$(os)" "lin" - ifneq "$(arch)" "mic" - c-flags += -Wsign-compare - cxx-flags += -Wsign-compare - ld-flags += -Wsign-compare - ifeq "$(filter gcc clang,$(c))" "" - c-flags += -Werror - cxx-flags += -Werror - ld-flags += -Werror - endif -endif -endif -ifeq "$(os)" "win" - c-flags += -WX - cxx-flags += -WX - ld-flags += -WX:NO -endif - -ifeq "$(arch)" "mic" - # With "-ftls-model=initial-exec" the compiler generates faster code for static TLS - # accesses, it generates slower calls to glibc otherwise. We don't use this - # feature on Linux because it prevents dynamic loading (use of dlopen) of the library. - # Reliable dynamic loading is more important than slightly faster access to TLS. - # On Intel(R) Xeon Phi(TM) coprocessor we haven't encountered dynamic loading problem yet, so use faster - # access to static TLS. - c-flags += -ftls-model=initial-exec - cxx-flags += -ftls-model=initial-exec - # disable streaming stores in order to work on A0 Si - c-flags += -opt-streaming-stores never - cxx-flags += -opt-streaming-stores never -endif - -# Select C runtime. -ifeq "$(os)" "win" - # Regardless of following -Zl option, we should specify -MT or -MTd, otherwise test-touch - # wil fails due to unresolved reference "_errno". - ifeq "$(OPTIMIZATION)" "on" - c-flags += -MT - cxx-flags += -MT - else - c-flags += -MTd - cxx-flags += -MTd - endif - ifeq "$(LINK_TYPE)" "stat" - # Do not emit C runtime library to object file. It will allows link OpenMP RTL with either static - # or dynamic C runtime. Windows* OS specific, applicable only to static RTL. - c-flags += -Zl - cxx-flags += -Zl - endif -endif - -ifeq "$(os)" "win" - c-flags += -W3 - cxx-flags += -W3 - # Disable warning: "... declared but never referenced" - # Disable remark #5082: Directive ignored - Syntax error, found IDENTIFIER 'LRB'... - fort-flags += -Qdiag-disable:177,5082 - c-flags += -Qdiag-disable:177 - cxx-flags += -Qdiag-disable:177 -endif - -ifeq "$(CPLUSPLUS)" "on" - ifeq "$(os)" "win" - c-flags += -TP - else ifeq "$(arch)" "ppc64" - # c++11 on ppc64 linux removes definition of preproc. macros, needed in .hs - c-flags += -x c++ -std=gnu++11 - else - ifneq "$(filter gcc clang,$(c))" "" - c-flags += -x c++ -std=c++11 - else - c-flags += -Kc++ - endif - endif -endif - -# --- Linker options --- - -ifeq "$(os)" "lin" - ifneq "$(arch)" "mic" - ifneq "$(LIB_TYPE)" "stub" - ifeq "$(ld)" "ld" - # Warn about non-PIC code presence - ld-flags += --warn-shared-textrel - ld-flags += -fini=__kmp_internal_end_fini - ld-flags += -lpthread - else # $(c) or $(cxx) - ld-flags += -Wl,--warn-shared-textrel - ld-flags += -Wl,-fini=__kmp_internal_end_fini - ld-flags += -pthread - endif - endif - ifeq "$(ld)" "$(c)" - ld-flags += -fPIC - ifeq "$(DEBUG_INFO)" "on" - ld-flags += -g - endif - ifeq "$(OPTIMIZATION)" "off" - ld-flags += -O0 - endif - ld-flags += -Wl,--version-script=$(src_dir)exports_so.txt - else - ld-flags += --version-script=$(src_dir)exports_so.txt - endif - ifeq "$(ld)" "$(c)" - # to remove dependency on libimf, libsvml, libintlc: - ifeq "$(c)" "icc" - ld-flags-dll += -static-intel - endif - ld-flags-dll += -Wl,--as-needed - # to remove dependency on libgcc_s: - ifeq "$(c)" "gcc" - ld-flags-dll += -static-libgcc - # omp_os is non-empty only in the open-source code - ifneq "$(omp_os)" "freebsd" - ld-flags-extra += -Wl,-ldl - endif - endif - ifeq "$(c)" "clang" - ifneq "$(omp_os)" "freebsd" - ld-flags-extra += -Wl,-ldl - endif - endif - ifeq "$(arch)" "32" - ifeq "$(filter gcc clang,$(c))" "" - # to workaround CQ215229 link libirc_pic manually - ld-flags-extra += -lirc_pic - endif - endif - ifeq "$(filter 32 32e 64 ppc64 ppc64le,$(arch))" "" - ld-flags-extra += $(shell pkg-config --libs libffi) - endif - else - ifeq "$(arch)" "32e" - # ??? - ld-flags += -Bstatic -L/usr/lib64 -lc_nonshared -Bdynamic - endif - endif - else # Below are Intel(R) Many Integrated Core Architecture linker flags - ifeq "$(ld)" "ld" - ifneq "$(LIB_TYPE)" "stub" - ld-flags += -lthr - ld-flags += -fini=__kmp_internal_end_atexit - # Warn about non-PIC code presence - ld-flags += --warn-shared-textrel - endif - ld-flags += --version-script=$(src_dir)exports_so.txt - endif - ifeq "$(ld)" "$(c)" - ld-flags += -Wl,--warn-shared-textrel - ld-flags += -Wl,--version-script=$(src_dir)exports_so.txt - ld-flags += -static-intel - # Don't link libcilk*. - ld-flags += -no-intel-extensions - # Discard unneeded dependencies. - ld-flags += -Wl,--as-needed -# ld-flags += -nodefaultlibs - # To check which libraries the compiler links comment above line and uncomment below line -# ld-flags += -\# - # link libraries in the order the icc compiler uses (obtained using "icc -shared -#" command line) - # Compiler 20101017 uses "-lintlc -lthr -lc -lintlc -lirc_s" sequence, we follow it: -# ld-flags += -lintlc - ifneq "$(LIB_TYPE)" "stub" - ld-flags += -pthread - ld-flags += -ldl - endif - # include the c++ library for stats-gathering code - ifeq "$(stats)" "on" - ld-flags-extra += -Wl,-lstdc++ - endif - endif -endif -endif - - -ifeq "$(os)" "mac" - ifeq "$(ld)" "icc" - ld-flags += -no-intel-extensions - endif - ld-flags += -single_module - ld-flags += -current_version $(VERSION).0 -compatibility_version $(VERSION).0 -endif - -ifeq "$(os)" "win" - ld-flags += -incremental:no - ld-flags += -version:$(VERSION).0 -endif - -# -------------------------------------------------------------------------------------------------- -# Project-specific preprocessor definitions. -# -------------------------------------------------------------------------------------------------- - -cpp-flags += -D KMP_ARCH_STR="\"$(call legal_arch,$(arch))\"" - -ifeq "$(os)" "win" - cpp-flags += -D _WINDOWS -D _WINNT -D _WIN32_WINNT=0x0501 - # 0x0501 means Windows* XP* OS or Windows* Server 2003* OS or later. - # We need this for GetModuleHanleEx function. - ifeq "$(LINK_TYPE)" "dyna" - cpp-flags += -D _USRDLL - endif -else # lin, mic or mac - cpp-flags += -D _GNU_SOURCE - cpp-flags += -D _REENTRANT -endif - -# TODO: DIAG leads to DEBUG. Confusing a bit. Raname KMP_DEBUG to KMP_DIAG? -ifeq "$(DIAG)" "on" - cpp-flags += -D KMP_DEBUG -endif -ifeq "$(COVERAGE)" "on" - cpp-flags += -D COVER -endif -# Assertions in OMP RTL code are controlled by two macros: KMP_DEBUG enables or disables assertions -# iff KMP_USE_ASSERT is defined. If KMP_USE_ASSERT is not defined, assertions disabled regardless of -# KMP_DEBUG. It was implemented for code coverage -- to have debug build with no assertion, but it -# does not have much effect. TODO: Remove macro. -ifeq "$(COVERAGE)" "off" - cpp-flags += -D KMP_USE_ASSERT -endif - -cpp-flags += -D BUILD_I8 -ifneq "$(os)" "win" - cpp-flags += -D BUILD_TV -endif -cpp-flags += -D KMP_LIBRARY_FILE=\"$(lib_file)\" -cpp-flags += -D KMP_VERSION_MAJOR=$(VERSION) - -# Customize ppc64 and aarch64 cache line size to 128, use 64 otherwise -# Almost all data structures (kmp.h) are aligned to a cache line to reduce false sharing, thus -# increasing performance. For heavily accessed data structures (e.g., kmp_base_info), there are -# members of the data structure that are grouped together according to their memory access -# pattern. For example, readonly data is put on cache lines together. Then, on separate cachelines, -# private data used by the working thread is put on its own cache lines. etc. -ifneq "$(filter aarch64 ppc64 ppc64le,$(arch))" "" - cpp-flags += -D CACHE_LINE=128 -else - cpp-flags += -D CACHE_LINE=64 -endif - -cpp-flags += -D KMP_ADJUST_BLOCKTIME=1 -cpp-flags += -D BUILD_PARALLEL_ORDERED -cpp-flags += -D KMP_ASM_INTRINS -cpp-flags += -D KMP_USE_INTERNODE_ALIGNMENT=0 -# Linux and MIC compile with version symbols -# ppc64 and ppc64le architectures don't compile with version symbols -ifneq "$(filter lin,$(os))" "" -ifeq "$(filter ppc64 ppc64le,$(arch))" "" - cpp-flags += -D KMP_USE_VERSION_SYMBOLS -endif -endif -ifneq "$(arch)" "mic" - cpp-flags += -D USE_LOAD_BALANCE -endif -ifneq "$(os)" "win" - cpp-flags += -D USE_CBLKDATA - # ??? Windows* OS: USE_CBLKDATA defined in kmp.h. -endif -ifeq "$(os)" "win" - cpp-flags += -D KMP_WIN_CDECL -endif -ifeq "$(LINK_TYPE)" "dyna" - cpp-flags += -D KMP_DYNAMIC_LIB -endif -ifeq "$(LIB_TYPE)" "stub" - cpp-flags += -D KMP_STUB -endif -ifeq "$(VERSION)" "4" -else # 5 - ifeq "$(os)" "win" - else - cpp-flags += -D KMP_GOMP_COMPAT - endif -endif -cpp-flags += -D KMP_NESTED_HOT_TEAMS -ifneq "$(filter 32 32e mic,$(arch))" "" -cpp-flags += -D KMP_USE_ADAPTIVE_LOCKS=1 -D KMP_DEBUG_ADAPTIVE_LOCKS=0 -endif - -# is the std c++ library needed? (for stats-gathering, it is) -std_cpp_lib=0 -ifneq "$(filter lin,$(os))" "" - ifeq "$(stats)" "on" - cpp-flags += -D KMP_STATS_ENABLED=1 - std_cpp_lib=1 - else - cpp-flags += -D KMP_STATS_ENABLED=0 - endif -else # no mac or windows support for stats-gathering - ifeq "$(stats)" "on" - $(error Statistics-gathering functionality not available on $(os) platform) - endif - cpp-flags += -D KMP_STATS_ENABLED=0 -endif - -# define compatibility with different OpenMP versions -have_omp_50=0 -have_omp_41=0 -have_omp_40=0 -ifeq "$(OMP_VERSION)" "50" - have_omp_50=1 - have_omp_41=1 - have_omp_40=1 -endif -ifeq "$(OMP_VERSION)" "41" - have_omp_50=0 - have_omp_41=1 - have_omp_40=1 -endif -ifeq "$(OMP_VERSION)" "40" - have_omp_50=0 - have_omp_41=0 - have_omp_40=1 -endif -ifeq "$(OMP_VERSION)" "30" - have_omp_50=0 - have_omp_41=0 - have_omp_40=0 -endif -cpp-flags += -D OMP_50_ENABLED=$(have_omp_50) -D OMP_41_ENABLED=$(have_omp_41) -D OMP_40_ENABLED=$(have_omp_40) - -# Using ittnotify is enabled by default. -USE_ITT_NOTIFY = 1 -ifeq "$(os)-$(arch)" "win-64" - USE_ITT_NOTIFY = 0 -endif -ifeq "$(LINK_TYPE)" "stat" - USE_ITT_NOTIFY = 0 -endif -cpp-flags += -D USE_ITT_NOTIFY=$(USE_ITT_NOTIFY) -ifeq "$(USE_ITT_NOTIFY)" "0" - # Disable all ittnotify calls. - cpp-flags += -D INTEL_NO_ITTNOTIFY_API -else - ifeq "$(os)" "win" - ittnotify_static$(obj) : cpp-flags += -D UNICODE - endif -endif -# Specify prefix to be used for external symbols. Prefix is required even if ITT Nofity turned off -# because we have some functions with __itt_ prefix (__itt_error_handler) and want prefix to be -# changed to __kmp_itt_. -cpp-flags += -D INTEL_ITTNOTIFY_PREFIX=__kmp_itt_ - - -# Linux* OS: __declspec(thread) TLS is still buggy on static builds. -# Windows* OS: This define causes problems with LoadLibrary + declspec(thread) on Windows* OS. See CQ50564, -# tests kmp_load_library_lib*.c, and the following MSDN reference: -# http://support.microsoft.com/kb/118816 -ifneq "$(filter lin ,$(os))" "" - ifeq "$(LINK_TYPE)" "dyna" - cpp-flags += -D KMP_TDATA_GTID - else - # AC: allow __thread in static build for Intel(R) 64, looks like it is - # working there. It is broken on IA-32 architecture for RHEL4 and SLES9. - ifeq "$(arch)" "32e" - cpp-flags += -D KMP_TDATA_GTID - endif - endif -endif - -# Defining KMP_BUILD_DATE for all files leads to warning "incompatible redefinition", because the -# same macro is also defined in omp.h. To avoid conflict, let us define macro with different name, -# _KMP_BUILD_TIME. -kmp_version$(obj) : cpp-flags += -D _KMP_BUILD_TIME="\"$(date)\"" - -# --- Macros for generate-def.pl --- - -gd-flags += -D arch_$(arch) -gd-flags += -D $(LIB_TYPE) -ifeq "$(HAVE_QUAD)" "1" - gd-flags += -D HAVE_QUAD -endif -ifeq "$(OMP_VERSION)" "41" - gd-flags += -D OMP_41 -D OMP_40 -D OMP_30 -else - ifeq "$(OMP_VERSION)" "40" - gd-flags += -D OMP_40 -D OMP_30 - else - ifeq "$(OMP_VERSION)" "30" - gd-flags += -D OMP_30 - endif - endif -endif -ifneq "$(VERSION)" "4" - gd-flags += -D msvc_compat -endif -ifeq "$(DIAG)" "on" - gd-flags += -D KMP_DEBUG -endif - -# --- Macro for expand-vars.pl --- - -# $Revision and $Date often occur in file header, so define these variables to satisfy expand-vars.pl. -ev-flags += -D Revision="\$$Revision" -D Date="\$$Date" - -# Various variables. -ev-flags += -D KMP_TYPE="$(call legal_type,$(LIB_TYPE))" -D KMP_ARCH="$(call legal_arch,$(arch))" -ev-flags += -D KMP_VERSION_MAJOR=$(VERSION) -D KMP_VERSION_MINOR=0 -D KMP_VERSION_BUILD=$(build) -ev-flags += -D KMP_BUILD_DATE="$(date)" -ev-flags += -D KMP_DIAG=$(if $(filter on,$(DIAG)),1,0) -ev-flags += -D KMP_DEBUG_INFO=$(if $(filter on,$(DEBUG_INFO)),1,0) -ifeq "$(OMP_VERSION)" "40" - ev-flags += -D OMP_VERSION=201307 -else - ifeq "$(OMP_VERSION)" "30" - ev-flags += -D OMP_VERSION=201107 - else - ev-flags += -D OMP_VERSION=200505 - endif -endif - -# -- Options specified in command line --- - -cpp-flags += $(CPPFLAGS) -c-flags += $(CFLAGS) -cxx-flags += $(CXXFLAGS) -fort-flags += $(FFLAGS) -ld-flags += $(LDFLAGS) - -# -------------------------------------------------------------------------------------------------- -# Files. -# -------------------------------------------------------------------------------------------------- -ifeq "$(OMPT_SUPPORT)" "on" - ompt_items = ompt-general - cpp-flags += -D OMPT_SUPPORT=1 - - ifeq "$(OMPT_BLAME)" "on" - cpp-flags += -D OMPT_BLAME=1 - endif - - ifeq "$(OMPT_TRACE)" "on" - cpp-flags += -D OMPT_TRACE=1 - endif -endif - -# Library files. These files participate in all kinds of library. -lib_c_items := \ - kmp_ftn_cdecl \ - kmp_ftn_extra \ - kmp_version \ - $(ompt_items) \ - $(empty) -lib_cpp_items := -lib_asm_items := - -# Files to be linked into import library. -imp_c_items := - -do_test_touch_mt := 1 - -ifeq "$(LIB_TYPE)" "stub" - lib_c_items += kmp_stub -else # norm or prof - lib_c_items += \ - kmp_alloc \ - kmp_atomic \ - kmp_csupport \ - kmp_debug \ - kmp_debugger \ - kmp_itt \ - $(empty) - ifeq "$(USE_ITT_NOTIFY)" "1" - lib_c_items += ittnotify_static - endif - - - lib_cpp_items += \ - kmp_environment \ - kmp_error \ - kmp_global \ - kmp_i18n \ - kmp_io \ - kmp_runtime \ - kmp_wait_release \ - kmp_barrier \ - kmp_settings \ - kmp_str \ - kmp_tasking \ - kmp_taskq \ - kmp_threadprivate \ - kmp_utility \ - kmp_affinity \ - kmp_dispatch \ - kmp_lock \ - kmp_sched \ - $(empty) - -ifeq ($(OMP_VERSION),$(filter $(OMP_VERSION),40 41)) - lib_cpp_items += kmp_taskdeps - lib_cpp_items += kmp_cancel -endif -ifeq "$(stats)" "on" - lib_cpp_items += kmp_stats - lib_cpp_items += kmp_stats_timing -endif - - # OS-specific files. - ifeq "$(os)" "win" - lib_c_items += z_Windows_NT_util - # Arch-specific files. - lib_c_items += z_Windows_NT-586_util - lib_asm_items += z_Windows_NT-586_asm - ifeq "$(LINK_TYPE)" "dyna" - imp_c_items += kmp_import - # for win_32/win_32e dynamic libguide40.dll, - # build the shim lib instead - ifeq "$(VERSION)" "4" - ifneq "$(arch)" "64" - ifeq "$(LIB_TYPE)" "norm" - lib_c_items = kmp_shim - lib_cpp_items = - lib_asm_items = - gd-flags += -D shim - # for some reason, test-touch-md is able to work with - # the build compiler's version of libompmd.dll, but - # test-touch-mt can't load it. - do_test_touch_mt := 0 - endif - endif - endif - endif - else # lin, mic or mac - lib_c_items += z_Linux_util - # GCC Compatibility files - ifeq "$(VERSION)" "4" - else # 5 - lib_c_items += kmp_gsupport - endif - lib_asm_items += z_Linux_asm - endif -endif - -lib_obj_files := $(sort $(addsuffix $(obj),$(lib_c_items) $(lib_cpp_items) $(lib_asm_items))) -imp_obj_files := $(sort $(addsuffix $(obj),$(imp_c_items) $(imp_cpp_items) $(imp_asm_items))) -dep_files := $(sort $(addsuffix .d,$(lib_c_items) $(lib_cpp_items) $(imp_c_items) $(imp_cpp_items))) -i_files := $(sort $(addsuffix .i,$(lib_c_items) $(lib_cpp_items) $(imp_c_items) $(imp_cpp_items))) - - -# --- Construct library file name --- - -ifeq "$(VERSION)" "4" - ifeq "$(LIB_TYPE)" "stub" - _lib_item = libompstub - else # norm or prof - _lib_item = libguide - endif - ifeq "$(os)-$(LINK_TYPE)" "win-dyna" - _lib_item += 40 - endif - ifeq "$(LIB_TYPE)" "prof" - _lib_item += _stats - endif -else - _lib_item = libomp - ifeq "$(LIB_TYPE)" "prof" - _lib_item += prof - endif - ifeq "$(LIB_TYPE)" "stub" - _lib_item += stubs - endif - ifeq "$(os)" "win" - ifeq "$(LINK_TYPE)" "dyna" - _lib_item += md - else - _lib_item += mt - endif - endif -endif -# _lib_item is a list of space separated name parts. Remove spaces to form final name. -lib_item = $(subst $(space),,$(_lib_item)) -ifeq "$(LINK_TYPE)" "dyna" - lib_ext = $(dll) -else - lib_ext = $(lib) -endif -lib_file = $(lib_item)$(lib_ext) -ifeq "$(os)-$(LINK_TYPE)" "win-dyna" - imp_file = $(lib_item)$(lib) - def_file = $(lib_item).def - res_file = $(lib_item).res - # PDB file should be generated if: ( DEBIG_INFO is on ) OR ( we are building 32-bit normal - # library AND version is 5 ). - ifneq "$(filter on,$(DEBUG_INFO))$(filter norm-5,$(LIB_TYPE)-$(VERSION))" "" - pdb_file = $(lib_item).pdb - endif -endif -ifneq "$(filter lin,$(os))" "" - ifeq "$(LINK_TYPE)" "dyna" - ifneq "$(DEBUG_INFO)" "on" - dbg_file = $(lib_item).dbg - endif - else - dbg_strip = "on" - endif -endif - -# --- Output files --- - -out_lib_files = $(addprefix $(out_lib_dir),$(lib_file) $(imp_file) $(pdb_file) $(dbg_file)) -out_mod_files = \ - $(addprefix $(out_ptf_dir)include/,omp_lib.mod omp_lib_kinds.mod) -out_cmn_files = \ - $(addprefix $(out_cmn_dir)include/,omp.h omp_lib.h omp_lib.f omp_lib.f90) -ifeq "$(OMPT_SUPPORT)" "on" - out_cmn_files += $(addprefix $(out_cmn_dir)include/,ompt.h) -endif - -ifneq "$(out_lib_fat_dir)" "" - out_lib_fat_files = $(addprefix $(out_lib_fat_dir),$(lib_file) $(imp_file)) -endif - -# --- Special dependencies --- - -# We have to encode dependencies on omp.h manually, because automatic dependency generation -# by compiler produces depedency on omp.h file located in compiler include directory. -kmp_csupport$(obj) : omp.h -kmp_stub$(obj) : omp.h - -# -------------------------------------------------------------------------------------------------- -# External libraries to link in. -# -------------------------------------------------------------------------------------------------- - -# We (actually, our customers) do no want OpenMP RTL depends on external libraries, so we have to -# pick up some object files from libirc library (Intel compiler generate code with calls to libirc) -# and link them into OMP RTL. -# libipgo is required only for collecting code coverage data, but is is convenient to link in into -# OMP RTL as well, not to depend on extra libs and paths. - -# libirc does matter only if Intel compiler is used. -ifneq "$(filter icc icl icl.exe,$(c))" "" - - ifneq "$(ICC_LIB_DIR)" "" - icc_lib_dir := $(ICC_LIB_DIR) - else - # - # Let us find path to Intel libraries first. (don't use tabs in these lines!) - # - icc_path := $(shell which $(c)) - $(call debug,icc_path) - ifeq "$(words $(icc_path))" "0" - $(error Path to "$(c)" not found, reported path: $(icc_path)) - endif - ifneq "$(words $(icc_path))" "1" - $(error Path to "$(c)" contains spaces: "$(icc_path)") - endif - ifeq "$(os)" "win" # Windows* OS specific. - # `which' can return path with backslashes. Convert them. - icc_path := $(subst \,/,$(icc_path)) - # icc's "bin/" directory may be named as "Bin/" or even "BIN/". Convert it to lower case. - icc_path := $(subst B,b,$(icc_path)) - icc_path := $(subst I,i,$(icc_path)) - icc_path := $(subst N,n,$(icc_path)) - $(call debug,icc_path) - endif - # icc 10.x directory layout: - # bin/ - # lib/ - # icc 11.x directory layout: - # bin/{ia32,intel64}/ - # lib/{ia32,intel64}/ - # icc 12.x directory layout: - # bin/{ia32,intel64}/ - # compiler/lib/{ia32,intel64}/ - # Note: On OS X* fat libraries reside in lib/ directory. On other systems libraries are in - # lib/<arch>/. - icc_path_up1 := $(dir $(icc_path)) - icc_path_up2 := $(dir $(patsubst %/,%,$(icc_path_up1))) - $(call debug,icc_path_up1) - $(call debug,icc_path_up2) - ifneq "$(filter %/bin/,$(icc_path_up1))" "" - # Look like 10.x compiler. - icc_lib_dir := $(patsubst %/bin/,%/lib/,$(icc_path_up1)) - else - ifneq "$(filter %/bin/,$(icc_path_up2))" "" - # It looks like 11.x or later compiler. - ifeq "$(os)" "mac" - icc_lib12 := $(patsubst %/bin/,%/compiler/lib/,$(icc_path_up2)) - ifneq "$(wildcard $(icc_lib12)libirc*$(lib))" "" - # 12.x - icc_lib_dir := $(icc_lib12) - else - # 11.x - icc_lib_dir := $(patsubst %/bin/,%/lib/,$(icc_path_up2)) - endif - else - icc_lib12 := $(patsubst %/bin/,%/compiler/lib/,$(icc_path_up2))$(notdir $(patsubst %/,%,$(icc_path_up1)))/ - ifneq "$(wildcard $(icc_lib12)libirc*$(lib))" "" - # 12.x - icc_lib_dir := $(icc_lib12) - else - # 11.x - icc_lib_dir := $(patsubst %/bin/,%/lib/,$(icc_path_up2))$(notdir $(patsubst %/,%,$(icc_path_up1)))/ - endif - endif - endif - endif - $(call debug,icc_lib_dir) - ifeq "$(icc_lib_dir)" "" - $(error Path to $(c) lib/ dir not found) - endif - endif - - # - # Then select proper libraries. - # - ifeq "$(os)" "win" - libirc = $(icc_lib_dir)\libircmt$(lib) - libipgo = $(icc_lib_dir)\libipgo$(lib) - else # lin, mic or mac - ifeq "$(LINK_TYPE)" "dyna" - # In case of dynamic linking, prefer libi*_pic.a libraries, they contains - # position-independent code. - libirc = $(icc_lib_dir)libirc_pic$(lib) - libipgo = $(icc_lib_dir)libipgo_pic$(lib) - # If libi*_pic.a is not found (it is missed in older compilers), use libi*.a. - ifeq "$(wildcard $(libirc))" "" - libirc = $(icc_lib_dir)libirc$(lib) - endif - ifeq "$(wildcard $(libipgo))" "" - libipgo = $(icc_lib_dir)libipgo$(lib) - endif - else - libirc = $(icc_lib_dir)libirc$(lib) - libipgo = $(icc_lib_dir)libipgo$(lib) - endif - endif - - # Ok, now let us decide when linked - # Linux* OS: - # We link in libraries to static library only. - ifeq "$(os)-$(LINK_TYPE)" "lin-stat" - ifneq "$(arch)" "mic" - linked_in_libs += libirc - endif - endif - # OS X*: - # The trick is not required in case of dynamic library, but on Intel(R) 64 architecture we have a - # problem: libirc.a is a fat, so linker (libtool) produces fat libguide.dylib... :-( (Only - # functions from libirc are presented for both architectures, libguide functions are for Intel(R) 64 - # only.) To avoid this undesired effect, libirc trick is enabled for both static and dynamic - # builds. Probably we can instruct libtool to produce "thin" (not fat) library by using - # -arch_only option... - ifeq "$(os)" "mac" - linked_in_libs += libirc - endif - # Windows* OS: - # The trick is required only in case of static OMP RTL. In case of dynamic OMP RTL linker does - # the job. - ifeq "$(os)-$(LINK_TYPE)" "win-stat" - linked_in_libs += libirc - endif - - ifeq "$(COVERAGE)" "on" - linked_in_libs += libipgo - endif - -endif - -# -------------------------------------------------------------------------------------------------- -# Main targets. -# -------------------------------------------------------------------------------------------------- - -all : lib inc mod -lib : tests $(out_lib_files) libomp_aliases -mod : $(out_mod_files) -clean : - $(rm) $(out_lib_files) $(out_lib_fat_files) - $(rm) $(out_mod_files) - -# -------------------------------------------------------------------------------------------------- -# Building library. -# -------------------------------------------------------------------------------------------------- - -$(lib_file) : $(if $(dbg_file),stripped,unstripped)/$(lib_file) - $(target) - $(cp) $< $@ - -ifneq "$(dbg_file)" "" - $(dbg_file) : unstripped/$(dbg_file) - $(target) - $(cp) $< $@ -endif - -ifneq "$(filter lin,$(os))" "" - lib_file_deps = $(if $(linked_in_libs),required/.objs,$(lib_obj_files)) -endif -ifeq "$(os)" "mac" - lib_file_deps = omp$(obj) -endif -ifeq "$(os)" "win" - lib_file_deps = $(if $(linked_in_libs),wiped/.objs,$(lib_obj_files)) -endif - -# obj_dep_files -- object files, explicitly specified in dependency list. Other files (non-object) -# are filtered out. -obj_deps_files = $(filter %$(obj),$^) -# obj_deps_flags -- object files corresponding to flags, specified in dependency list. Flag is a -# special file like "required/.objs". Flag file is replaced with a list of all object files in flag -# directory, for example, "required/*.o" -obj_deps_flags = $(addsuffix *$(obj),$(dir $(filter %/.objs,$^))) -# obj_deps_all -- list of all object files specified in dependency list, either explicit or found -# in flagged directories. -obj_deps_all = $(obj_deps_files) $(obj_deps_flags) - -unstripped/$(lib_file).lst : $(lib_file_deps) unstripped/.dir .rebuild - $(target) - echo $(obj_deps_all) > $@ - -ifeq "$(os)-$(LINK_TYPE)" "lin-dyna" - $(lib_file) : exports_so.txt -endif - -# Copy object files, wiping out references to libirc library. Object files (ours and extracted -# from libirc.lib) have "-defaultlib:libirc.lib" linker directive, so linker will require libirc.lib -# regardless of absence of real dependency. Actually, this rule is required only on Windows* OS, but -# there is no Windows* OS-specific commands, so I omit conditions to keep code shorter and be able test -# the rule on Linux* OS. -# Note: If we are not going to pick up objects from libirc, there is no point in wiping out -# libirc references. -# Addition: Wipe also references to C++ runtime (libcpmt.lib) for the same reason: sometimes C++ -# runtime routines are not actually used, but compiler puts "-defaultlib:libcpmt.lib" directive to -# object file. Wipe it out, if we have real dependency on C++ runtime, test-touch will fail. -wiped/.objs : required/.objs \ - $(tools_dir)wipe-string.pl wiped/.dir .rebuild - $(target) - $(rm) $(dir $@)*$(obj) - ifeq "$(os)" "win" - $(perl) $(tools_dir)wipe-string.pl --quiet \ - --wipe-regexp="(-|/)(defaultlib|DEFAULTLIB):\"(libir|libc|LIBC|OLDN|libmm|libde|svml).*?\"" \ - --target-directory=$(dir $@) $(obj_deps_all) - else - $(perl) $(tools_dir)wipe-string.pl --quiet \ - --wipe-regexp="(-|/)(defaultlib|DEFAULTLIB):\"(libir|libc|LIBC|OLDN).*?\"" \ - --target-directory=$(dir $@) $(obj_deps_all) - endif - $(touch) $@ - -# required-objects.pl uses "objcopy" utility to rename symbols in object files. On Linux* OS this is a -# standard utility (from binutils package). On Windows* OS we provides homebrew implementation (very -# limited, but enough for our purposes). -ifeq "$(os)" "win" - objcopy = objcopy$(exe) -endif - -# required/ is a directory containing OMP RTL object files and really required files from external -# libraries. required/.obj is a flag. If this file present, it means all required objects already -# in place. Note, required-objects.pl copies files to specified directory. It is necessary, because -# object files are edited during copying -- symbols defined in external object files are renamed. -required/.objs : $(lib_obj_files) $(addsuffix /.objs,$(linked_in_libs)) \ - $(tools_dir)required-objects.pl $(objcopy) required/.dir .rebuild - $(target) - $(rm) $(dir $@)*$(obj) - $(perl) $(tools_dir)required-objects.pl --quiet $(oa-opts) --prefix=__kmp_external_ \ - --base $(obj_deps_files) --extra $(obj_deps_flags) --copy-all=$(dir $@) - $(touch) $@ - -# Extracting object files from libirc. File "libirc/.obj" is a flag. If the file present, make -# thinks files are extracted. -ifneq "$(libirc)" "" - libirc/.objs : $(libirc) \ - $(tools_dir)extract-objects.pl libirc/.dir .rebuild - $(target) - $(rm) $(dir $@)*$(obj) - $(perl) $(tools_dir)extract-objects.pl --quiet $(oa-opts) --output=$(dir $@) $< - $(touch) $@ -endif - -# Extracting object files from libipgo. File "/libipgo/.obj" is a flag. If the file present, make -# thinks objects are extracted. -ifneq "$(libipgo)" "" - libipgo/.objs : $(libipgo) \ - $(tools_dir)extract-objects.pl libipgo/.dir .rebuild - $(target) - $(rm) $(dir $@)*$(obj) - $(perl) $(tools_dir)extract-objects.pl --quiet $(oa-opts) --output=$(dir $@) $< - $(touch) $@ -endif - - -stripped/$(lib_file) : unstripped/$(lib_file) $(dbg_file) stripped/.dir .rebuild - $(target) - ifeq "$(arch)" "mic" - x86_64-k1om-linux-objcopy --strip-debug $< $@.tmp - x86_64-k1om-linux-objcopy --add-gnu-debuglink=$(dbg_file) $@.tmp $@ - else - objcopy --strip-debug $< $@.tmp - objcopy --add-gnu-debuglink=$(dbg_file) $@.tmp $@ - endif - -ifeq "$(os)" "mac" - - # These targets are under condition because of some OS X*-specific ld and nm options. For - # example, GNU nm does not accept -j, GNU ld does not know -filelist. - - # omp.o is a big object file including all the OMP RTL object files and object files from - # external libraries (like libirc). It is partially linked, references to external symbols - # (e. g. references to libirc) already resolved, symbols defined in external libraries are - # hidden by using -unexported-symbol-list and -non_global_symbols_strip_list linker options - # (both options are required). - # AC: 2012-04-12: after MAC machines upgrade compiler fails to create object, so use linker instead -ifeq "$(mac_os_new)" "1" - omp$(obj) : $(lib_obj_files) external-symbols.lst external-objects.lst .rebuild - $(target) - ld -r -unexported_symbols_list external-symbols.lst \ - -non_global_symbols_strip_list external-symbols.lst \ - -filelist external-objects.lst \ - -o $@ $(obj_deps_files) -else - omp$(obj) : $(lib_obj_files) external-symbols.lst external-objects.lst .rebuild - $(target) - $(c) -r -nostartfiles -static-intel -no-intel-extensions \ - -Wl,-unexported_symbols_list,external-symbols.lst \ - -Wl,-non_global_symbols_strip_list,external-symbols.lst \ - -filelist external-objects.lst \ - -o $@ $(obj_deps_files) -endif - - # external-objects.lst is a list of object files extracted from external libraries, which should - # be linked into omp.o. kmp_dummy.o is added to the list to avoid empty list -- OS X* utilities - # nm and ld do not like empty lists. - external-objects.lst : $(lib_obj_files) $(addsuffix /.objs,$(linked_in_libs)) kmp_dummy$(obj) \ - $(tools_dir)required-objects.pl .rebuild - $(target) - $(perl) $(tools_dir)required-objects.pl $(oa-opts) \ - --base $(obj_deps_files) --extra $(obj_deps_flags) --print-extra > $@.tmp - echo "kmp_dummy$(obj)" >> $@.tmp - mv $@.tmp $@ - - # Prepare list of symbols in external object files. We will hide all these symbols. - # Note: -j is non-GNU option which means "Just display the symbol names (no value or type)." - external-symbols.lst : external-objects.lst .rebuild - $(target) - nm -goj $$(cat external-objects.lst) > $@.0.tmp - cut -f2 -d" " $@.0.tmp > $@.1.tmp - mv $@.1.tmp $@ - -endif # mac - -# Import library tricks are Windows* OS-specific. -ifeq "$(os)" "win" - - import$(lib) : $(lib_item)$(dll) - - # Change the name of import library produced by the linker, we will combine it with some more - # object files to produce "extended import lib". - $(lib_item)$(dll) : imp_file := import$(lib) - - # Default rule "c to obj" will compile sources with -MT option, which is not desired. - # Cancel effect of -MT with -Zl. - # AC: Currently we only have one object that does not need any special - # compiler options, so use minimal set. With standard set of options we used - # there were problems with debug info leaked into the import library - # with this object (bug report #334565). - $(imp_obj_files) : c-flags := -Zl -nologo -c - - $(imp_file).lst : $(imp_obj_files) import$(lib) .rebuild - $(target) - echo $(filter-out .rebuild,$^) > $@ - -endif - -kmp_i18n_id.inc : en_US.txt \ - $(tools_dir)message-converter.pl .rebuild - $(target) - $(perl) $(tools_dir)message-converter.pl $(oa-opts) --prefix=kmp_i18n --enum=$@ $< - -kmp_i18n_default.inc : en_US.txt \ - $(tools_dir)message-converter.pl .rebuild - $(target) - $(perl) $(tools_dir)message-converter.pl $(oa-opts) --prefix=kmp_i18n --default=$@ $< - -# Rebuilt kmp_version.o on any change to have actual build time string always updated. -kmp_version$(obj): $(filter-out kmp_version$(obj),$(lib_obj_files) $(imp_obj_files)) - -$(def_file) : dllexports \ - $(tools_dir)generate-def.pl .rebuild - $(target) - $(perl) $(tools_dir)generate-def.pl $(gd-flags) -o $@ $< - -libomp.rc : libomp.rc.var kmp_version.c -libomp.rc : ev-flags += -D KMP_FILE=$(lib_file) - -kmp_dummy.c : .rebuild - $(target) - echo "void __kmp_dummy() {}" > $@ - -# -------------------------------------------------------------------------------------------------- -# Tests. -# -------------------------------------------------------------------------------------------------- - -# --- test-touch --- - -# test-touch is not available for mic. -ifneq "$(arch)" "mic" - - # Compile a simple C test and link it with the library. Do it two times: the first link gives us - # clear message if there are any problems, the second link run in verbose mode, linker output - # searched for "libirc" string -- should not be any libirc references. Finally, test executable - # run with KMP_VERBOSE=1. - - ifeq "$(os)" "win" - ifneq "$(do_test_touch_mt)" "0" - test_touch_items += test-touch-md test-touch-mt - else - test_touch_items += test-touch-md - endif - else - test_touch_items += test-touch-rt - endif - - force-test-touch : $(addsuffix /.force,$(test_touch_items)) $(addsuffix /.test,$(test_touch_items)) - test-touch : $(addsuffix /.test,$(test_touch_items)) - - tt-exe-file = $(dir $@)test-touch$(exe) - ifeq "$(os)" "win" - # On Windows* OS the test quality is problematic, because LIB environment variable is set up for - # Intel compiler so Microsoft compiler is able to find libirc if it is specified in defaultlib - # directive within object file... This disadvantage is compensated by grepping verbose link - # output for "libirc" string. - tt-c = cl - tt-c-flags += -nologo - ifeq "$(OPTIMIZATION)" "on" - tt-c-flags-mt = -MT - tt-c-flags-md = -MD - else - tt-c-flags-mt = -MTd - tt-c-flags-md = -MDd - endif - ifeq "$(LINK_TYPE)" "stat" - tt-libs += $(lib_file) - else - tt-libs += $(imp_file) - endif - ifneq "$(arch)" "32" - # To successfully build with VS2008 - # tt-libs += bufferoverflowu.lib - # Preventing "unresolved external symbol __security_cookie" (and - # "... __security_check_cookie") linker errors on win_32e and win_64. - endif - tt-c-flags += -Fo$(dir $@)test-touch$(obj) -Fe$(tt-exe-file) - tt-ld-flags += -link - # Some Posix but non-ISO functions (like strdup) are defined in oldnames.lib, which is used - # implicitly. Drop oldnames.lib library, so we can catch - tt-ld-flags += -nodefaultlib:oldnames - ifeq "$(arch)" "32" - tt-ld-flags += -safeseh - endif - tt-ld-flags-v += -verbose - else # lin or mac - # On Linux* OS and OS X* the test is good enough because GNU compiler knows nothing - # about libirc and Intel compiler private lib directories, but we will grep verbose linker - # output just in case. - # Using clang on OS X* because of discontinued support of GNU compilers. - ifeq "$(os)" "mac" - ifeq "$(std_cpp_lib)" "1" - tt-c = clang++ - else - tt-c = clang - endif - else # lin - ifeq "$(std_cpp_lib)" "1" - tt-c = g++ - else - tt-c = gcc - endif - # GCC on OS X* does not recognize -pthread. - tt-c-flags += -pthread - endif - tt-c-flags += -o $(tt-exe-file) - ifneq "$(filter 32 32e 64,$(arch))" "" - tt-c-flags += $(if $(filter 64,$(arch)),,$(if $(filter 32,$(arch)),-m32,-m64)) - endif - tt-libs += $(lib_file) - ifeq "$(os)-$(COVERAGE)-$(LINK_TYPE)" "lin-on-stat" - # Static coverage build on Linux* OS fails due to unresolved symbols dlopen, dlsym, dlclose. - # Explicitly add dl library to avoid failure. - tt-ld-flags += -ldl - endif - ifeq "$(os)" "mac" - tt-ld-flags-v += -Wl,-t - tt-env += DYLD_LIBRARY_PATH=".:$(DYLD_LIBRARY_PATH)" - else # lin - tt-ld-flags-v += -Wl,--verbose - tt-env += LD_LIBRARY_PATH=".:$(LD_LIBRARY_PATH)" - endif - endif - tt-c-flags += $(tt-c-flags-rt) - tt-env += KMP_VERSION=1 - tt-i = $(if $(filter off,$(TEST_TOUCH)),-) - - ifndef test-touch-commands - # The first building gives short and clear error message in case of any problem. - # The second building runs linker in verbose mode and saves linker output for grepping. - define test-touch-commands - $(rm) $(dir $@)* - $(tt-i)$(tt-c) $(tt-c-flags) $< $(tt-libs) $(tt-ld-flags) - $(rm) $(tt-exe-file) - $(tt-i)$(tt-c) $(tt-c-flags) \ - $< $(tt-libs) \ - $(tt-ld-flags) $(tt-ld-flags-v) \ - > $(dir $@)build.log 2>&1 - $(tt-i)$(tt-env) $(tt-exe-file) - $(tt-i)grep -i -e "[^_]libirc" $(dir $@)build.log > $(dir $@)libirc.log; \ - [ $$? -eq 1 ] - endef - endif - - test-touch-rt/.test : tt-c-flags-rt = - test-touch-mt/.test : tt-c-flags-rt = $(tt-c-flags-mt) - test-touch-md/.test : tt-c-flags-rt = $(tt-c-flags-md) - - test-touch-rt/.test : test-touch.c $(lib_file) test-touch-rt/.dir .rebuild - $(target) - $(test-touch-commands) - $(touch) $@ - test-touch-mt/.test : test-touch.c $(lib_file) $(imp_file) test-touch-mt/.dir .rebuild - $(target) - $(test-touch-commands) - $(touch) $@ - test-touch-md/.test : test-touch.c $(lib_file) $(imp_file) test-touch-md/.dir .rebuild - $(target) - $(test-touch-commands) - $(touch) $@ - -endif - -# --- test-relo --- - -# But test-relo does actual work only on Linux* OS and -# Intel(R) Many Integrated Core Architecture in case of dynamic linking. -ifeq "$(if $(filter lin,$(os)),os)-$(LINK_TYPE)" "os-dyna" - - # Make sure dynamic library does not contain position-dependent code. - force-test-relo : test-relo/.force test-relo/.test - test-relo : test-relo/.test - - test-relo/.test : $(lib_item)$(dll) test-relo/.dir .rebuild - $(target) - ifeq "$(arch)" "mic" - x86_64-k1om-linux-readelf -d $< > $(dir $@)readelf.log - else - readelf -d $< > $(dir $@)readelf.log - endif - grep -e TEXTREL $(dir $@)readelf.log; [ $$? -eq 1 ] - $(touch) $@ - -endif - -# --- test-execstack --- - -# But test-execstack does actual work only on Linux* OS in case of dynamic linking. -ifeq "$(if $(filter lin,$(os)),os)-$(LINK_TYPE)" "os-dyna" - tests += test-execstack - - # Make sure stack is not executable. - force-test-execstack : test-execstack/.force test-execstack/.test - test-execstack : test-execstack/.test - - test-execstack/.test : $(lib_item)$(dll) test-execstack/.dir .rebuild - $(target) - $(perl) $(tools_dir)check-execstack.pl $(oa-opts) $< - $(touch) $@ -endif - -# --- test-instr --- - -# But test-instr does actual work only on Intel(R) Many Integrated Core Architecture. -ifeq "$(arch)" "mic" - - # Make sure dynamic library does not contain position-dependent code. - force-test-instr : test-instr/.force test-instr/.test - test-instr : test-instr/.test - - test-instr/.test : $(lib_file) $(tools_dir)check-instruction-set.pl test-instr/.dir .rebuild - $(target) - $(perl) $(tools_dir)check-instruction-set.pl $(oa-opts) --show --mic-arch=$(MIC_ARCH) $< - $(touch) $@ - -endif - -# --- test-deps --- - -# test-deps does actual work for dymanic linking (all OSes), and Windows* OS (all linking types). -ifneq "$(filter %-dyna win-%,$(os)-$(LINK_TYPE))" "" - - force-test-deps : test-deps/.force test-deps/.test - test-deps : test-deps/.test - - td_exp = - ifeq "$(os)" "lin" - ifeq "$(arch)" "32" - td_exp += libc.so.6 - td_exp += ld-linux.so.2 - td_exp += libgcc_s.so.1 - endif - ifeq "$(arch)" "32e" - td_exp += libc.so.6 - td_exp += ld-linux-x86-64.so.2 - td_exp += libgcc_s.so.1 - endif - ifeq "$(arch)" "64" - td_exp += libc.so.6.1 - td_exp += libgcc_s.so.1 - endif - ifeq "$(arch)" "arm" - td_exp += libc.so.6 - td_exp += ld-linux-armhf.so.3 - td_exp += libgcc_s.so.1 - endif - ifneq "$(filter ppc64 ppc64le,$(arch))" "" - td_exp += libc.so.6 - td_exp += ld64.so.1 - # warning: this is for ppc64le, but as we do not currently - # distinguish it from ppc64, we need to add this dep here - td_exp += ld64.so.2 - td_exp += libgcc_s.so.1 - endif - ifeq "$(arch)" "aarch" - td_exp += libc.so.6 - td_exp += ld-linux-aarch64.so.1 - endif - ifeq "$(arch)-$(MIC_ARCH)" "mic-knf" - td_exp += ld-linux-l1om.so.2 - td_exp += libc.so.6 - td_exp += libgcc_s.so.1 - endif - ifeq "$(arch)-$(MIC_ARCH)" "mic-knc" - td_exp += ld-linux-k1om.so.2 - td_exp += libc.so.6 - endif - ifeq "$(std_cpp_lib)" "1" - td_exp += libstdc++.so.6 - endif - - td_exp += libdl.so.2 - ifeq "$(filter 32 32e 64 ppc64 ppc64le mic,$(arch))" "" - td_exp += libffi.so.6 - td_exp += libffi.so.5 - endif - ifneq "$(LIB_TYPE)" "stub" - td_exp += libpthread.so.0 - endif - endif - ifeq "$(os)" "mac" -# td_exp += /usr/lib/libgcc_s.1.dylib - td_exp += /usr/lib/libSystem.B.dylib - endif - ifeq "$(os)" "win" - ifeq "$(LINK_TYPE)" "dyna" - td_exp += kernel32.dll - else - td_exp += uuid - endif - endif - - ifeq "$(omp_os)" "freebsd" - td_exp = - td_exp += libc.so.7 - td_exp += libthr.so.3 - td_exp += libunwind.so.5 - endif - - test-deps/.test : $(lib_file) $(tools_dir)check-depends.pl test-deps/.dir .rebuild - $(target) - $(td-i)$(perl) $(tools_dir)check-depends.pl $(oa-opts) \ - $(if $(td_exp),--expected="$(subst $(space),$(comma),$(td_exp))") $< - $(touch) $@ - -endif - - -# -------------------------------------------------------------------------------------------------- -# Fortran files. -# -------------------------------------------------------------------------------------------------- -omp_lib_f = omp_lib.f90 -omp_lib_kinds.mod : $(omp_lib_f) .rebuild - $(target) - $(fort) $(fort-flags) $< -omp_lib.mod : omp_lib_kinds.mod - -omp_lib.h : ev-flags += -D KMP_INT_PTR_KIND="int_ptr_kind()" - -# -------------------------------------------------------------------------------------------------- -# Common files. -# -------------------------------------------------------------------------------------------------- - -common : $(out_cmn_files) - -clean-common : - $(rm) $(out_cmn_files) - -# -------------------------------------------------------------------------------------------------- -# Dependency files and common rules. -# -------------------------------------------------------------------------------------------------- - -.PHONY : dep -dep : $(dep_files) - $(target) - -include $(LIBOMP_WORK)src/rules.mk - -# Initiate rebuild if any of makefiles or build sript is changed. -# When developing makefiles, it is useful to comment it, otherwise make will perform full rebuild -# on every change of makefiles. -.rebuild : $(MAKEFILE_LIST) $(tools_dir)build.pl $(tools_dir)lib/Build.pm - -ifeq "$(clean)" "" - # Do not include dependency files if "clean" goal is specified. - -include $(dep_files) -endif - -# end of file # diff --git a/openmp/runtime/src/rules.mk b/openmp/runtime/src/rules.mk deleted file mode 100644 index b5b1b7cb0ec..00000000000 --- a/openmp/runtime/src/rules.mk +++ /dev/null @@ -1,100 +0,0 @@ -# rules.mk # - -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -# --- Copy files to out directories --- - -$(out_cmn_dir)include/% : % $(out_cmn_dir)include/.dir .rebuild - $(target) - $(cp) $< $@ - -$(out_cmn_dir)include_compat/% : % $(out_cmn_dir)include_compat/.dir .rebuild - $(target) - $(cp) $< $@ - -# Fat: touch .touch file on every update in $(out_lib_dir), so we will know should we update fat -# goal or not. -$(out_lib_dir)% : % $(out_lib_dir).dir .rebuild - $(target) - $(cp) $< $@ - ifneq "$(out_lib_fat_dir)" "" - $(touch) $(dir $@).touch - endif - -.PHONY: libomp_aliases -libomp_aliases: $(out_lib_dir).dir .rebuild $(out_lib_dir)$(lib_file) - $(target) -ifeq "$(os)" "win" - cd $(out_lib_dir) ; $(cp) $(lib_file) libiomp5md$(dll) ; $(cp) $(imp_file) libiomp5md$(lib) -else - cd $(out_lib_dir) ; ln -sf $(lib_file) libiomp5$(dll) -endif - -$(out_ptf_dir)include/% : % $(out_ptf_dir)include/.dir .rebuild - $(target) - $(cp) $< $@ - -$(out_ptf_dir)include_compat/% : % $(out_ptf_dir)include_compat/.dir .rebuild - $(target) - $(cp) $< $@ - -$(out_l10n_dir)%/$(cat_file) : l10n/%/$(cat_file) $(out_l10n_dir)%/.dir .rebuild - $(target) - $(cp) $< $@ - -ifeq "$(os)" "mac" - $(out_l10n_fat_dir)%/$(cat_file) : l10n/%/$(cat_file) $(out_l10n_fat_dir)%/.dir .rebuild - $(target) - $(cp) $< $@ -endif - -# --- Include really common rules --- - -include $(LIBOMP_WORK)tools/src/common-rules.mk - -# --- Building helper tools from sources --- - -.PRECIOUS: %$(exe) # Do not delete automatically created files. - -%$(exe) : $(tools_dir)%.cpp .rebuild - $(target) - $(cxx) $(cxx-out)$@ $< - -# --- Fat libraries --- - -# Every time new file is copied to $(out_lib_dir) directory we update $(out_lib_dir).rebuild file, -# so we know should we rebuild fat libraries or not. - -# Note: Original implementation built fat libraries in mac_32 directory, then copied all the -# libraries from mac_32 to mac_32e directory. However, this may work wrong if exports/mac_*/lib/ -# contains other libraries. So now we build fat libraries twice: in both mac_32 -# and mac_32e directories. - -ifeq "$(platform)" "mac_32e" - - .PHONY : fat - fat : $(call _out_lib_fat_dir,mac_32).done $(call _out_lib_fat_dir,mac_32e).done - - $(call _out_lib_fat_dir,mac_32).done \ - $(call _out_lib_fat_dir,mac_32e).done : \ - $(call _out_lib_dir,mac_32).touch \ - $(call _out_lib_dir,mac_32e).touch \ - $(tools_dir)make-fat-binaries.pl \ - $(call _out_lib_fat_dir,mac_32).dir $(call _out_lib_fat_dir,mac_32e).dir .rebuild - $(target) - $(perl) $(tools_dir)make-fat-binaries.pl \ - --output=$(dir $@) $(call _out_lib_dir,mac_32) $(call _out_lib_dir,mac_32e) - $(touch) $@ - -endif - -# end of file # diff --git a/openmp/runtime/tools/build.pl b/openmp/runtime/tools/build.pl deleted file mode 100755 index 53027a57907..00000000000 --- a/openmp/runtime/tools/build.pl +++ /dev/null @@ -1,756 +0,0 @@ -#!/usr/bin/perl - -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -# Pragmas. -use strict; -use warnings; - -# Standard modules. -use Data::Dumper; # Not actually used, but useful for debugging dumps. - -# Enable `libomp/tools/lib/' module directory. -use FindBin; -use lib "$FindBin::Bin/lib"; - -# LIBOMP modules. -use Build; -use LibOMP; -use Platform ":vars"; -use Uname; -use tools; - -our $VERSION = "0.017"; - -# -------------------------------------------------------------------------------------------------- -# Important variables. -# -------------------------------------------------------------------------------------------------- - -my $root_dir = $ENV{ LIBOMP_WORK }; - -my %makefiles = ( - rtl => cat_file( $root_dir, "src", "makefile.mk" ), - timelimit => cat_file( $root_dir, "tools", "src", "timelimit", "makefile.mk" ), -); - -# -------------------------------------------------------------------------------------------------- -# Parse command line. -# -------------------------------------------------------------------------------------------------- - -# Possible options. -# * targets: comma separated list of targets the option has meaning for. For example, -# "version" option (4 or 5) has a meaning only for "rtl" target, while "mode" option has -# meaning for all targets. -# * base: If base is true this is a base option. All the possible values of base options are -# iterated if "--all" option is specified. If base is 0, this is an extra option. -# * params: A hash of possible option values. "*" denotes default option value. For example, -# if "versio" option is not specified, "--version=5" will be used implicitly. -# * suffux: Only for extra options. Subroutine returning suffix for build and output -# directories. ** When you do not want an option to be part of the suffix, set its base=2 -my $opts = { - "target" => { targets => "", base => 1, parms => { map( ( $_ => "" ), keys( %makefiles ) ), rtl => "*" }, }, - "version" => { targets => "rtl", base => 1, parms => { 5 => "*", 4 => "" }, }, - "lib-type" => { targets => "rtl", base => 1, parms => { normal => "*", stubs => "" }, }, - "link-type" => { targets => "rtl", base => 1, parms => { dynamic => "*", static => "" }, }, - "mode" => { targets => "rtl,dsl,timelimit", base => 0, parms => { release => "*", diag => "", debug => "" }, suffix => sub { substr( $_[ 0 ], 0, 3 ); } }, - "omp-version" => { targets => "rtl", base => 0, parms => { 40 => "", 30 => "", 41 => "*" }, suffix => sub { $_[ 0 ]; } }, - "coverage" => { targets => "rtl", base => 0, parms => { off => "*", on => "" }, suffix => sub { $_[ 0 ] eq "on" ? "c1" : "c0"; } }, - "stats" => { targets => "rtl", base => 0, parms => { off => "*", on => "" }, suffix => sub { $_[ 0 ] eq "on" ? "s1" : "s0"; } }, - "ompt-support" => { targets => "rtl", base => 0, parms => { off => "*", on => "" }, suffix => sub { $_[ 0 ] eq "on" ? "ompt" : "" } }, - "ompt-blame" => { targets => "rtl", base => 0, parms => { off => "", on => "*" }, suffix => sub { $_[ 0 ] eq "on" ? "" : "no-ompt-blame" } }, - "ompt-trace" => { targets => "rtl", base => 0, parms => { off => "", on => "*" }, suffix => sub { $_[ 0 ] eq "on" ? "" : "no-ompt-trace" } }, -}; -my $synonyms = { - "debug" => [ qw{ dbg debg } ], -}; -# This array specifies order of options to process, so it cannot be initialized with keys( %$opts ). -my @all_opts = qw{ target version lib-type link-type mode omp-version coverage stats ompt-support ompt-blame ompt-trace }; -# This is the list of base options. -my @base_opts = grep( $opts->{ $_ }->{ base } == 1, @all_opts ); -# This is the list of extra options. -my @extra_opts = grep( $opts->{ $_ }->{ base } == 0, @all_opts ); - -sub suffix($$$) { - my ( $opt, $value, $skip_if_default ) = @_; - my $suffix = ""; - if ( not $skip_if_default or $value ne $opts->{ $opt }->{ dflt } ) { - $suffix = $opts->{ $opt }->{ suffix }->( $value ); - }; # if - return $suffix; -}; # sub suffix - -my $scuts = {}; # Shortcuts. Will help to locate proper item in $opts. -foreach my $opt ( keys( %$opts ) ) { - foreach my $parm ( keys( %{ $opts->{ $opt }->{ parms } } ) ) { - if ( $parm !~ m{\A(?:[012]|on|off)\z} ) { - $scuts->{ $parm } = $opts->{ $opt }; - }; # if - if ( $opts->{ $opt }->{ parms }->{ $parm } eq "*" ) { - $opts->{ $opt }->{ dflt } = $parm; - }; # if - }; # foreach $parm -}; # foreach $opt - -sub parse_option(@) { - # This function is called to process every option. $name is option name, $value is option value. - # For boolean options $value is either 1 or 0, - my ( $name, $value ) = @_; - if ( $name eq "all" or $name eq "ALL" ) { - foreach my $opt ( keys( %$opts ) ) { - if ( $opts->{ $opt }->{ base } or $name eq "ALL" ) { - foreach my $parm ( keys( %{ $opts->{ $opt }->{ parms } } ) ) { - $opts->{ $opt }->{ parms }->{ $parm } = 1; - }; # foreach $parm - }; # if - }; # foreach $opt - return; - }; # if - if ( exists( $opts->{ $name } ) ) { - # Suppose it is option with explicit value, like "target=normal". - if ( $value eq "all" ) { - foreach my $parm ( keys( %{ $opts->{ $name }->{ parms } } ) ) { - $opts->{ $name }->{ parms }->{ $parm } = 1; - }; # foreach - return; - } elsif ( exists( $opts->{ $name }->{ parms }->{ $value } ) ) { - $opts->{ $name }->{ parms }->{ $value } = 1; - return; - } elsif ( $value eq "" and exists( $opts->{ $name }->{ parms }->{ on } ) ) { - $opts->{ $name }->{ parms }->{ on } = 1; - return; - } else { - cmdline_error( "Illegal value of \"$name\" option: \"$value\"" ); - }; # if - }; # if - # Ok, it is not an option with explicit value. Try to treat is as a boolean option. - if ( exists( $scuts->{ $name } ) ) { - ( $value eq "1" or $value eq "0" ) or die "Internal error; stopped"; - $scuts->{ $name }->{ parms }->{ $name } = $value; - return; - }; # if - # No, it is not a valid option at all. - cmdline_error( "Illegal option: \"$name\"" ); -}; # sub parse_option - -my $clean = 0; -my $clean_common = 0; -my $clobber = 0; -my $test_deps = 1; -my $test_touch = 1; -my @goals; - -sub synonyms($) { - my ( $opt ) = @_; - return exists( $synonyms->{ $opt } ) ? "|" . join( "|", @{ $synonyms->{ $opt } } ) : ""; -}; # sub synonyms - -my @specs = ( - map( ( "$_" . synonyms( $_ ) . "=s" => \&parse_option ), keys( %$opts ) ), - map( ( "$_" . synonyms( $_ ) . "!" => \&parse_option ), keys( %$scuts ) ), -); -my $answer; -get_options( - @specs, - Platform::target_options(), - "all" => \&parse_option, - "ALL" => \&parse_option, - "answer=s" => \$answer, - "test-deps!" => \$test_deps, - "test-touch!" => \$test_touch, - "version|ver:s" => - sub { - # It is a tricky option. It specifies library version to build and it is also a standard - # option to request tool version. - if ( $_[ 1 ] eq "" ) { - # No arguments => version request. - print( "$tool version $VERSION\n" ); - exit( 0 ); - } else { - # Arguments => version to build. - parse_option( @_ ) - }; - }, -); -@goals = @ARGV; -if ( grep( $_ eq "clobber", @goals ) ) { - $clobber = 1; -}; # if -if ( grep( $_ eq "clean", @goals ) ) { - $clean = 1; -}; # if - -# Ok, now $opts is fulfilled with 0, 1 (explicitly set by the user) and "" and "*" (original -# values). In each option at least one 1 should be present (otherwise there is nothing to build). -foreach my $opt ( keys( %$opts ) ) { - if ( not grep( $_ eq "1", values( %{ $opts->{ $opt }->{ parms } } ) ) ) { - # No explicit "1" found. Enable default choice by replacing "*" with "1". - foreach my $parm ( keys( %{ $opts->{ $opt }->{ parms } } ) ) { - if ( $opts->{ $opt }->{ parms }->{ $parm } eq "*" ) { - $opts->{ $opt }->{ parms }->{ $parm } = 1; - }; # if - }; # foreach $parm - }; # if -}; # foreach $opt - -# Clear $opts. Leave only "1". -foreach my $opt ( keys( %$opts ) ) { - foreach my $parm ( keys( %{ $opts->{ $opt }->{ parms } } ) ) { - if ( $opts->{ $opt }->{ parms }->{ $parm } ne "1" ) { - delete( $opts->{ $opt }->{ parms }->{ $parm } ); - }; # if - }; # foreach $parm -}; # foreach $opt - -# -------------------------------------------------------------------------------------------------- -# Fill job queue. -# -------------------------------------------------------------------------------------------------- - -sub enqueue_jobs($$@); -sub enqueue_jobs($$@) { - my ( $jobs, $set, @rest ) = @_; - if ( @rest ) { - my $opt = shift( @rest ); - if ( - exists( $set->{ target } ) - and - $opts->{ $opt }->{ targets } !~ m{(?:\A|,)$set->{ target }(?:,|\z)} - ) { - # This option does not have meananing for the target, - # do not iterate, just use default value. - enqueue_jobs( $jobs, { $opt => $opts->{ $opt }->{ dflt }, %$set }, @rest ); - } else { - foreach my $parm ( sort( keys( %{ $opts->{ $opt }->{ parms } } ) ) ) { - enqueue_jobs( $jobs, { $opt => $parm, %$set }, @rest ); - }; # foreach $parm - }; # if - } else { - my $makefile = $makefiles{ $set->{ target } }; - my @base = map( substr( $set->{ $_ }, 0, 3 ), @base_opts ); - my @extra = map( suffix( $_, $set->{ $_ }, 0 ), @extra_opts ); - my @ex = grep( $_ ne "", map( suffix( $_, $set->{ $_ }, 1 ), @extra_opts ) ); - # Shortened version of @extra -- only non-default values. - my $suffix = ( @extra ? "." . join( ".", @extra ) : "" ); - my $knights = index( $suffix, "kn" ) - 1; - if ( $target_arch !~ "mic" and $knights > 0 ) { - $suffix = substr( $suffix, 0, $knights ); - } - my $suf = ( @ex ? "." . join( ".", @ex ) : "" ); - # Shortened version of $siffix -- only non-default values. - my $build_dir = join( "-", $target_platform, join( "_", @base ) . $suffix, Uname::host_name() ); - my $out_arch_dir = cat_dir( $ENV{ LIBOMP_EXPORTS }, $target_platform . $suf ); - my $out_cmn_dir = cat_dir( $ENV{ LIBOMP_EXPORTS }, "common" ); - push( - @$jobs, - { - makefile => $makefile, - make_args => [ - "os=" . $target_os, - "arch=" . $target_arch, - "MIC_ARCH=" . $target_mic_arch, - "date=" . Build::tstr( $Build::start ), - "TEST_DEPS=" . ( $test_deps ? "on" : "off" ), - "TEST_TOUCH=" . ( $test_touch ? "on" : "off" ), - "CPLUSPLUS=on", - "COVERAGE=" . $set->{ coverage }, - # Option "mode" controls 3 make flags: - # debug => Full debugging : diagnostics, debug info, no optimization. - # diag => Only diagnostics : diagnostics, debug info, optimization. - # release => Production build : no diagnostics, no debug info, optimization. - "DEBUG_INFO=" . ( $set->{ mode } ne "release" ? "on" : "off" ), - "DIAG=" . ( $set->{ mode } ne "release" ? "on" : "off" ), - "OPTIMIZATION=" . ( $set->{ mode } ne "debug" ? "on" : "off" ), - "LIB_TYPE=" . substr( $set->{ "lib-type" }, 0, 4 ), - "LINK_TYPE=" . substr( $set->{ "link-type" }, 0, 4 ), - "OMP_VERSION=" . $set->{ "omp-version" }, - "VERSION=" . $set->{ version }, - "suffix=" . $suf, - "stats=" . $set->{ stats }, - "OMPT_SUPPORT=" . $set->{ "ompt-support" }, - "OMPT_BLAME=" . $set->{ "ompt-blame" }, - "OMPT_TRACE=" . $set->{ "ompt-trace" }, - @goals, - ], - build_dir => $build_dir - } - ); # push - }; # if -}; # sub enqueue_jobs - -my @jobs; -enqueue_jobs( \@jobs, {}, @all_opts ); - -# -------------------------------------------------------------------------------------------------- -# Do the work. -# -------------------------------------------------------------------------------------------------- - -my $exit = 0; - -Build::init(); - -if ( $clobber ) { - my @dirs = ( $ENV{ LIBOMP_TMP }, $ENV{ LIBOMP_EXPORTS }, cat_dir( $root_dir, "tools", "bin" ) ); - my $rc = 0; - question( - "Clobber " . join( ", ", map( "\"" . Build::shorter( $_ ) . "\"", @dirs ) ) . " dirs? ", - $answer, - qr{\A(y|yes|n|no)\z}i - ); - if ( $answer =~ m{\Ay}i ) { - info( "Clobbering..." ); - $rc = Build::clean( @dirs ); - info( Build::rstr( $rc ) ); - }; # if - if ( $rc != 0 ) { - $exit = 3; - }; # if -} else { # Build or clean. - if ( @jobs ) { - my $total = @jobs; # Total number of jobs. - my $n = 0; # Current job number. - Build::progress( "", "" ); # Output empty line to log file. - my $goals = join( " ", @goals ); - Build::progress( "Goals", $goals eq "" ? "(all)" : $goals ); - Build::progress( "Configurations", scalar( @jobs ) ); - foreach my $job ( @jobs ) { - ++ $n; - my $base = get_file( $job->{ build_dir } ); - Build::progress( "Making", "%3d of %3d : %s", $n, $total, $base ); - $job->{ rc } = Build::make( $job, $clean, sprintf( "%d/%d", $n, $total ) ); - }; # my $job - my $failures = Build::summary(); - if ( $failures > 0 ) { - $exit = 3; - }; # if - } else { - info( "Nothing to do." ); - }; # if -}; # if - -# And exit. -exit( $exit ); - -__END__ - -=pod - -=head1 NAME - - -B<build.pl> -- Build one or more configurations of OMP RTL libraries. - -=head1 SYNOPSIS - -B<build.pl> I<option>... [B<-->] I<make-option>... I<variable>... I<goal>... - -=head1 OPTIONS - -=over - -=item B<--all> - -Build all base configurations. - -=item B<--ALL> - -Build really all configurations, including extra ones. - -=item B<--answer=>I<str> - -Use specified string as default answer to all questions. - -=item B<--architecture=>I<arch> - -Specify target architecture to build. Default is architecture of host machine. I<arch> can be C<32>, -C<32e>, C<mic>, or one of known aliases like C<IA32>. - -If architecture is not specified explicitly, value of LIBOMP_ARCH environment variable is used. -If LIBOMP_ARCH is not defined, host architecture detected. - -=item B<--os=>I<os> - -Specify target OS. Default is OS of host machine. I<os> can be C<lin>, C<mac>, C<win>, -or one of known aliases like C<Linux>, C<WinNT>, etc. - -=item B<--mic-arch=>I<arch> - -Specify architecture of Intel(R) Many Integrated Core Architecture card. Default is C<knf>. I<arch> can be C<knf>, C<knc>, C<knl>. - -=item B<-->[B<no->]B<test-deps> - -Enable or disable C<test-deps>. The test runs in any case, but result of disabled test is ignored. -By default, test is enabled. - -=item B<-->[B<no->]B<test-touch> - -Enable or disable C<test-touch>. The test runs in any case, but result of disabled test is ignored. -By default, test is enabled. - -=item Base Configuration Selection Options - -=over - -=item B<--target=>I<target> - -Build specified target, either C<rtl> (OMP Runtime Library; default), -or C<timelimit> (program used in testing), or C<all>. - -=item B<--lib-type=>I<lib> - -Build specified library, either C<normal> (default), or C<stubs>, or C<all>. - -=item B<--link-type=>I<type> - -Build specified link type, either C<dynamic> (default) or C<all>. - -=back - -=item Extra Configuration Selection Options - -=over - -=item B<--cover=>I<switch> - -Build for code coverage data collection. I<switch> can be C<off> (default), C<on> -or C<all>. - -=item B<--mode=>I<mode> - -Build library of specified I<mode>, either C<debug>, C<diag>, C<release> (default), or C<all>. -Mode controls 3 features: - - --------------------------------------------------- - feature/mode debug diag release - --------------------------------------------------- - debug info o o - diagnostics (asserts, traces) o o - code optimization o o - --------------------------------------------------- - -=back - -=item Shortcuts - -If option with C<no> prefix is used, corresponding configuration will B<not> be built. -Useful for excluding some configurations if one or more other options specified with C<all> -value (see Examples). - -=over - -=item B<-->[B<no>]B<11> - -Build files for compiler C<11>. - -=item B<-->[B<no>]B<12> - -Build files for compiler C<12>. - -=item B<-->[B<no>]B<debug> - -=item B<-->[B<no>]B<debg> - -=item B<-->[B<no>]B<dbg> - -Build debuggable library. - -=item B<-->[B<no>]B<diag> - -Build library with diagnostics enabled. - -=item B<-->[B<no>]B<dynamic> - -Build dynamic library (default). - -=item B<-->[B<no>]B<normal> - -Build normal library (default). - -=item B<-->[B<no>]B<release> - -Build release library (default). - -=item B<-->[B<no>]B<rtl> - -Build OMP RTL (default). - -=item B<-->[B<no>]B<stubs> - -Build stubs library. - -=item B<-->[B<no>]B<timelimit> - -Build timelimit utility program. - -=back - -=item Standard Options - -=over - -=item B<--doc> - -=item B<--manual> - -Print full help message and exit. - -=item B<--help> - -Print short help message and exit. - -=item B<--usage> - -Print very short usage message and exit. - -=item B<--verbose> - -Do print informational messages. - -=item B<--version> - -Print program version and exit. - -=item B<--quiet> - -Work quiet, do not print informational messages. - -=back - -=back - -=head1 ARGUMENTS - -=over - -=item I<make-option> - -Any option for makefile, for example C<-k> or C<-n>. If you pass some options to makefile, C<--> -delimiter is mandatory, otherwise C<build.pl> processes all the options internally. - -=item I<variable> - -Define makefile variable in form I<name>B<=>I<value>. Most makefile capabilities are -accessible through C<build.pl> options, so there is no need in defining make variables in command -line. - -=item I<goal> - -Makefile goal to build (or clean). - -=over - -=item B<all> - -Build C<lib>, C<tests>, C<inc>. - -=item B<common> - -Build common (architecture-independent) files. Common files are not configuration-dependent, so -there is no point in building it for more than one configuration (thought it is harmless). -However, do not build common files on many machines simultaneously. - -=item B<clean> - -Delete the export files and clean build directory of configuration(s) specified by options. Note -that C<clean> goal cannot be mixed with other goals (except for C<clean-common>). - -=item B<clean-common> - -Delete the common files in F<exports/> directory. - -=item B<clobber> - -Clean F<export/> and F<tmp/> directories. If C<clobber> is specified, other goals and/or options -do not matter. - -Note: Clobbering is potentialy dangerous operation, because it deletes content of directory -pointed by If C<LIBOMP_TMP> environment variable, so C<build.pl> asks a confirmation before -clobbering. To suppress the question, use option C<--answer=yes>. - -=item B<fat> - -C<mac_32e> only: Build fat libraries for both mac_32 and mac_32e. Should be run when C<lib> -goal is built on both C<mac_32> and C<mac_32e>. - -=item I<file.o> - -(Windows* OS: I<file.obj>) Build specified object file only. - -=item I<file.i> - -Create preprocessed source file. - -=item B<force-tests> - -Force performing tests. - -=item B<force-test-deps> - -Force performing test-deps. - -=item B<force-test-instr> - -Force performing test-instr. - -=item B<force-test-relo> - -Force performing test-relo. - -=item B<force-test-touch> - -Force performing test-touch. - -=item B<inc> - -Build Fortran include files, omp_lib.h, omp_lib.mod and omp_lib_kinds.mod. - -=item B<lib> - -Build library (on Windows* OS in case of dynamic linking, it also builds import library). - -=item B<tests> - -Perform tests: C<test-deps>, C<test-instr>, C<test-relo>, and C<test-touch>. - -=item B<test-deps> - -Check the library dependencies. - -=item B<test-instr> - -Intel(R) Many Integrated Core Architecture only: check the library does not contain undesired instructions. - -=item B<test-relo> - -Linux* OS with dynamic linking only: check the library does not contain position-dependent -code. - -=item B<test-touch> - -Build a very simple application with native compiler (GNU on Linux* OS and OS X*, MS -on Windows* OS), check it does not depend on C<libirc> library, and run it. - -=back - -=back - -=head1 DESCRIPTION - -C<build.pl> constructs the name of a build directory, creates the directory if it -does not exist, changes to it, and runs make to build the goals in specified configuration. -If more than one configuration are specified in command line C<build.pl> builds them all. - -Being run with C<clean> goal, C<build.pl> does not build but deletes export files and -cleans build directories of configuration specified by other options. For example, -C<build.pl --all clean> means "clean build directories for all configurations", -it does B<not> mean "clean then build all". - -C<clear-common> goal deletes common files in F<exports/> directory. -Since common files are really common and not architecture and/or configuration dependent, -there are no much meaning in combining C<clear-common> with configuration selection options. -For example, C<build.pl --all clean-common> deletes the same files 13 times. -However, it does not hurt and can be used in conjunction with C<clear> goal. - -C<clobber> goal instructs C<build.pl> to clean exports and all build -directories, e. g. clean everything under F<exports/> and F<tmp/> directories. - -Logs are saved automatically, there is no need in explicit output redirection. -Log file for each particular configuration is named F<build.log> and located in build directory. -Summary log file (just result of each configuration) is saved in F<tmp/> directory. - -Log files are never overwritten. C<build.pl> always appends output to log files. -However (obviously), C<clear> deletes log file for cleared configurations, -and C<clobber> deletes all summary log files. - -=head2 Environment Variables - -=over - -=item B<LIBOMP_ARCH> - -Specifies target architecture. If not present, host architecture is used. Environment variable may -be overriden by C<--architecture> command line option. - -=item B<LIBOMP_EXPORTS> - -Specifies directory for output files. If not set, C<$LIBOMP_WORK/exports/> used by default. - -=item B<LIBOMP_OS> - -Specifies target OS. If not present, host OS is used. Environment variable may -be overriden by C<--os> command line option. - -=item B<LIBOMP_TMP> - -Directory for temporary files. C<build.pl> creates build directories there. If not set, -C<$LIBOMP_WORK/tmp/> used by default. - -On Windows* OS F<tmp/> directory on local drive speeds up the build process. - -=item B<LIBOMP_WORK> - -Root of libomp directory tree, contains F<src/>, F<tools/>, and F<exports/> subdirs. -If not set, C<build.pl> guesses the root dir (it is a parent of dir containing C<build.pl>). - -Note: Guessing it not reliable. Please set C<LIBOMP_WORK> environment variable appropriately. - -=back - -=head1 EXAMPLES - -=head2 Development - -Build normal (performance) dynamic library for debugging: - - $ build.pl --debug - -Build all libraries (normal, stub; dynamic RTL) for debugging: - - $ build.pl --all --debug - -Do a clean build for all: - - $ build.pl --all --debug clean && build.pl --all --debug - -Debugging libraries are saved in F<exports/I<platform>.deb/>. - -=head2 Promotion - -=over - -=item 1 - -Clobber everything; on one machine: - - $ build.pl clobber - -=item 2 - -Build common headers, on one machine: - - $ build.pl common - -=item 3 - -Build all platform-dependent files, on all machines: - - $ build.pl --all - -=item 4 - -Build OS X* universal (fat) libraries, on C<mac_32e>: - - $ build.pl fat - -=back - -=cut - -# end of file # diff --git a/openmp/runtime/tools/check-openmp-test.pl b/openmp/runtime/tools/check-openmp-test.pl deleted file mode 100755 index 2e64a74053e..00000000000 --- a/openmp/runtime/tools/check-openmp-test.pl +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use FindBin; -use lib "$FindBin::Bin/lib"; - -# LIBOMP modules. -use Build; -use LibOMP; -use Platform ":vars"; -use Uname; -use tools; - -my $root_dir = $ENV{ LIBOMP_WORK }; -print join('', $target_platform, "/"); - diff --git a/openmp/runtime/tools/check-openmp.pl b/openmp/runtime/tools/check-openmp.pl deleted file mode 100755 index 60334d7f026..00000000000 --- a/openmp/runtime/tools/check-openmp.pl +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use FindBin; -use lib "$FindBin::Bin/lib"; - -# LIBOMP modules. -use Build; -use LibOMP; -use Platform ":vars"; -use Uname; -use tools; - -my $root_dir = $ENV{ LIBOMP_WORK }; -print join('', $root_dir, "/", "exports", "/", $target_platform, "/", "lib"); - diff --git a/openmp/runtime/tools/check-tools.pl b/openmp/runtime/tools/check-tools.pl deleted file mode 100755 index 5f6e53a51d5..00000000000 --- a/openmp/runtime/tools/check-tools.pl +++ /dev/null @@ -1,605 +0,0 @@ -#!/usr/bin/perl - -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -# Pragmas. -use strict; -use warnings; - -use FindBin; -use lib "$FindBin::Bin/lib"; - -# LIBOMP modules. -use Platform ":vars"; -use tools; - -our $VERSION = "0.015"; - -my $pedantic; - -# -------------------------------------------------------------------------------------------------- -# Helper functions -# -------------------------------------------------------------------------------------------------- - - -sub run($\$\$;\$) { - my ( $cmd, $stdout, $stderr, $path ) = @_; - my ( @path, $rc ); - @path = which( $cmd->[ 0 ], -all => 1 ); - if ( @path > 0 ) { - if ( @path > 1 and $pedantic ) { - warning( "More than one \"$cmd->[ 0 ]\" found in PATH:", map( " $_", @path ) ); - }; # if - debug( "\"$cmd->[ 0 ]\" full path is \"$path[ 0 ]\"." ); - if ( defined( $path ) ) { - $$path = $path[ 0 ]; - }; # if - debug( "Executing command: \"" . join ( " ", @$cmd ) . "\"." ); - $rc = - execute( - $cmd, - -ignore_signal => 1, -ignore_status => 1, - -stdout => $stdout, -stderr => $stderr, -stdin => undef - ); - if ( $rc < 0 ) { - warning( "Cannot run \"$cmd->[ 0 ]\": $@" ); - }; # if - debug( "stdout:", $$stdout, "(eof)", "stderr:", $$stderr, "(eof)" ); - } else { - warning( "No \"$cmd->[ 0 ]\" found in PATH." ); - $rc = -1; - }; # if - return $rc; -}; # sub run - - -sub get_arch($$$) { - my ( $name, $str, $exps ) = @_; - my ( $arch, $count ); - $count = 0; - foreach my $re ( keys( %$exps ) ) { - if ( $str =~ $re ) { - $arch = $exps->{ $re }; - ++ $count; - }; # if - }; # for - if ( $count != 1 or not Platform::canon_arch( $arch ) ) { - warning( "Cannot detect $name architecture: $str" ); - return undef; - }; # if - return $arch; -}; # sub get_arch - -sub encode($) { - my ( $str ) = @_; - $str =~ s{ }{_}g; - return $str; -}; # sub encode - - -# -------------------------------------------------------------------------------------------------- -# get_xxx_version subroutines. -# -------------------------------------------------------------------------------------------------- -# -# Some of get_xxx_version() subroutines accept an argument -- a tool name. For example, -# get_intel_compiler_version() can report version of C, C++, or Fortran compiler. The tool for -# report should be specified by argument, for example: get_intel_compiler_version( "ifort" ). -# -# get_xxx_version() subroutines returns list of one or two elements: -# 1. The first element is short tool name (like "gcc", "g++", "icl", etc). -# 2. The second element is version string. -# If returned list contain just one element, it means there is a problem with the tool. -# - -sub get_perl_version() { - my ( $rc, $stdout, $stderr, $version ); - my $tool = "perl"; - my ( @ret ) = ( $tool ); - $rc = run( [ $tool, "--version" ], $stdout, $stderr ); - if ( $rc >= 0 ) { - # Typical perl output: - # This is perl, v5.10.0 built for x86_64-linux-thread-multi - # This is perl, v5.8.8 built for MSWin32-x64-multi-thread - # This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi - if ( $stdout !~ m{^This is perl.*v(\d+\.\d+(?:\.\d+)).*built for}m ) { - warning( "Cannot parse perl output:", $stdout, "(oef)" ); - }; # if - $version = $1; - if ( $target_os eq "win" ) { - if ( $stdout !~ m{Binary build (.*) provided by ActiveState } ) { - warning( "Perl is not ActiveState one" ); - }; # if - }; # if - }; # if - push( @ret, $version ); - return @ret; -}; # sub get_perl_version - - -sub get_gnu_make_version() { - my ( $rc, $stdout, $stderr, $version ); - my $tool = "make"; - my ( @ret ) = ( $tool ); - my ( $path ); - $rc = run( [ $tool, "--version" ], $stdout, $stderr, $path ); - if ( $rc >= 0 ) { - # Typical make output: - # GNU Make version 3.79.1, by Richard Stallman and Roland McGrath. - # GNU Make 3.81 - if ( $stdout =~ m{^GNU Make (?:version )?(\d+\.\d+(?:\.\d+)?)(?:,|\s)} ) { - $version = $1; - }; # if - if ( $target_os eq "win" and $stdout =~ m{built for ([a-z0-9-]+)} ) { - my $built_for = $1; - debug( "GNU Make built for: \"$built_for\"." ); - if ( $built_for =~ m{cygwin}i ) { - warning( "\"$path\" is a Cygwin make, it is *not* suitable." ); - return @ret; - }; # if - }; # if - }; # if - push( @ret, $version ); - return @ret; -}; # sub get_gnu_make_version - - -sub get_intel_compiler_version($) { - my ( $tool ) = @_; # Tool name, like "icc", "icpc", "icl", or "ifort". - my ( @ret ) = ( $tool ); - my ( $rc, $stdout, $stderr, $tool_re ); - my $version; - my $ic_archs = { - qr{32-bit|IA-32} => "32", - qr{Intel\(R\) 64} => "32e", - qr{Intel\(R\) [M][I][C] Architecture} => "32e", - }; - $tool_re = quotemeta( $tool ); - $rc = run( [ $tool, ( $target_os eq "win" ? () : ( "-V" ) ) ], $stdout, $stderr ); - if ( $rc < 0 ) { - return @ret; - }; # if - # Intel compiler version string is in the first line of stderr. Get it. - #$stderr =~ m{\A(.*\n?)}; - # AC: Let's look for version string in the first line which contains "Intel" string. - # This allows to use 11.1 and 12.0 compilers on new MAC machines by ignoring - # huge number of warnings issued by old compilers. - $stderr =~ m{^(Intel.*)$}m; - my $vstr = $1; - my ( $apl, $ver, $bld, $pkg ); - if ( 0 ) { - } elsif ( $vstr =~ m{^Intel.*?Compiler\s+(.*?),?\s+Version\s+(.*?)\s+Build\s+(\S+)(?:\s+Package ID: (\S+))?} ) { - # 9.x, 10.x, 11.0. - ( $apl, $ver, $bld, $pkg ) = ( $1, $2, $3, $4 ); - } elsif ( $vstr =~ m{^Intel's (.*?) Compiler,?\s+Version\s+(.*?)\s+Build\s+(\S+)} ) { - # 11.1 - ( $apl, $ver, $bld ) = ( $1, $2, $3 ); - } else { - warning( "Cannot parse ${tool}'s stderr:", $stderr, "(eof)" ); - return @ret; - }; # if - my $ic_arch = get_arch( "Intel compiler", $apl, $ic_archs ); - if ( not defined( $ic_arch ) ) { - return @ret; - }; # if - if ( Platform::canon_arch( $ic_arch ) ne $target_arch and not (Platform::canon_arch($ic_arch) eq "32e" and $target_arch eq "mic" )) { - warning( "Target architecture is $target_arch, $tool for $ic_arch found." ); - return @ret; - }; # if - # Normalize version. - my $stage; - $ver =~ s{\s+}{ }g; - $ver = lc( $ver ); - if ( $ver =~ m{\A(\d+\.\d+(?:\.\d+)?) ([a-z]+)\a}i ) { - ( $version, $stage ) = ( $1, $2 ); - } else { - ( $version, $stage ) = ( $ver, "" ); - }; # if - # Parse package. - if ( defined( $pkg ) ) { - if ( $pkg !~ m{\A[lwm]_[a-z]+_[a-z]_(\d+\.\d+\.\d+)\z}i ) { - warning( "Cannot parse Intel compiler package: $pkg" ); - return @ret; - }; # if - $pkg = $1; - $version = $pkg; - }; # if - push( @ret, "$version " . ( $stage ? "$stage " : "" ) . "($bld) for $ic_arch" ); - # Ok, version of Intel compiler found successfully. Now look at config file. - # Installer of Intel compiler tends to add a path to MS linker into compiler config file. - # It leads to troubles. For example, all the environment set up for MS VS 2005, but Intel - # compiler uses lnker from MS VS 2003 because it is specified in config file. - # To avoid such troubles, make sure: - # ICLCFG/IFORTCFG environment variable exists or - # compiler config file does not exist, or - # compiler config file does not specify linker. - if ( $target_os eq "win" ) { - if ( not exists( $ENV{ uc( $tool . "cfg" ) } ) ) { - # If ICLCFG/IFORTCFG environment varianle exists, everything is ok. - # Otherwise check compiler's config file. - my $path = which( $tool ); - $path =~ s{\.exe\z}{}i; # Drop ".exe" suffix. - $path .= ".cfg"; # And add ".cfg" one. - if ( -f $path ) { - # If no config file exists, it is ok. - # Otherwise analyze its content. - my $bulk = read_file( $path ); - $bulk =~ s{#.*\n}{}g; # Remove comments. - my @options = ( "Qvc", "Qlocation,link," ); - foreach my $opt ( @options ) { - if ( $bulk =~ m{[-/]$opt} ) { - warning( "Compiler config file \"$path\" contains \"-$opt\" option." ); - }; # if - }; # foreach - }; # if - }; # if - }; # if - return @ret; -}; # sub get_intel_compiler_version - - -sub get_gnu_compiler_version($) { - my ( $tool ) = @_; - my ( @ret ) = ( $tool ); - my ( $rc, $stdout, $stderr, $version ); - $rc = run( [ $tool, "--version" ], $stdout, $stderr ); - if ( $rc >= 0 ) { - my ( $ver, $bld ); - if ( $target_os eq "mac" ) { - # i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5367) - # i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5484) - # i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00) - $stdout =~ m{^.*? \(GCC\) (\d+\.\d+\.\d+) \(.*Apple.*?Inc\. build (\d+)\)}m; - ( $ver, $bld ) = ( $1, $2 ); - } else { - if ( 0 ) { - } elsif ( $stdout =~ m{^.*? \(GCC\) (\d+\.\d+\.\d+)(?: (\d+))?}m ) { - # g++ (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-20) - # GNU Fortran (GCC) 4.3.2 20081105 (Red Hat 4.3.2-7) - ( $ver, $bld ) = ( $1, $2 ); - } elsif ( $stdout =~ m{^.*? \(SUSE Linux\) (\d+\.\d+\.\d+)\s+\[.*? (\d+)\]}m ) { - # gcc (SUSE Linux) 4.3.2 [gcc-4_3-branch revision 141291] - ( $ver, $bld ) = ( $1, $2 ); - } elsif ( $stdout =~ m{^.*? \(SUSE Linux\) (\d+\.\d+\.\d+)\s+\d+\s+\[.*? (\d+)\]}m ) { - # gcc (SUSE Linux) 4.7.2 20130108 [gcc-4_7-branch revision 195012] - ( $ver, $bld ) = ( $1, $2 ); - } elsif ( $stdout =~ m{^.*? \((Debian|Ubuntu).*?\) (\d+\.\d+\.\d+)}m ) { - # gcc (Debian 4.7.2-22) 4.7.2 - # Debian support from Sylvestre Ledru - # Thanks! - $ver = $2; - }; # if - }; # if - if ( defined( $ver ) ) { - $version = $ver . ( defined( $bld ) ? " ($bld)" : "" ); - } else { - warning( "Cannot parse GNU compiler version:", $stdout, "(eof)" ); - }; # if - }; # if - push( @ret, $version ); - return @ret; -}; # sub get_gnu_compiler_version - - -sub get_clang_compiler_version($) { - my ( $tool ) = @_; - my ( @ret ) = ( $tool ); - my ( $rc, $stdout, $stderr, $version ); - $rc = run( [ $tool, "--version" ], $stdout, $stderr ); - if ( $rc >= 0 ) { - my ( $ver, $bld ); - if ( $target_os eq "mac" ) { - # Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn) - $stdout =~ m{^.*? (\d+\.\d+) \(.*-(\d+\.\d+\.\d+)\)}m; - ( $ver, $bld ) = ( $1, $2 ); - # For custom clang versions. - if ( not defined($ver) and $stdout =~ m{^.*? (\d+\.\d+)( \((.*)\))?}m ) { - ( $ver, $bld ) = ( $1, $3 ); - } - } else { - if ( 0 ) { - } elsif ( $stdout =~ m{^.*? (\d+\.\d+)( \((.*)\))?}m ) { - # clang version 3.3 (tags/RELEASE_33/final) - ( $ver, $bld ) = ( $1, $3 ); - } - }; # if - if ( defined( $ver ) ) { - $version = $ver . ( defined( $bld ) ? " ($bld)" : "" ); - } else { - warning( "Cannot parse Clang compiler version:", $stdout, "(eof)" ); - }; # if - }; # if - push( @ret, $version ); - return @ret; -}; # sub get_gnu_compiler_version - - -sub get_ms_compiler_version() { - my ( $rc, $stdout, $stderr, $version ); - my $tool = "cl"; - my ( @ret ) = ( $tool ); - my $mc_archs = { - qr{80x86|x86} => "IA-32 architecture", - qr{AMD64|x64} => "Intel(R) 64", - }; - $rc = run( [ $tool ], $stdout, $stderr ); - if ( $rc < 0 ) { - return @ret; - }; # if - if ( $stderr !~ m{^Microsoft .* Compiler Version (.*?) for (.*)\s*$}m ) { - warning( "Cannot parse MS compiler output:", $stderr, "(eof)" ); - return @ret; - }; # if - my ( $ver, $apl ) = ( $1, $2 ); - if ( $ver !~ m{\A\d+(?:\.\d+)+\z} ) { - warning( "Cannot parse MS compiler version: $ver" ); - return @ret; - }; # if - my $mc_arch = get_arch( "MS compiler", $apl, $mc_archs ); - if ( not defined( $mc_arch ) ) { - return @ret; - }; # if - if ( Platform::canon_arch( $mc_arch ) ne $target_arch ) { - warning( "Target architecture is $target_arch, $tool for $mc_arch found" ); - return @ret; - }; # if - $version = "$ver for $target_arch"; - push( @ret, $version ); - return @ret; -}; # sub get_ms_compiler_version - - -sub get_ms_linker_version() { - my ( $rc, $stdout, $stderr, $version ); - my $tool = "link"; - my ( @ret ) = ( $tool ); - my ( $path ); - $rc = run( [ $tool ], $stdout, $stderr, $path ); - if ( $rc < 0 ) { - return @ret; - }; # if - if ( $stdout !~ m{^Microsoft \(R\) Incremental Linker Version (\d+(?:\.\d+)+)\s*$}m ) { - warning( "Cannot parse MS linker output:", $stdout, "(eof)" ); - if ( $stderr =~ m{^link: missing operand} ) { - warning( "Seems \"$path\" is a Unix-like \"link\" program, not MS linker." ); - }; # if - return @ret; - }; # if - $version = ( $1 ); - push( @ret, $version ); - return @ret; -}; # sub get_ms_linker_version - - -# -------------------------------------------------------------------------------------------------- -# "main" program. -# -------------------------------------------------------------------------------------------------- - -my $make; -my $intel = 1; # Check Intel compilers. -my $fortran = 0; # Check for corresponding Fortran compiler, ifort for intel - # gfortran for gnu - # gfortran for clang -my $clang = 0; # Check Clang Compilers. -my $intel_compilers = { - "lin" => { c => "icc", cpp => "icpc", f => "ifort" }, - "mac" => { c => "icc", cpp => "icpc", f => "ifort" }, - "win" => { c => "icl", cpp => undef, f => "ifort" }, -}; -my $gnu_compilers = { - "lin" => { c => "gcc", cpp => "g++", f => "gfortran" }, - "mac" => { c => "gcc", cpp => "g++", f => "gfortran" }, -}; -my $clang_compilers = { - "lin" => { c => "clang", cpp => "clang++" }, - "mac" => { c => "clang", cpp => "clang++" }, -}; - -get_options( - Platform::target_options(), - "intel!" => \$intel, - "fortran" => \$fortran, - "clang" => \$clang, - "make" => \$make, - "pedantic" => \$pedantic, -); - -my @versions; -push( @versions, [ "Perl", get_perl_version() ] ); -push( @versions, [ "GNU Make", get_gnu_make_version() ] ); -if ( $intel ) { - my $ic = $intel_compilers->{ $target_os }; - push( @versions, [ "Intel C Compiler", get_intel_compiler_version( $ic->{ c } ) ] ); - if ( defined( $ic->{ cpp } ) ) { - # If Intel C++ compiler has a name different from C compiler, check it as well. - push( @versions, [ "Intel C++ Compiler", get_intel_compiler_version( $ic->{ cpp } ) ] ); - }; # if - # fortran check must be explicitly specified on command line with --fortran - if ( $fortran ) { - if ( defined( $ic->{ f } ) ) { - push( @versions, [ "Intel Fortran Compiler", get_intel_compiler_version( $ic->{ f } ) ] ); - }; # if - }; -}; # if -if ( $target_os eq "lin" or $target_os eq "mac" ) { - # check for clang/gnu tools because touch-test.c is compiled with them. - if ( $clang or $target_os eq "mac" ) { # OS X* >= 10.9 discarded GNU compilers. - push( @versions, [ "Clang C Compiler", get_clang_compiler_version( $clang_compilers->{ $target_os }->{ c } ) ] ); - push( @versions, [ "Clang C++ Compiler", get_clang_compiler_version( $clang_compilers->{ $target_os }->{ cpp } ) ] ); - } else { - push( @versions, [ "GNU C Compiler", get_gnu_compiler_version( $gnu_compilers->{ $target_os }->{ c } ) ] ); - push( @versions, [ "GNU C++ Compiler", get_gnu_compiler_version( $gnu_compilers->{ $target_os }->{ cpp } ) ] ); - }; - # if intel fortran has been checked then gnu fortran is unnecessary - # also, if user specifies clang as build compiler, then gfortran is assumed fortran compiler - if ( $fortran and not $intel ) { - push( @versions, [ "GNU Fortran Compiler", get_gnu_compiler_version( $gnu_compilers->{ $target_os }->{ f } ) ] ); - }; -}; -if ( $target_os eq "win" ) { - push( @versions, [ "MS C/C++ Compiler", get_ms_compiler_version() ] ); - push( @versions, [ "MS Linker", get_ms_linker_version() ] ); -}; # if - -my $count = 0; -foreach my $item ( @versions ) { - my ( $title, $tool, $version ) = @$item; - if ( not defined( $version ) ) { - $version = "--- N/A ---"; - ++ $count; - }; # if - if ( $make ) { - printf( "%s=%s\n", encode( $tool ), encode( $version ) ); - } else { - printf( "%-25s: %s\n", $title, $version ); - }; # if -}; # foreach - -exit( $count == 0 ? 0 : 1 ); - -__END__ - -=pod - -=head1 NAME - -B<check-tools.pl> -- Check development tools availability and versions. - -=head1 SYNOPSIS - -B<check-tools.pl> I<OPTION>... - -=head1 OPTIONS - -=over - -=item B<--make> - -Produce output suitable for using in makefile: short tool names (e. g. "icc" instead of "Intel C -Compiler"), spaces in version strings replaced with underscores. - -=item Tools selection - -=over - -=item B<-->[B<no->]B<-gnu-fortran> - -Check GNU Fortran compiler. By default, it is not checked. - -=item B<-->[B<no->]B<intel> - -Check Intel C, C++ and Fortran compilers. This is default. - -=back - -=item Platform selection - -=over - -=item B<--architecture=>I<str> - -Specify target architecture. Used in cross-builds, for example when building 32-bit applications on -Intel(R) 64 machine. - -If architecture is not specified explicitly, value of LIBOMP_ARCH environment variable is used. -If LIBOMP_ARCH is not defined, host architecture detected. - -=item B<--os=>I<str> - -Specify target OS name. Used in cross-builds, for example when building Intel(R) Many Integrated Core Architecture applications on -Windows* OS. - -If OS is not specified explicitly, value of LIBOMP_OS environment variable is used. -If LIBOMP_OS is not defined, host OS detected. - -=back - -=back - -=head2 Standard Options - -=over - -=item B<--doc> - -=item B<--manual> - -Print full help message and exit. - -=item B<--help> - -Print short help message and exit. - -=item B<--usage> - -Print very short usage message and exit. - -=item B<--verbose> - -Do print informational messages. - -=item B<--version> - -Print version and exit. - -=item B<--quiet> - -Work quiet, do not print informational messages. - -=back - -=head1 DESCRIPTION - -This script checks availability and versions of development tools. By default, the script checks: -Perl, GNU Make, Intel compilers, GNU C and C++ compilers (Linux* OS and OS X*), -Microsoft C/C++ compiler and linker (Windows* OS). - -The sript prints nice looking table or machine-readable strings. - -=head2 EXIT - -=over - -=item * - -0 -- All programs found. - -=item * - -1 -- Some of tools are not found. - -=back - -=head1 EXAMPLES - - $ check-tools.pl - Perl : 5.8.0 - GNU Make : 3.79.1 - Intel C Compiler : 11.0 (20080930) for 32e - Intel C++ Compiler : 11.0 (20080930) for 32e - Intel Fortran Compiler : 10.1.008 (20070913) for 32e - GNU C Compiler : 3.2.3 (20030502) - GNU C++ Compiler : 3.2.3 (20030502) - - > check-tools.pl --make - perl=5.8.8 - make=3.81 - icl=10.1_(20070913)_for_32e - ifort=10.1_(20070913)_for_32e - cl=14.00.40310.41_for_32e - link=8.00.40310.39 - -=back - -=cut - -# end of file # - diff --git a/openmp/runtime/tools/common.inc b/openmp/runtime/tools/common.inc deleted file mode 100644 index 2e51a694f44..00000000000 --- a/openmp/runtime/tools/common.inc +++ /dev/null @@ -1,109 +0,0 @@ -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -ifndef omp_os - - # Windows sets environment variable OS; for other systems, ask uname - ifeq ($(OS),) - OS:=$(shell uname) - ifeq ($(OS),) - $(error "Cannot detect operating system") - endif - export omp_os=$(OS) - endif - - ifeq ($(OS), Windows_NT) - export omp_os=windows - endif - ifeq ($(OS), Linux) - export omp_os=linux - endif - ifeq ($(OS), FreeBSD) - export omp_os=freebsd - endif - ifeq ($(OS), Darwin) - export omp_os=macos - endif - -endif # !omp_os - -# Compiling for the Intel(R) Many Integrated Core architecture is non-trivial at the next layer -# of script down, but we can make it consistent here. -ifneq "$(filter knf knc knl, $(arch))" "" - # I really do mean this... - # have top-level arch=mic and then mic_arch = flavor of mic - override mic_arch:=$(arch) - override arch:=mic - override mic:=yes -else - ifeq "$(arch)" "mic" - # default flavor of mic is knc - mic_arch?=knc - override mic:=yes - else - override mic:=no - endif -endif - -ifeq (,$(wildcard $(omp_root)/tools/$(omp_os).inc)) - $(error "$(omp_os)" is not supported. Add tools/$(omp_os).inc file with os-specific settings ) -endif - -# detect arch and runtime versions, provide common host-specific definitions -include $(omp_root)/tools/$(omp_os).inc - -ifeq ($(arch),) - $(error Architecture not detected) -endif - -# Setting defaults -mode?=release - -ifeq "$(filter 32 32e 64 mic,$(arch))" "" - compiler?=gcc -else - ifeq "$(omp_os)" "windows" - compiler?=icl - else - compiler?=icc - endif -endif - -ifneq "$(mic)" "no" - ifeq "$(compiler)" "gcc" - $(error Compiling the runtime with gcc is not supported on Intel(R) Many Integrated Core Architecture) - endif - - # Add Intel(R) Many Integrated Core Architecture kind (knf, knc, knl, etc.) - build_args += --mic-arch=$(mic_arch) - - # Check that the binutils for Intel(R) Many Integrated Core Architecture are available - # First we see whether the objdump on the user's path supports the k1om architecture. - hask1om = $(shell if (x86_64-k1om-linux-objdump --help | grep -s k1om); then echo OK; else echo KO; fi) - ifneq "$(hask1om)" "OK" - # Appropriate binutils are not already set up, so try to add them from the default place. - micBinPath = /usr/linux-k1om-4.7/bin - micBinPresent = $(shell if test -d $(micBinPath); then echo OK; else echo KO; fi) - ifneq "$(micBinPresent)" "OK" - # We can't find them in the normal place, so complain. - $(error Compiling for Intel(R) Many Integrated Core Architecture requires that the cross-hosted binutils are available in $(micBinPath).\ -See the Tools tab at http://software.intel.com/mic-developer) - endif - export PATH := $(micBinPath):${PATH} - endif -endif - -# number of parallel build jobs -jobs?=1 - -export BUILD_COMPILER := $(compiler) - - diff --git a/openmp/runtime/tools/expand-vars.pl b/openmp/runtime/tools/expand-vars.pl deleted file mode 100755 index 40a64901300..00000000000 --- a/openmp/runtime/tools/expand-vars.pl +++ /dev/null @@ -1,306 +0,0 @@ -#!/usr/bin/perl - -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -use strict; -use warnings; - -use FindBin; -use lib "$FindBin::Bin/lib"; - -use tools; - -our $VERSION = "0.005"; - -my $name_rexp = qr{[A-Za-z_]+[A-Za-z0-9_]*}; -my $keyword_rexp = qr{if|else|end|omp}; - -sub error($$$) { - my ( $input, $msg, $bulk ) = @_; - my $pos = pos( $$bulk ); - $$bulk =~ m{^(.*?)\G(.*?)$}m or die "Internal error"; - my ( $pre, $post ) = ( $1, $2 ); - my $n = scalar( @{ [ substr( $$bulk, 0, $pos ) =~ m{\n}g ] } ) + 1; - runtime_error( "\"$input\" line $n: $msg:", ">>> " . $pre . "--[HERE]-->" . $post ); -}; # sub error - -sub evaluate($$$\$) { - my ( $expr, $strict, $input, $bulk ) = @_; - my $value; - { # Signal handler will be restored on exit from this block. - # In case of "use strict; use warnings" eval issues warnings to stderr. This direct - # output may confuse user, so we need to catch it and prepend with our info. - local $SIG{ __WARN__ } = sub { die @_; }; - $value = - eval( - "package __EXPAND_VARS__;\n" . - ( $strict ? "use strict; use warnings;\n" : "no strict; no warnings;\n" ) . - $expr - ); - }; - if ( $@ ) { - # Drop location information -- increasing eval number and constant "line 3" - # is useless for the user. - $@ =~ s{ at \(eval \d+\) line \d+}{}g; - $@ =~ s{\s*\z}{}; - error( $input, "Cannot evaluate expression \"\${{$expr}}\": $@", $bulk ); - }; # if - if ( $strict and not defined( $value ) ) { - error( $input, "Substitution value is undefined", $bulk ); - }; # if - return $value; -}; # sub evaluate - -# -# Parse command line. -# - -my ( @defines, $input, $output, $strict ); -get_options( - "D|define=s" => \@defines, - "strict!" => \$strict, -); -if ( @ARGV < 2 ) { - cmdline_error( "Not enough argument" ); -}; # if -if ( @ARGV > 2 ) { - cmdline_error( "Too many argument(s)" ); -}; # if -( $input, $output ) = @ARGV; - -foreach my $define ( @defines ) { - my ( $equal, $name, $value ); - $equal = index( $define, "=" ); - if ( $equal < 0 ) { - $name = $define; - $value = ""; - } else { - $name = substr( $define, 0, $equal ); - $value = substr( $define, $equal + 1 ); - }; # if - if ( $name eq "" ) { - cmdline_error( "Illegal definition: \"$define\": variable name should not be empty." ); - }; # if - if ( $name !~ m{\A$name_rexp\z} ) { - cmdline_error( - "Illegal definition: \"$define\": " . - "variable name should consist of alphanumeric characters." - ); - }; # if - eval( "\$__EXPAND_VARS__::$name = \$value;" ); - if ( $@ ) { - die( "Internal error: $@" ); - }; # if -}; # foreach $define - -# -# Do the work. -# - -my $bulk; - -# Read input file. -$bulk = read_file( $input ); - -# Do the replacements. -$bulk =~ - s{(?:\$($keyword_rexp)|\$($name_rexp)|\${{(.*?)}})} - { - my $value; - if ( defined( $1 ) ) { - # Keyword. Leave it as is. - $value = "\$$1"; - } elsif ( defined( $2 ) ) { - # Variable to expand. - my $name = $2; - $value = eval( "\$__EXPAND_VARS__::$name" ); - if ( $@ ) { - die( "Internal error" ); - }; # if - if ( $strict and not defined( $value ) ) { - error( $input, "Variable \"\$$name\" not defined", \$bulk ); - }; # if - } else { - # Perl code to evaluate. - my $expr = $3; - $value = evaluate( $expr, $strict, $input, $bulk ); - }; # if - $value; - }ges; - -# Process conditionals. -# Dirty patch! Nested conditionals not supported! -# TODO: Implement nested constructs. -$bulk =~ - s{^\$if +([^\n]*) *\n(.*\n)\$else *\n(.*\n)\$end *\n} - { - my ( $expr, $then_part, $else_part ) = ( $1, $2, $3 ); - my $value = evaluate( $expr, $strict, $input, $bulk ); - if ( $value ) { - $value = $then_part; - } else { - $value = $else_part; - }; # if - }gesm; - -# Write output. -write_file( $output, \$bulk ); - -exit( 0 ); - -__END__ - -=pod - -=head1 NAME - -B<expand-vars.pl> -- Simple text preprocessor. - -=head1 SYNOPSIS - -B<expand-vars.pl> I<OPTION>... I<input> I<output> - -=head1 OPTIONS - -=over - -=item B<-D> I<name>[B<=>I<value>] - -=item B<--define=>I<name>[B<=>I<value>] - -Define variable. - -=item B<--strict> - -In strict mode, the script issues error on using undefined variables and executes Perl code -with C<use strict; use warnings;> pragmas. - -=back - -=head2 Standard Options - -=over - -=item B<--doc> - -=item B<--manual> - -Print full help message and exit. - -=item B<--help> - -Print short help message and exit. - -=item B<--usage> - -Print very short usage message and exit. - -=item B<--verbose> - -Do print informational messages. - -=item B<--version> - -Print version and exit. - -=item B<--quiet> - -Work quiet, do not print informational messages. - -=back - -=head1 ARGUMENTS - -=over - -=item I<input> - -Input file name. - -=item I<output> - -Output file name. - -=back - -=head1 DESCRIPTION - -This script reads input file, makes substitutes and writes output file. - -There are two form of substitutes: - -=over - -=item Variables - -Variables are referenced in input file in form: - - $name - -Name of variable should consist of alphanumeric characters (Latin letters, digits, and underscores). -Variables are defined in command line with C<-D> or C<--define> options. - -=item Perl Code - -Perl code is specified in input file in form: - - ${{ ...code... }} - -The code is evaluated, and is replaced with its result. Note: in strict mode, you should declare -variable before use. See examples. - -=back - -=head1 EXAMPLES - -Replace occurrences of C<$year>, C<$month>, and C<$day> in C<input.txt> file with C<2007>, C<09>, C<01> -respectively and write result to C<output.txt> file: - - $ cat input.var - Today is $year-$month-$day. - $ expand-vars.pl -D year=2007 -D month=09 -D day=01 input.var output.txt && cat output.txt - Today is 2007-09-01. - -Using Perl code: - - $ cat input.var - ${{ localtime(); }} - $ expand-vars.pl -D year=2007 -D month=09 -D day=01 input.var output.txt && cat output.txt - Now Tue May 5 20:54:13 2009 - -Using strict mode for catching bugs: - - $ cat input.var - ${{ "year : " . substr( $date, 0, 4 ); }} - $ expand-vars.pl input.var output.txt && cat output.txt - year : - -Oops, why it does not print year? Let us use strict mode: - - $ expand-vars.pl --strict input.var output.txt && cat output.txt - expand-vars.pl: (x) "test.var": Cannot evaluate expression "${{ "year : " . substr( $date, 0, 4 ); }}": Global symbol "$date" requires explicit package name - -Ok, variable is not defined. Let us define it: - - $ expand-vars.pl --strict -D date=20090501 input.var output.txt && cat output.txt - expand-vars.pl: (x) "test.var": Cannot evaluate expression "${{ "year : " . substr( $date, 0, 4 ); }}": Variable "$date" is not imported - -What is wrong? Variable should be declared: - - $ cat input.var - ${{ our $date; "year : " . substr( $date, 0, 4 ); }} - $ expand-vars.pl --strict -D date=20090501 input.var output.txt && cat output.txt - year : 2009 - -=cut - -# end of file # diff --git a/openmp/runtime/tools/extract-objects.pl b/openmp/runtime/tools/extract-objects.pl deleted file mode 100755 index e9eaa3d7494..00000000000 --- a/openmp/runtime/tools/extract-objects.pl +++ /dev/null @@ -1,258 +0,0 @@ -#!/usr/bin/env perl - -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -use strict; -use warnings; - -use File::Glob ":glob"; -use File::Temp; -use Cwd; - -use FindBin; -use lib "$FindBin::Bin/lib"; - -use tools; -use Uname; -use Platform ":vars"; - -our $VERSION = "0.005"; - -# -------------------------------------------------------------------------------------------------- -# Subroutines. -# -------------------------------------------------------------------------------------------------- - -sub windows { - my ( $arch, $output, @args ) = @_; - my %files; - # TODO: Check the archives are of specified architecture. - foreach my $arg ( @args ) { - foreach my $archive ( bsd_glob( $arg ) ) { - info( "Processing \"$archive\"..." ); - my $bulk; - execute( [ "lib.exe", "/nologo", "/list", $archive ], -stdout => \$bulk ); - my @members = split( "\n", $bulk ); - foreach my $member ( @members ) { - my $file = get_file( $member ); - my $path = cat_file( $output, $file ); - if ( exists( $files{ $file } ) ) { - runtime_error( - "Extraction \"$file\" member from \"$archive\" archive failed:", - "\"$file\" member has already been extracted from \"$files{ $file }\" archive" - ); - }; # if - $files{ $file } = $archive; - info( " Writing \"$path\"..." ); - execute( [ "lib.exe", "/nologo", "/extract:" . $member, "/out:" . $path, $archive ] ); - }; # foreach $member - }; # foreach $archive - }; # foreach $arg -}; # sub windows - -sub linux { - my ( $arch, $output, @archives ) = @_; - # TODO: Check the archives are of specified architecture. - my $cwd = Cwd::cwd(); - change_dir( $output ); - foreach my $archive ( @archives ) { - info( "Processing \"$archive\"..." ); - my $path = abs_path( $archive, $cwd ); - execute( [ "ar", "xo", $path ] ); - }; # foreach $archive - change_dir( $cwd ); -}; # sub linux - -my %mac_arch = ( - "32" => "i386", - "32e" => "x86_64" -); - -sub darwin { - my ( $arch, $output, @archives ) = @_; - my $cwd = getcwd(); - change_dir( $output ); - if ( defined( $arch ) ) { - if ( not defined( $mac_arch{ $arch } ) ) { - runtime_error( "Architecture \"$arch\" is not a valid one for OS X*" ); - }; # if - $arch = $mac_arch{ $arch }; - }; # if - foreach my $archive ( @archives ) { - info( "Processing \"$archive\"..." ); - my $path = abs_path( $archive, $cwd ); - my $temp; - # Whether archive is a fat or thin? - my $bulk; - execute( [ "file", $path ], -stdout => \$bulk ); - if ( $bulk =~ m{Mach-O universal binary} ) { - # Archive is fat, extracy thin archive first. - if ( not defined( $arch ) ) { - runtime_error( - "\"$archive\" archive is universal binary, " . - "please specify architecture to work with" - ); - }; # if - ( undef, $temp ) = File::Temp::tempfile(); - execute( [ "libtool", "-static", "-arch_only", $arch, "-o", $temp, $path ] ); - $path = $temp; - }; # if - execute( [ "ar", "xo", $path ] ); # Extract members. - if ( defined( $temp ) ) { # Delete temp file, if any. - del_file( $temp ); - }; # if - }; # foreach $archive - change_dir( $cwd ); -}; # sub darwin - - -# -------------------------------------------------------------------------------------------------- -# Main. -# -------------------------------------------------------------------------------------------------- - -# Parse command line. - -my $output = "."; -my @args; - -get_options( - Platform::target_options(), - "o|output-directory=s" => \$output, -); -@args = @ARGV; - -if ( not -e $output ) { - runtime_error( "Output directory \"$output\" does not exist" ); -}; # if -if ( not -d $output ) { - runtime_error( "\"$output\" is not a directory" ); -}; # if -if ( not -w $output ) { - runtime_error( "Output directory \"$output\" is not writable" ); -}; # if - -if ( $target_os eq "win" ) { - *process = \&windows; -} elsif ( $target_os eq "lin") { - *process = \&linux; -} elsif ( $target_os eq "mac" ) { - *process = \&darwin; -} else { - runtime_error( "OS \"$target_os\" not supported" ); -}; # if - - -# Do the work. -process( $target_arch, $output, @args ); -exit( 0 ); - -__END__ - -=pod - -=head1 NAME - -B<extract-objects.pl> -- Extract all object files from static library. - -=head1 SYNOPSIS - -B<extract-objects.pl> I<option>... I<archive>... - -=head1 OPTIONS - -=over - -=item B<--architecture=>I<arch> - -Specify architecture to work with. The option is mandatory on OS X* in case of universal archive. -In other cases the option should not be used. I<arch> may be one of C<32> or C<32e>. - -=item B<--os=>I<str> - -Specify OS name. By default OS is autodetected. - -Depending on OS, B<extract-objects.pl> uses different external tools for handling static -libraries: F<ar> (in case of "lin" and "mac") or F<lib.exe> (in case of "win"). - -=item B<--output-directory=>I<dir> - -Specify directory to write extracted members to. Current directory is used by default. - -=item B<--help> - -Print short help message and exit. - -=item B<--doc> - -=item B<--manual> - -Print full documentation and exit. - -=item B<--quiet> - -Do not print information messages. - -=item B<--version> - -Print version and exit. - -=back - -=head1 ARGUMENTS - -=over - -=item I<archive> - -A name of archive file (static library). Multiple archives may be specified. - -=back - -=head1 DESCRIPTION - -The script extracts all the members (object files) from archive (static library) to specified -directory. Commands to perform this action differ on different OSes. On Linux* OS, simple command - - ar xo libfile.a - -is enough (in case of extracting files to current directory). - -On OS X*, it is a bit compilicated with universal ("fat") binaries -- C<ar> cannot -operate on fat archives, so "thin" archive should be extracted from the universal binary first. - -On Windows* OS, library manager (C<lib.exe>) can extract only one object file, so operation should be -repeated for every object file in the library. - -B<extract-objects.pl> detects OS automatically. But detection can be overrided with B<--os> option. -It may be helpful in cross-build environments. - -B<extract-objects.pl> effectively encapsulates all these details and provides uniform way for -extracting object files from static libraries, which helps to keep makefiles simple and clean. - -=head1 EXAMPLES - -Extract object files from library F<libirc.lib>, and put them into F<obj/> directory: - - $ extract-objects.pl --output=obj libirc.lib - -Extract object files from library F<libirc.a>. Use Linux* OS tools (F<ar>), even if run on another OS: - - $ extract-objects.pl --os=lin libirc.a - -Extract object files from library F<libirc.a>, if it is a OS X* universal binary, use i386 -architecture. Be quiet: - - $ extract-objects.pl --quiet --arch=i386 libirc.a - -=cut - -# end of file # - diff --git a/openmp/runtime/tools/freebsd.inc b/openmp/runtime/tools/freebsd.inc deleted file mode 100644 index 7b60eec884e..00000000000 --- a/openmp/runtime/tools/freebsd.inc +++ /dev/null @@ -1,12 +0,0 @@ -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -include tools/linux.inc diff --git a/openmp/runtime/tools/linux.inc b/openmp/runtime/tools/linux.inc deleted file mode 100644 index 7ad2512466f..00000000000 --- a/openmp/runtime/tools/linux.inc +++ /dev/null @@ -1,35 +0,0 @@ -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -####### Detections and Commands ############################################### - -ifndef arch - uname_m:=$(shell uname -m) - ifeq ($(uname_m),i686) - export arch:=32 - endif - ifeq ($(uname_m),x86_64) - export arch:=32e - endif - ifndef arch - export arch:=$(uname_m) - endif -endif - -CMD=sh -c -CWD=$(shell pwd) -CP=cp -RM?=rm -f -RMR?=rm -rf -RD?=rmdir -MD?=mkdir -p -NUL= /dev/null -SLASH=/ diff --git a/openmp/runtime/tools/macos.inc b/openmp/runtime/tools/macos.inc deleted file mode 100644 index 38f86b168d9..00000000000 --- a/openmp/runtime/tools/macos.inc +++ /dev/null @@ -1,37 +0,0 @@ -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -####### Detections and Commands ############################################### - -ifndef arch - ifeq ($(shell /usr/sbin/sysctl -n hw.machine),Power Macintosh) - ifeq ($(shell /usr/sbin/sysctl -n hw.optional.64bitops),1) - export arch:=ppc64 - else - export arch:=ppc32 - endif - else - ifeq ($(shell /usr/sbin/sysctl -n hw.optional.x86_64 2>/dev/null),1) - export arch:=intel64 - else - export arch:=ia32 - endif - endif -endif - -CMD=$(SHELL) -c -CWD=$(shell pwd) -RM?=rm -f -RMR?=rm -rf -RD?=rmdir -MD?=mkdir -p -NUL= /dev/null -SLASH=/ diff --git a/openmp/runtime/tools/make-fat-binaries.pl b/openmp/runtime/tools/make-fat-binaries.pl deleted file mode 100755 index b297e31987f..00000000000 --- a/openmp/runtime/tools/make-fat-binaries.pl +++ /dev/null @@ -1,234 +0,0 @@ -#!/usr/bin/env perl - -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -use strict; -use warnings; - -use IO::Dir; - -use FindBin; -use lib "$FindBin::Bin/lib"; - - -use tools; - -our $VERSION = "0.003"; - -# -# Subroutines. -# - -sub check_dir($$) { - - # Make sure a directory is a readable directory. - - my ( $dir, $type ) = @_; - - -e $dir or runtime_error( "Directory \"$dir\" does not exist" ); - -d $dir or runtime_error( "\"$dir\" is not a directory" ); - -r $dir or runtime_error( "Directory \"$dir\" is not readable" ); - -}; # sub check_dir - -sub read_dir($) { - - # Return list of files (not subdirectories) of specified directory. - - my ( $dir ) = @_; - my $handle; - my $entry; - my @files; - - $handle = IO::Dir->new( $dir ) or runtime_error( "Cannot open \"$dir\" directory: $!" ); - while ( $entry = $handle->read() ) { - my $path = "$dir/$entry"; - if ( $entry !~ m{\A\.} and -f $path ) { - push( @files, $entry ); - }; # if - }; # while - $handle->close(); - - @files = sort( @files ); - return @files; - -}; # sub read_dir - -# -------------------------------------------------------------------------------------------------- -# Main program. -# -------------------------------------------------------------------------------------------------- - -# -# Parse command line. -# -my @dirs; # List of input directories. -my @files; # List of files. -my $output; # Output directory. - -get_options( - "output=s" => \$output -); - -@ARGV == 0 and cmdline_error( "No input directories specified" ); - -# -# Check input and output directories. -# - -# Make shure there is no duplicated directories. -my %dirs; -$dirs{ $output } = ""; -foreach my $dir ( @ARGV ) { - if ( exists( $dirs{ $dir } ) ) { - cmdline_error( "Directory \"$dir\" has already been specified" ); - }; # if - $dirs{ $dir } = ""; - push( @dirs, $dir ); -}; # foreach $dir -undef( %dirs ); - -# Make sure all dirs are exist, dirs, and readable. -check_dir( $output, "output" ); -foreach my $dir ( @dirs ) { - check_dir( $dir, "input" ); -}; # foreach $dir - -# All input dirs should contain exactly the same list of files. -my @errors; -@files = read_dir( $dirs[ 0 ] ); -foreach my $dir ( @dirs ) { - my %files = map( ( $_ => 0 ), @files ); - foreach my $file ( read_dir( $dir ) ) { - if ( not exists( $files{ $file } ) ) { - push( @errors, "Extra file: `" . cat_file( $dir, $file ) . "'." ); - }; # if - $files{ $file } = 1; - }; # foreach $file - foreach my $file ( keys( %files ) ) { - if ( $files{ $file } == 0 ) { - push( @errors, "Missed file: `" . cat_file( $dir, $file ) . "'." ); - }; # if - }; # foreach $file -}; # foreach $dir -if ( @errors ) { - runtime_error( @errors ); -}; # if - -# -# Make fat binaries. -# - -foreach my $file ( sort( @files ) ) { - info( "Making \"$file\"..." ); - my $output_file = cat_file( $output, $file ); - del_file( $output_file ); - execute( - [ - "lipo", - "-create", - "-output", $output_file, - map( cat_file( $_, $file ), @dirs ) - ] - ); -}; # foreach $entry - -exit( 0 ); - -__END__ - -=pod - -=head1 NAME - -B<make-fat-binaries.pl> -- Make set of fat (universal) binaries. - -=head1 SYNOPSIS - -B<make-fat-binaries.pl> I<OPTION>... I<INPUT_DIR>... - -=head1 OPTIONS - -=over - -=item B<--output=>I<DIR> - -Name of output directory to place fat binaries to. Directory must exist and be writable. - -=item Standard Options - -=over - -=item B<--doc> - -=item B<--manual> - -Print full help message and exit. - -=item B<--help> - -Print short help message and exit. - -=item B<--usage> - -Print very short usage message and exit. - -=item B<--verbose> - -Do print informational messages. - -=item B<--version> - -Print program version and exit. - -=item B<--quiet> - -Work quiet, do not print informational messages. - -=back - -=back - -=head1 ARGUMENTS - -=over - -=item I<INPUT_DIR> - -Name of input directory to get thin files from. Directory must exist and be readable. At least one -directory required. - -=back - -=head1 DESCRIPTION - -The script creates set of Mac-O fat (universal, multi-architecture) binaries from set of thin -(single-architecture) files. - -The scripts reads files from input directory (or directoriers). It is assumed that one input -directory keeps files for one architecture (e. g. i386), another directory contains files for -another architecture (e. g. x86_64), etc. All input directories must contain the same set of files. -The script issues an error if sets of files in input directories differ. - -If the script finishes successfully, output directory will contain the set universal binaries -built from files with the same name in input directories. - -=head1 EXAMPLES - -Get thin binaries from C<mac_32.thin/> and C<mac_32e.thin/> directories, and put fat binaries to -C<mac.fat/> directory: - - $ make-fat-binaries.pl --output=mac.fat mac_32.thin mac_32e.thin - - -=cut - -# end of file # diff --git a/openmp/runtime/tools/objcopy.cpp b/openmp/runtime/tools/objcopy.cpp deleted file mode 100644 index a2811c6261d..00000000000 --- a/openmp/runtime/tools/objcopy.cpp +++ /dev/null @@ -1,520 +0,0 @@ -/* - */ - - -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.txt for details. -// -//===----------------------------------------------------------------------===// - - -#include <stdlib.h> -#include <iostream> -#include <strstream> -#include <fstream> -#include <string> -#include <set> -#include <map> -#include <vector> -#include <cstring> - -using namespace std; - -typedef std::string string_t; -typedef std::vector< string_t > strings_t; -typedef std::map< string_t, string_t > str_hash_t; -typedef std::pair< string_t, string_t > str_pair_t; -#ifdef _WIN32 - typedef long long int64_t; -#endif - -string_t -shift( strings_t & strs ) { - string_t first = strs.front(); - strs.erase( strs.begin() ); - return first; -} // shift - -string_t -find( - str_hash_t const & hash, - string_t const & key -) { - string_t value; - str_hash_t::const_iterator it = hash.find( key ); - if ( it != hash.end() ) { - value = it->second; - }; // if - return value; -} // find - -void die( string_t const & message ) { - std::cerr << message << std::endl; - exit( 1 ); -} // die - -void stop( string_t const & message ) { - printf( "%s\n", message.c_str() ); - exit( 1 ); -} - -// An entry in the symbol table of a .obj file. -struct symbol_t { - long long name; - unsigned value; - unsigned short section_num; - unsigned short type; - char storage_class; - char nAux; -}; // struct symbol_t - - -class _rstream_t : public std::istrstream { - - private: - - const char * buf; - - protected: - - _rstream_t( pair< const char *, streamsize > p ) - : istrstream( p.first, p.second ), buf( p.first ) - { - } - - ~_rstream_t() { - delete [] buf; - } - -}; // class _rstream_t - -/* A stream encapuslating the content of a file or the content of a string, overriding the - >> operator to read various integer types in binary form, as well as a symbol table - entry. -*/ -class rstream_t : public _rstream_t { -private: - - template< typename type_t > - inline rstream_t & do_read( type_t & x ) { - read( (char*) & x, sizeof( type_t ) ); - return * this; - } - - static pair<const char*, streamsize> getBuf(const char *fileName) { - ifstream raw(fileName,ios::binary | ios::in); - if(!raw.is_open()) - stop("rstream.getBuf: Error opening file"); - raw.seekg(0,ios::end); - streampos fileSize = raw.tellg(); - if(fileSize < 0) - stop("rstream.getBuf: Error reading file"); - char *buf = new char[fileSize]; - raw.seekg(0,ios::beg); - raw.read(buf, fileSize); - return pair<const char*, streamsize>(buf,fileSize); - } -public: - // construct from a string - rstream_t( const char * buf, streamsize size ) : - _rstream_t( pair< const char *, streamsize >( buf, size ) ) - {} - /* construct from a file whole content is fully read once to initialize the content of - this stream - */ - rstream_t( string_t const & fileName ) - : _rstream_t( getBuf( fileName.c_str() ) ) - { - } - - rstream_t & operator >>( int & x ) { - return do_read(x); - } - rstream_t & operator >>(unsigned &x) { - return do_read(x); - } - rstream_t & operator>>(short &x) { - return do_read(x); - } - rstream_t & operator>>(unsigned short &x) { - return do_read(x); - } - rstream_t & operator>>( symbol_t & e ) { - read((char*)&e, 18); - return *this; - } -}; // class rstream_t - -// string table in a .OBJ file -class StringTable { -private: - map<string, unsigned> directory; - size_t length; - char *data; - - // make <directory> from <length> bytes in <data> - void makeDirectory(void) { - unsigned i = 4; - while(i < length) { - string s = string(data + i); - directory.insert(make_pair(s, i)); - i += s.size() + 1; - } - } - // initialize <length> and <data> with contents specified by the arguments - void init(const char *_data) { - unsigned _length = *(unsigned*)_data; - - if(_length < sizeof(unsigned) || _length != *(unsigned*)_data) - stop("StringTable.init: Invalid symbol table"); - if(_data[_length - 1]) { - // to prevent runaway strings, make sure the data ends with a zero - data = new char[length = _length + 1]; - data[_length] = 0; - } else { - data = new char[length = _length]; - } - *(unsigned*)data = length; - memcpy( data + sizeof(unsigned), _data + sizeof(unsigned), length - sizeof(unsigned) ); - makeDirectory(); - } -public: - StringTable( rstream_t & f ) { - /* Construct string table by reading from f. - */ - streampos s; - unsigned strSize; - char *strData; - - s = f.tellg(); - f>>strSize; - if(strSize < sizeof(unsigned)) - stop("StringTable: Invalid string table"); - strData = new char[strSize]; - *(unsigned*)strData = strSize; - // read the raw data into <strData> - f.read(strData + sizeof(unsigned), strSize - sizeof(unsigned)); - s = f.tellg() - s; - if(s < strSize) - stop("StringTable: Unexpected EOF"); - init(strData); - delete[]strData; - } - StringTable(const set<string> &strings) { - /* Construct string table from given strings. - */ - char *p; - set<string>::const_iterator it; - size_t s; - - // count required size for data - for(length = sizeof(unsigned), it = strings.begin(); it != strings.end(); ++it) { - size_t l = (*it).size(); - - if(l > (unsigned) 0xFFFFFFFF) - stop("StringTable: String too long"); - if(l > 8) { - length += l + 1; - if(length > (unsigned) 0xFFFFFFFF) - stop("StringTable: Symbol table too long"); - } - } - data = new char[length]; - *(unsigned*)data = length; - // populate data and directory - for(p = data + sizeof(unsigned), it = strings.begin(); it != strings.end(); ++it) { - const string &str = *it; - size_t l = str.size(); - if(l > 8) { - directory.insert(make_pair(str, p - data)); - memcpy(p, str.c_str(), l); - p[l] = 0; - p += l + 1; - } - } - } - ~StringTable() { - delete[] data; - } - /* Returns encoding for given string based on this string table. - Error if string length is greater than 8 but string is not in - the string table--returns 0. - */ - int64_t encode(const string &str) { - int64_t r; - - if(str.size() <= 8) { - // encoded directly - ((char*)&r)[7] = 0; - strncpy((char*)&r, str.c_str(), 8); - return r; - } else { - // represented as index into table - map<string,unsigned>::const_iterator it = directory.find(str); - if(it == directory.end()) - stop("StringTable::encode: String now found in string table"); - ((unsigned*)&r)[0] = 0; - ((unsigned*)&r)[1] = (*it).second; - return r; - } - } - /* Returns string represented by x based on this string table. - Error if x references an invalid position in the table--returns - the empty string. - */ - string decode(int64_t x) const { - if(*(unsigned*)&x == 0) { - // represented as index into table - unsigned &p = ((unsigned*)&x)[1]; - if(p >= length) - stop("StringTable::decode: Invalid string table lookup"); - return string(data + p); - } else { - // encoded directly - char *p = (char*)&x; - int i; - - for(i = 0; i < 8 && p[i]; ++i); - return string(p, i); - } - } - void write(ostream &os) { - os.write(data, length); - } -}; - - -void -obj_copy( - string_t const & src, // Name of source file. - string_t const & dst, // Name of destination file. - str_hash_t const & redefs // List of redefinititions. -) { - - set< string > strings; // set of all occurring symbols, appropriately prefixed - streampos fileSize; - size_t strTabStart; - unsigned symTabStart; - unsigned symNEntries; - int i; - - - string const error_reading = "Error reading \"" + src + "\" file: "; - - rstream_t in( src ); - - in.seekg( 0, ios::end ); - fileSize = in.tellg(); - - in.seekg( 8 ); - in >> symTabStart >> symNEntries; - strTabStart = symTabStart + 18 * size_t( symNEntries ); - in.seekg( strTabStart ); - if ( in.eof() ) { - stop( error_reading + "Unexpected end of file" ); - } - StringTable stringTableOld( in ); // Read original string table. - - if ( in.tellg() != fileSize ) { - stop( error_reading + "Unexpected data after string table" ); - } - - // compute set of occurring strings with prefix added - for ( i = 0; i < symNEntries; ++ i ) { - - symbol_t e; - - in.seekg( symTabStart + i * 18 ); - if ( in.eof() ) { - stop("hideSymbols: Unexpected EOF"); - } - in >> e; - if ( in.fail() ) { - stop("hideSymbols: File read error"); - } - if ( e.nAux ) { - i += e.nAux; - } - const string & s = stringTableOld.decode( e.name ); - // if symbol is extern and found in <hide>, prefix and insert into strings, - // otherwise, just insert into strings without prefix - string_t name = find( redefs, s ); - strings.insert( name != "" && e.storage_class == 2 ? name : s ); - } - - ofstream out( dst.c_str(), ios::trunc | ios::out | ios::binary ); - if ( ! out.is_open() ) { - stop("hideSymbols: Error opening output file"); - } - - // make new string table from string set - StringTable stringTableNew = StringTable( strings ); - - // copy input file to output file up to just before the symbol table - in.seekg( 0 ); - char * buf = new char[ symTabStart ]; - in.read( buf, symTabStart ); - out.write( buf, symTabStart ); - delete [] buf; - - // copy input symbol table to output symbol table with name translation - for ( i = 0; i < symNEntries; ++ i ) { - symbol_t e; - - in.seekg( symTabStart + i * 18 ); - if ( in.eof() ) { - stop("hideSymbols: Unexpected EOF"); - } - in >> e; - if ( in.fail() ) { - stop("hideSymbols: File read error"); - } - const string & s = stringTableOld.decode( e.name ); - out.seekp( symTabStart + i * 18 ); - string_t name = find( redefs, s ); - e.name = stringTableNew.encode( ( e.storage_class == 2 && name != "" ) ? name : s ); - out.write( (char*) & e, 18 ); - if ( out.fail() ) { - stop( "hideSymbols: File write error" ); - } - if ( e.nAux ) { - // copy auxiliary symbol table entries - int nAux = e.nAux; - for (int j = 1; j <= nAux; ++j ) { - in >> e; - out.seekp( symTabStart + ( i + j ) * 18 ); - out.write( (char*) & e, 18 ); - } - i += nAux; - } - } - // output string table - stringTableNew.write( out ); -} - - -void -split( string_t const & str, char ch, string_t & head, string_t & tail ) { - string_t::size_type pos = str.find( ch ); - if ( pos == string_t::npos ) { - head = str; - tail = ""; - } else { - head = str.substr( 0, pos ); - tail = str.substr( pos + 1 ); - }; // if -} // split - - -void help() { - std::cout - << "NAME\n" - << " objcopy -- copy and translate object files\n" - << "\n" - << "SYNOPSIS\n" - << " objcopy options... source destination\n" - << "\n" - << "OPTIONS\n" - << " --help Print this help and exit.\n" - << " --redefine-sym old=new\n" - << " Rename \"old\" symbol in source object file to \"new\" symbol in\n" - << " destination object file.\n" - << " --redefine-syms sym_file\n" - << " For each pair \"old new\" in sym_file rename \"old\" symbol in \n" - << " source object file to \"new\" symbol in destination object file.\n" - << "\n" - << "ARGUMENTS\n" - << " source The name of source object file.\n" - << " destination\n" - << " The name of destination object file.\n" - << "\n" - << "DESCRIPTION\n" - << " This program implements a minor bit of Linux* OS's objcopy utility on Windows* OS.\n" - << " It can copy object files and edit its symbol table.\n" - << "\n" - << "EXAMPLES\n" - << " \n" - << " > objcopy --redefine-sym fastcpy=__xxx_fastcpy a.obj b.obj\n" - << "\n"; -} // help - - -int -main( int argc, char const * argv[] ) { - - strings_t args( argc - 1 ); - str_hash_t redefs; - strings_t files; - - std::copy( argv + 1, argv + argc, args.begin() ); - - while ( args.size() > 0 ) { - string_t arg = shift( args ); - if ( arg.substr( 0, 2 ) == "--" ) { - // An option. - if ( 0 ) { - } else if ( arg == "--help" ) { - help(); - return 0; - } else if ( arg == "--redefine-sym" ) { - if ( args.size() == 0 ) { - die( "\"" + arg + "\" option requires an argument" ); - }; // if - // read list of symbol pairs "old new" from command line. - string_t redef = shift( args ); - string_t old_sym; - string_t new_sym; - split( redef, '=', old_sym, new_sym ); - if ( old_sym.length() == 0 || new_sym.length() == 0 ) { - die( "Illegal redefinition: \"" + redef + "\"; neither old symbol nor new symbol may be empty" ); - }; // if - redefs.insert( str_pair_t( old_sym, new_sym ) ); - } else if ( arg == "--redefine-syms" ) { - if ( args.size() == 0 ) { - die( "\"" + arg + "\" option requires an argument" ); - }; // if - // read list of symbol pairs "old new" from file. - string_t fname = shift( args ); - string_t redef; - ifstream ifs( fname.c_str() ); - while ( ifs.good() ) { - getline( ifs, redef );// get pair of old/new symbols separated by space - string_t old_sym; - string_t new_sym; - // AC: gcount() does not work here (always return 0), so comment it - //if ( ifs.gcount() ) { // skip empty lines - split( redef, ' ', old_sym, new_sym ); - if ( old_sym.length() == 0 || new_sym.length() == 0 ) { - break; // end of file reached (last empty line) - //die( "Illegal redefinition: \"" + redef + "\"; neither old symbol nor new symbol may be empty" ); - }; // if - redefs.insert( str_pair_t( old_sym, new_sym ) ); - //} - } - } else { - die( "Illegal option: \"" + arg + "\"" ); - }; // if - } else { - // Not an option, a file name. - if ( files.size() >= 2 ) { - die( "Too many files specified; two files required (use --help option for help)" ); - }; // if - files.push_back( arg ); - }; // if - }; // while - if ( files.size() < 2 ) { - die( "Not enough files specified; two files required (use --help option for help)" ); - }; // if - - obj_copy( files[ 0 ], files[ 1 ], redefs ); - - return 0; - -} // main - - -// end of file // diff --git a/openmp/runtime/tools/required-objects.pl b/openmp/runtime/tools/required-objects.pl deleted file mode 100755 index 6102a62c76f..00000000000 --- a/openmp/runtime/tools/required-objects.pl +++ /dev/null @@ -1,642 +0,0 @@ -#!/usr/bin/perl - -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -use strict; -use warnings; - -use File::Glob ":glob"; -use Data::Dumper; - -use FindBin; -use lib "$FindBin::Bin/lib"; - -use tools; -use Platform ":vars"; - -our $VERSION = "0.004"; - -# -------------------------------------------------------------------------------------------------- -# Set of objects: # Ref to hash, keys are names of objects. -# object0: # Ref to hash of two elements with keys "defined" and "undefined". -# defined: # Ref to array of symbols defined in object0. -# - symbol0 # Symbol name. -# - ... -# undefined: # Ref to array of symbols referenced in object0. -# - symbol0 -# - ... -# object1: -# ... -# ... -# -------------------------------------------------------------------------------------------------- - -# -------------------------------------------------------------------------------------------------- -# Set of symbols: # Ref to hash, keys are names of symbols. -# symbol0: # Ref to array of object names where the symbol0 is defined. -# - object0 # Object file name. -# - ... -# symbol1: -# ... -# ... -# -------------------------------------------------------------------------------------------------- - -sub dump_objects($$$) { - - my ( $title, $objects, $dump ) = @_; - - if ( $dump > 0 ) { - STDERR->print( $title, "\n" ); - foreach my $object ( sort( keys( %$objects ) ) ) { - STDERR->print( " $object\n" ); - if ( $dump > 1 ) { - STDERR->print( " Defined symbols:\n" ); - foreach my $symbol ( sort( @{ $objects->{ $object }->{ defined } } ) ) { - STDERR->print( " $symbol\n" ); - }; # foreach $symbol - STDERR->print( " Undefined symbols:\n" ); - foreach my $symbol ( sort( @{ $objects->{ $object }->{ undefined } } ) ) { - STDERR->print( " $symbol\n" ); - }; # foreach $symbol - }; # if - }; # foreach $object - }; # if - -}; # sub dump_objects - -sub dump_symbols($$$) { - - my ( $title, $symbols, $dump ) = @_; - - if ( $dump > 0 ) { - STDERR->print( $title, "\n" ); - foreach my $symbol ( sort( keys( %$symbols ) ) ) { - STDERR->print( " $symbol\n" ); - if ( $dump > 1 ) { - foreach my $object ( sort( @{ $symbols->{ $symbol } } ) ) { - STDERR->print( " $object\n" ); - }; # foreach - }; # if - }; # foreach $object - }; # if - -}; # sub dump_symbols - -# -------------------------------------------------------------------------------------------------- -# Name: -# load_symbols -- Fulfill objects data structure with symbol names. -# Synopsis: -# load_symbols( $objects ); -# Arguments: -# $objects (in/out) -- Set of objects. On enter, it is expected that top-level hash has filled -# with object names only. On exit, it is completely fulfilled with lists of symbols -# defined or referenced in each object file. -# Returns: -# Nothing. -# Example: -# my $objects = { foo.o => {} }; -# load_symbols( $objects ); -# # Now $objects is { goo.o => { defined => [ ... ], undefined => [ ... ] } }. -# -# -------------------------------------------------------------------------------------------------- -# This version of load_symbols parses output of nm command and works on Linux* OS and OS X*. -# -sub _load_symbols_nm($) { - - my $objects = shift( @_ ); - # It is a ref to hash. Keys are object names, values are empty hashes (for now). - my @bulk; - - if ( %$objects ) { - # Do not run nm if a set of objects is empty -- nm will try to open a.out in this case. - my $tool; - if($target_arch eq "mic") { - $tool = "x86_64-k1om-linux-nm" - } else { - $tool = "nm" - } - execute( - [ - $tool, - "-g", # Display only external (global) symbols. - "-o", # Precede each symbol by the name of the input file. - keys( %$objects ) - # Running nm once (rather than once per object) improves performance - # drastically. - ], - -stdout => \@bulk - ); - }; # if - - foreach my $line ( @bulk ) { - if ( $line !~ m{^(.*):(?: ?[0-9a-f]*| *) ([A-Za-z]) (.*)$} ) { - die "Cannot parse nm output, line:\n $line\n"; - }; # if - my ( $file, $tag, $symbol ) = ( $1, $2, $3 ); - if ( not exists( $objects->{ $file } ) ) { - die "nm reported unknown object file:\n $line\n"; - }; # if - # AC: exclude some libc symbols from renaming, otherwise we have problems - # in tests for gfortran + static libomp on Lin_32. - # These symbols came from libtbbmalloc.a - if ( $target_os eq "lin" ) { - if ( $symbol =~ m{__i686} ) { - next; - } - } - # AC: added "w" to tags of undefined symbols, e.g. malloc is weak in libirc v12.1. - if ( $tag eq "U" or $tag eq "w" ) { # Symbol not defined. - push( @{ $objects->{ $file }->{ undefined } }, $symbol ); - } else { # Symbol defined. - push( @{ $objects->{ $file }->{ defined } }, $symbol ); - }; # if - }; # foreach - - return undef; - -}; # sub _load_symbols_nm - -# -------------------------------------------------------------------------------------------------- -# This version of load_symbols parses output of link command and works on Windows* OS. -# -sub _load_symbols_link($) { - - my $objects = shift( @_ ); - # It is a ref to hash. Keys are object names, values are empty hashes (for now). - my @bulk; - - if ( %$objects ) { - # Do not run nm if a set of objects is empty -- nm will try to open a.out in this case. - execute( - [ - "link", - "/dump", - "/symbols", - keys( %$objects ) - # Running nm once (rather than once per object) improves performance - # drastically. - ], - -stdout => \@bulk - ); - }; # if - - my $num_re = qr{[0-9A-F]{3,4}}; - my $addr_re = qr{[0-9A-F]{8}}; - my $tag_re = qr{DEBUG|ABS|UNDEF|SECT[0-9A-F]+}; - my $class_re = qr{Static|External|Filename|Label|BeginFunction|EndFunction|WeakExternal|\.bf or\.ef}; - - my $file; - foreach my $line ( @bulk ) { - if ( $line =~ m{\ADump of file (.*?)\n\z} ) { - $file = $1; - if ( not exists( $objects->{ $file } ) ) { - die "link reported unknown object file:\n $line\n"; - }; # if - } elsif ( $line =~ m{\A$num_re } ) { - if ( not defined( $file ) ) { - die "link reported symbol of unknown object file:\n $line\n"; - }; # if - if ( $line !~ m{\A$num_re $addr_re ($tag_re)\s+notype(?: \(\))?\s+($class_re)\s+\| (.*?)\n\z} ) { - die "Cannot parse link output, line:\n $line\n"; - }; # if - my ( $tag, $class, $symbol ) = ( $1, $2, $3 ); - # link.exe /dump sometimes prints comments for symbols, e. g.: - # ".?0_memcopyA ([Entry] ?0_memcopyA)", or "??_C@_01A@r?$AA@ (`string')". - # Strip these comments. - $symbol =~ s{ \(.*\)\z}{}; - if ( $class eq "External" ) { - if ( $tag eq "UNDEF" ) { # Symbol not defined. - push( @{ $objects->{ $file }->{ undefined } }, $symbol ); - } else { # Symbol defined. - push( @{ $objects->{ $file }->{ defined } }, $symbol ); - }; # if - }; # if - } else { - # Ignore all other lines. - }; # if - }; # foreach - - return undef; - -}; # sub _load_symbols_link - -# -------------------------------------------------------------------------------------------------- -# Name: -# symbols -- Construct set of symbols with specified tag in the specified set of objects. -# Synopsis: -# my $symbols = defined_symbols( $objects, $tag ); -# Arguments: -# $objects (in) -- Set of objects. -# $tag (in) -- A tag, "defined" or "undefined". -# Returns: -# Set of symbols with the specified tag. -# -sub symbols($$) { - - my $objects = shift( @_ ); - my $tag = shift( @_ ); - - my $symbols = {}; - - foreach my $object ( keys( %$objects ) ) { - foreach my $symbol ( @{ $objects->{ $object }->{ $tag } } ) { - push( @{ $symbols->{ $symbol } }, $object ); - }; # foreach $symbol - }; # foreach $object - - return $symbols; - -}; # sub symbols - -sub defined_symbols($) { - - my $objects = shift( @_ ); - my $defined = symbols( $objects, "defined" ); - return $defined; - -}; # sub defined_symbols - -sub undefined_symbols($) { - - my $objects = shift( @_ ); - my $defined = symbols( $objects, "defined" ); - my $undefined = symbols( $objects, "undefined" ); - foreach my $symbol ( keys( %$defined ) ) { - delete( $undefined->{ $symbol } ); - }; # foreach symbol - return $undefined; - -}; # sub undefined_symbols - -# -------------------------------------------------------------------------------------------------- -# Name: -# _required_extra_objects -- Select a subset of extra objects required to resolve undefined -# symbols in a set of objects. It is a helper sub for required_extra_objects(). -# Synopsis: -# my $required = _required_extra_objects( $objects, $extra, $symbols ); -# Arguments: -# $objects (in) -- A set of objects to be searched for undefined symbols. -# $extra (in) -- A set of extra objects to be searched for defined symbols to resolve undefined -# symbols in objects. -# $symbols (in/out) -- Set of symbols defined in the set of external objects. At the first call -# it should consist of all the symbols defined in all the extra objects. Symbols defined in -# the selected subset of extra objects are removed from set of defined symbols, because -# they are out of interest for subsequent calls. -# Returns: -# A subset of extra objects required by the specified set of objects. -# -sub _required_extra_objects($$$$) { - - my $objects = shift( @_ ); - my $extra = shift( @_ ); - my $symbols = shift( @_ ); - my $dump = shift( @_ ); - - my $required = {}; - - if ( $dump > 0 ) { - STDERR->print( "Required extra objects:\n" ); - }; # if - foreach my $object ( keys( %$objects ) ) { - foreach my $symbol ( @{ $objects->{ $object }->{ undefined } } ) { - if ( exists( $symbols->{ $symbol } ) ) { - # Add all objects where the symbol is defined to the required objects. - foreach my $req_obj ( @{ $symbols->{ $symbol } } ) { - if ( $dump > 0 ) { - STDERR->print( " $req_obj\n" ); - if ( $dump > 1 ) { - STDERR->print( " by $object\n" ); - STDERR->print( " due to $symbol\n" ); - }; # if - }; # if - $required->{ $req_obj } = $extra->{ $req_obj }; - }; # foreach $req_obj - # Delete the symbol from list of defined symbols. - delete( $symbols->{ $symbol } ); - }; # if - }; # foreach $symbol - }; # foreach $object - - return $required; - -}; # sub _required_extra_objects - - -# -------------------------------------------------------------------------------------------------- -# Name: -# required_extra_objects -- Select a subset of extra objects required to resolve undefined -# symbols in a set of base objects and selected extra objects. -# Synopsis: -# my $required = required_extra_objects( $base, $extra ); -# Arguments: -# $base (in/out) -- A set of base objects to be searched for undefined symbols. On enter, it is -# expected that top-level hash has filled with object names only. On exit, it is completely -# fulfilled with lists of symbols defined and/or referenced in each object file. -# $extra (in/out) -- A set of extra objects to be searched for defined symbols required to -# resolve undefined symbols in a set of base objects. Usage is similar to base objects. -# Returns: -# A subset of extra object files. -# -sub required_extra_objects($$$) { - - my $base = shift( @_ ); - my $extra = shift( @_ ); - my $dump = shift( @_ ); - - # Load symbols for each object. - load_symbols( $base ); - load_symbols( $extra ); - if ( $dump ) { - dump_objects( "Base objects:", $base, $dump ); - dump_objects( "Extra objects:", $extra, $dump ); - }; # if - - # Collect symbols defined in extra objects. - my $symbols = defined_symbols( $extra ); - - my $required = {}; - # Select extra objects required by base objects. - my $delta = _required_extra_objects( $base, $extra, $symbols, $dump ); - while ( %$delta ) { - %$required = ( %$required, %$delta ); - # Probably, just selected objects require some more objects. - $delta = _required_extra_objects( $delta, $extra, $symbols, $dump ); - }; # while - - if ( $dump ) { - my $base_undefined = undefined_symbols( $base ); - my $req_undefined = undefined_symbols( $required ); - dump_symbols( "Symbols undefined in base objects:", $base_undefined, $dump ); - dump_symbols( "Symbols undefined in required objects:", $req_undefined, $dump ); - }; # if - - return $required; - -}; # sub required_extra_objects - - -# -------------------------------------------------------------------------------------------------- -# Name: -# copy_objects -- Copy (and optionally edit) object files to specified directory. -# Synopsis: -# copy_objects( $objects, $target, $prefix, @symbols ); -# Arguments: -# $objects (in) -- A set of object files. -# $target (in) -- A name of target directory. Directory must exist. -# $prefix (in) -- A prefix to add to all the symbols listed in @symbols. If prefix is undefined, -# object files are just copied. -# @symbols (in) -- List of symbol names to be renamed. -# Returns: -# None. -# -sub copy_objects($$;$\@) { - - my $objects = shift( @_ ); - my $target = shift( @_ ); - my $prefix = shift( @_ ); - my $symbols = shift( @_ ); - my $tool; - my @redefine; - my @redefine_; - my $syms_file = "__kmp_sym_pairs.log"; - - if ( $target_arch eq "mic" ) { - $tool = "x86_64-k1om-linux-objcopy" - } else { - $tool = "objcopy" - } - - if ( not -e $target ) { - die "\"$target\" directory does not exist\n"; - }; # if - if ( not -d $target ) { - die "\"$target\" is not a directory\n"; - }; # if - - if ( defined( $prefix ) and @$symbols ) { - my %a = map ( ( "$_ $prefix$_" => 1 ), @$symbols ); - @redefine_ = keys( %a ); - }; # if - foreach my $line ( @redefine_ ) { - $line =~ s{$prefix(\W+)}{$1$prefix}; - push( @redefine, $line ); - } - write_file( $syms_file, \@redefine ); - foreach my $src ( sort( keys( %$objects ) ) ) { - my $dst = cat_file( $target, get_file( $src ) ); - if ( @redefine ) { - execute( [ $tool, "--redefine-syms", $syms_file, $src, $dst ] ); - } else { - copy_file( $src, $dst, -overwrite => 1 ); - }; # if - }; # foreach $object - -}; # sub copy_objects - - -# -------------------------------------------------------------------------------------------------- -# Main. -# -------------------------------------------------------------------------------------------------- - -my $base = {}; -my $extra = {}; -my $switcher = $base; -my $dump = 0; -my $print_base; -my $print_extra; -my $copy_base; -my $copy_extra; -my $prefix; - -# Parse command line. - -Getopt::Long::Configure( "permute" ); -get_options( - Platform::target_options(), - "base" => sub { $switcher = $base; }, - "extra" => sub { $switcher = $extra; }, - "print-base" => \$print_base, - "print-extra" => \$print_extra, - "print-all" => sub { $print_base = 1; $print_extra = 1; }, - "copy-base=s" => \$copy_base, - "copy-extra=s" => \$copy_extra, - "copy-all=s" => sub { $copy_base = $_[ 1 ]; $copy_extra = $_[ 1 ]; }, - "dump" => sub { ++ $dump; }, - "prefix=s" => \$prefix, - "<>" => - sub { - my $arg = $_[ 0 ]; - my @args; - if ( $^O eq "MSWin32" ) { - # Windows* OS does not expand wildcards. Do it... - @args = bsd_glob( $arg ); - } else { - @args = ( $arg ); - }; # if - foreach my $object ( @args ) { - if ( exists( $base->{ $object } ) or exists( $extra->{ $object } ) ) { - die "Object \"$object\" has already been specified.\n"; - }; # if - $switcher->{ $object } = { defined => [], undefined => [] }; - }; # foreach - }, -); -if ( not %$base ) { - cmdline_error( "No base objects specified" ); -}; # if - -if ( $target_os eq "win" ) { - *load_symbols = \&_load_symbols_link; -} elsif ( $target_os eq "lin" ) { - *load_symbols = \&_load_symbols_nm; -} elsif ( $target_os eq "mac" ) { - *load_symbols = \&_load_symbols_nm; -} else { - runtime_error( "OS \"$target_os\" not supported" ); -}; # if - -# Do the work. - -my $required = required_extra_objects( $base, $extra, $dump ); -if ( $print_base ) { - print( map( "$_\n", sort( keys( %$base ) ) ) ); -}; # if -if ( $print_extra ) { - print( map( "$_\n", sort( keys( %$required ) ) ) ); -}; # if -my @symbols; -if ( defined( $prefix ) ) { - foreach my $object ( sort( keys( %$required ) ) ) { - push( @symbols, @{ $required->{ $object }->{ defined } } ); - }; # foreach $objects -}; # if -if ( $copy_base ) { - copy_objects( $base, $copy_base, $prefix, @symbols ); -}; # if -if ( $copy_extra ) { - copy_objects( $required, $copy_extra, $prefix, @symbols ); -}; # if - -exit( 0 ); - -__END__ - -=pod - -=head1 NAME - -B<required-objects.pl> -- Select a required extra object files. - -=head1 SYNOPSIS - -B<required-objects.pl> I<option>... [--base] I<file>... --extra I<file>... - -=head1 DESCRIPTION - -B<required-objects.pl> works with two sets of object files -- a set of I<base> objects -and a set of I<extra> objects, and selects those extra objects which are required for resolving -undefined symbols in base objects I<and> selected extra objects. - -Selected object files may be copied to specified location or their names may be printed to stdout, -a name per line. Additionally, symbols defined in selected extra objects may be renamed. - -Depending on OS, different external tools may be used. For example, B<required-objects.pl> uses -F<link.exe> on "win" and F<nm> on "lin" and "mac" OSes. Normally OS is autodetected, but -detection can be overrided with B<--os> option. It may be helpful in cross-build environments. - -=head1 OPTIONS - -=over - -=item B<--base> - -The list of base objects follows this option. - -=item B<--extra> - -List of extra objects follows this option. - -=item B<--print-all> - -Print list of base objects and list of required extra objects. - -=item B<--print-base> - -Print list of base objects. - -=item B<--print-extra> - -Print list of selected extra objects. - -=item B<--copy-all=>I<dir> - -Copy all base and selected extra objects to specified directory. The directory must exist. Existing -files are overwritten. - -=item B<--copy-base=>I<dir> - -Copy all base objects to specified directory. - -=item B<--copy-extra=>I<dir> - -Copy selected extra objects to specified directory. - -=item B<--prefix=>I<str> - -If prefix is specified, copied object files are edited -- symbols defined in selected extra -object files are renamed (in all the copied object files) by adding this prefix. - -F<objcopy> program should be available for performing this operation. - -=item B<--os=>I<str> - -Specify OS name. By default OS is autodetected. - -Depending on OS, B<required-objects.pl> uses different external tools. - -=item B<--help> - -Print short help message and exit. - -=item B<--doc> - -=item B<--manual> - -Print full documentation and exit. - -=item B<--version> - -Print version and exit. - -=back - -=head1 ARGUMENTS - -=over - -=item I<file> - -A name of object file. - -=back - -=head1 EXAMPLES - - $ required-objects.pl --base obj/*.o --extra ../lib/obj/*.o --print-extra > required.lst - $ ar cr libx.a obj/*.o $(cat required.lst) - - $ required-objects.pl --base internal/*.o --extra external/*.o --prefix=__xyz_ --copy-all=obj - $ ar cr xyz.a obj/*.o - -=cut - -# end of file # - diff --git a/openmp/runtime/tools/src/common-checks.mk b/openmp/runtime/tools/src/common-checks.mk deleted file mode 100644 index 250eaed1903..00000000000 --- a/openmp/runtime/tools/src/common-checks.mk +++ /dev/null @@ -1,95 +0,0 @@ -# common-checks.mk # - -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -# -------------------------------------------------------------------------------------------------- -# This file contains really common definitions used by multiple makefiles. Modify it carefully! -# -------------------------------------------------------------------------------------------------- - -# -# Check tools versions. -# -ifeq "$(clean)" "" # Do not check tools if clean goal specified. - - check_tools_flags = --make - - # determine if fortran check is required from goals - # MAKECMDGOALS is like argv for gnu make - ifneq "$(filter mod all,$(MAKECMDGOALS))" "" - check_tools_flags += --fortran - else - ifeq "$(MAKECMDGOALS)" "" # will default to all if no goals specified on command line - check_tools_flags += --fortran - endif - endif - ifneq "$(filter gcc clang,$(c))" "" # if build compiler is gcc or clang - check_tools_flags += --nointel - endif - ifeq "$(c)" "clang" - check_tools_flags += --clang - endif - - curr_tools := $(strip $(shell $(perl) $(tools_dir)check-tools.pl $(oa-opts) $(check_tools_flags))) - - ifeq "$(curr_tools)" "" - $(error check-tools.pl failed) - endif - ifneq "$(findstring N/A,$(curr_tools))" "" - missed_tools := $(filter %---_N/A_---,$(curr_tools)) - missed_tools := $(subst =---_N/A_---,,$(missed_tools)) - missed_tools := $(subst $(space),$(comma)$(space),$(missed_tools)) - $(error Development tools not found: $(missed_tools)) - endif - prev_tools := $(strip $(shell [ -e tools.cfg ] && cat tools.cfg)) - $(call say,Tools : $(curr_tools)) - ifeq "$(prev_tools)" "" - # No saved config file, let us create it. - dummy := $(shell echo "$(curr_tools)" > tools.cfg) - else - # Check the saved config file matches current configuration. - ifneq "$(curr_tools)" "$(prev_tools)" - # Show the differtence between previous and current tools. - $(call say,Old tools : $(filter-out $(curr_tools),$(prev_tools))) - $(call say,New tools : $(filter-out $(prev_tools),$(curr_tools))) - # And initiate rebuild. - $(call say,Tools changed$(comma) rebuilding...) - dummy := $(shell $(rm) .rebuild && echo "$(curr_tools)" > tools.cfg) - endif - endif -endif - -# Check config. -ifeq "$(curr_config)" "" - $(error makefile must define `curr_config' variable) -endif -prev_config := $(shell [ -e build.cfg ] && cat build.cfg) -curr_config := $(strip $(curr_config)) -ifeq "$(clean)" "" # Do not check config if clean goal specified. - $(call say,Config : $(curr_config)) - ifeq "$(prev_config)" "" - # No saved config file, let us create it. - dummy := $(shell echo "$(curr_config)" > build.cfg) - else - # Check saved config file matches current configuration. - ifneq "$(curr_config)" "$(prev_config)" - # Show the differtence between previous and current configurations. - $(call say,Old config : $(filter-out $(curr_config),$(prev_config))) - $(call say,New config : $(filter-out $(prev_config),$(curr_config))) - # And initiate rebuild. - $(call say,Configuration changed$(comma) rebuilding...) - dummy := $(shell $(rm) .rebuild && echo "$(curr_config)" > build.cfg) - endif - endif -endif - -# end of file # - diff --git a/openmp/runtime/tools/src/common-defs.mk b/openmp/runtime/tools/src/common-defs.mk deleted file mode 100644 index 4a059d01335..00000000000 --- a/openmp/runtime/tools/src/common-defs.mk +++ /dev/null @@ -1,232 +0,0 @@ -# common-defs.mk # - -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -# -------------------------------------------------------------------------------------------------- -# This file contains really common definitions used by multiple makefiles. Modify it carefully! -# -------------------------------------------------------------------------------------------------- - -# -------------------------------------------------------------------------------------------------- -# Some tricky variables. -# -------------------------------------------------------------------------------------------------- -empty := -space := $(empty) $(empty) -comma := , -ifeq "$(date)" "" - $(error Caller should specify "date" variable.) -endif - -# -------------------------------------------------------------------------------------------------- -# Helper finctions. -# -------------------------------------------------------------------------------------------------- - -# Synopsis: -# $(call say,text-to-print-to-the-screen) -# Description: -# The function prints its argument to the screen. In case of older makes it is analog of -# $(warning), starting from make 3.81 is is analog of $(info). -# -say = $(warning $(1)) -ifneq "$(filter 3.81,$(MAKE_VERSION))" "" - say = $(info $(1)) -endif - -# Synopsis: -# architecture = $(call legal_arch,32) -# Description: -# The function return printable name of specified architecture, IA-32 architecture or Intel(R) 64. -# -legal_arch = $(if $(filter 32,$(1)),IA-32,$(if $(filter 32e,$(1)),Intel(R) 64,$(if $(filter l1,$(1)),L1OM,$(if $(filter arm,$(1)),ARM,$(if $(filter ppc64,$(1)),PPC64,$(if $(filter ppc64le,$(1)),PPC64LE,$(if $(filter aarch64,$(1)),AArch64,$(if $(filter mic,$(1)),Intel(R) Many Integrated Core Architecture,$(error Bad architecture specified: $(1)))))))))) - -# Synopsis: -# var_name = $(call check_variable,var,list) -# Description: -# The function verifies the value of var varibale. If it is empty, the first word from the list -# is assigned to var as default value. Otherwise the var value must match one of words in the -# list, or error is issued. -# Example: -# LINK_TYPE = $(call check_variable,LINK_TYPE,static dynamic) -# -check_variable = $(call _check_variable_words,$(1))$(call _check_variable_value,$(1),$(2)) - -# Synopsis: -# $(call _check_variable_words,var) -# Description: -# Checks that variable var is empty or single word. In case of multiple words an error is -# issued. It is helper function for check_variable. -# -_check_variable_words = $(if $(filter 0 1,$(words $($(1)))),,\ - $(error Illegal value of $(1): "$($(1))")) - -# Synopsis: -# $(call _check_variable_value,var) -# Description: -# If variable var is empty, the function returns the first word from the list. If variable is -# not empty and match one of words in the list, variable's value returned. Otherwise, error is -# issued. It is helper function for check_variable. -# -_check_variable_value = $(if $($(1)),$(if $(filter $(2),$($(1))),$($(1)),\ - $(error Illegal value of $(1): "$($(1))")),$(firstword $(2))) - -# Synopsis: -# $(call debug,var) -# Description: -# If LIBOMP_MAKE_DEBUG is not empty, var name and value printed. Use this for debug purpose. -# -ifeq "$(LIBOMP_MAKE_DEBUG)" "" - debug = -else - debug = $(call say,debug: $(1)="$($(1))") -endif - -# Synopsis: -# $(call header,target) -# Description: -# Returns a string to print to show build progress. -# -header = ----- $(marker) --- $(1) ----- - -# -------------------------------------------------------------------------------------------------- -# Global make settings. -# -------------------------------------------------------------------------------------------------- - -# Non-empty CDPATH may lead to problems on some platforms: simple "cd dir" (where "dir" is an -# existing directory in current one) fails. Clearing CDPATH solves the problem. -CDPATH = -.SUFFIXES : # Clean default list of suffixes. -.DELETE_ON_ERROR : # Delete target file in case of error. - -$(call say,$(call header,making $(if $(MAKECMDGOALS),$(MAKECMDGOALS),all))) - -# -------------------------------------------------------------------------------------------------- -# Check clean and clobber goals. -# -------------------------------------------------------------------------------------------------- - -# "clean" goal must be specified alone, otherwise we have troubles with dependency files. -clean := $(filter clean%,$(MAKECMDGOALS)) -ifneq "$(clean)" "" # "clean" goal is present in command line. - ifneq "$(filter-out clean%,$(MAKECMDGOALS))" "" # there are non-clean goals. - $(error "clean" goals must not be mixed with other goals) - endif -endif -# Issue error on "clobber" target. -ifneq "$(filter clobber,$(MAKECMDGOALS))" "" - $(error There is no clobber goal in makefile) -endif - -# -------------------------------------------------------------------------------------------------- -# Mandatory variables passed from build.pl. -# -------------------------------------------------------------------------------------------------- - -os := $(call check_variable,os,lin mac win) -arch := $(call check_variable,arch,32 32e 64 arm ppc64 ppc64le aarch64 mic) -ifeq "$(arch)" "mic" # We want the flavor of mic (knf, knc, knl, etc.) - platform := $(os)_$(MIC_ARCH) -else - platform := $(os)_$(arch) -endif -platform := $(call check_variable,platform,lin_32 lin_32e lin_64 lin_arm lin_knc lin_knf mac_32 mac_32e win_32 win_32e win_64 lin_ppc64 lin_ppc64le lin_aarch64) -# oa-opts means "os and arch options". They are passed to almost all perl scripts. -oa-opts := --os=$(os) --arch=$(arch) - -# -------------------------------------------------------------------------------------------------- -# Directories. -# -------------------------------------------------------------------------------------------------- - -ifeq "$(LIBOMP_WORK)" "" - $(error Internal error: LIBOMP_WORK variable must be set in makefile.mk) -endif -tools_dir = $(LIBOMP_WORK)tools/ -# We do not define src/ and other directories here because they depends on target (RTL, DSL, tools). - -# -------------------------------------------------------------------------------------------------- -# File suffixes. -# -------------------------------------------------------------------------------------------------- - -ifeq "$(os)" "win" # win - asm = .asm - obj = .obj - lib = .lib - dll = .dll - exe = .exe - cat = $(dll) -else # lin, mic or mac - asm = .s - obj = .o - lib = .a - ifeq "$(os)" "mac" - dll = .dylib - else - dll = .so - endif - exe = $(empty) - cat = .cat -endif - -# -------------------------------------------------------------------------------------------------- -# File manipulation and misc commands. -# -------------------------------------------------------------------------------------------------- - -target = @echo "$(call header,$@)" -ifeq "$(os)" "win" - cp = cp -f - rm = rm -f - mkdir = mkdir -p - touch = touch - perl = perl - slash = \\ -else # lin, mic or mac - cp = cp -f - rm = rm -f - mkdir = mkdir -p - touch = touch - perl = perl - slash = / -endif - -# -------------------------------------------------------------------------------------------------- -# Common non-configuration options. -# -------------------------------------------------------------------------------------------------- -# They may affect build process but does not affect result. - -# If TEST_DEPS is "off", test deps is still performed, but its result is ignored. -TEST_DEPS := $(call check_variable,TEST_DEPS,on off) -# The same for test touch. -TEST_TOUCH := $(call check_variable,TEST_TOUCH,on off) -td-i = $(if $(filter off,$(TEST_DEPS)),-) -tt-i = $(if $(filter off,$(TEST_TOUCH)),-) - -# -------------------------------------------------------------------------------------------------- -# Common targets. -# -------------------------------------------------------------------------------------------------- - -# All common targets are defined as phony. It allows "buil.pl --all test-xxx". -# Makefile can define actions for a particiular test or leave it no-op. - -# all, the default target, should be the first one. -.PHONY : all -all : - -.PHONY : common clean clean-common fat inc l10n lib - -.PHONY : force-tests tests -.PHONY : force-test-touch test-touch -.PHONY : force-test-relo test-relo -.PHONY : force-test-execstack test-execstack -.PHONY : force-test-instr test-instr -.PHONY : force-test-deps test-deps - -tests = touch relo execstack instr deps -tests : $(addprefix test-,$(tests)) -force-tests : $(addprefix force-test-,$(tests)) - -# end of file # diff --git a/openmp/runtime/tools/src/common-rules.mk b/openmp/runtime/tools/src/common-rules.mk deleted file mode 100644 index 44f97c22460..00000000000 --- a/openmp/runtime/tools/src/common-rules.mk +++ /dev/null @@ -1,200 +0,0 @@ -# common-rules.mk # - -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -# -------------------------------------------------------------------------------------------------- -# This file contains really common definitions used by multiple makefiles. Modify it carefully! -# -------------------------------------------------------------------------------------------------- - -# --- Creating a directory --- -# A directory cannot be a target, because in Linux* OS directory's timestamp is updated each time a -# file is created or deleted in the directory. We use ".dir" file in place of directory. If such -# file exists, it means directory exists also. - -.PRECIOUS : %/.dir # Do not delete automatically created files. - -%/.dir : - $(target) - $(mkdir) $(dir $@) - $(touch) $@ - -# --- Rebuilding --- -# Removing or touching .rebuild file causes rebuild. -# To let it work, .rebuild should be added as prerequisite to every rule (dependency with commands) -# except clean* and force*, in this and other makefiles. -.rebuild : - $(target) - $(touch) $@ - -# -- Creating dependency file for C/C++ --- - -%.d : %.c .rebuild - $(target) - $(c) $(cpp-flags) $(c-flags) $(c-flags-m) $< > $@ - -%.d : %.cpp .rebuild - $(target) - $(cxx) $(cpp-flags) $(cxx-flags) $(cxx-flags-m) $< > $@ - -# -- Creating preprocessed file for C/C++ --- - -%.i : %.c .rebuild - $(target) - $(c) $(cpp-flags) $(c-flags) -P $(c-out)$@ $< - -%.i : %.cpp .rebuild - $(target) - $(cxx) $(cpp-flags) $(cxx-flags) -P $(cxx-out)$@ $< - -# -- Compiling C/C++ files --- - -%$(obj) : %.c .rebuild - $(target) - $(c) $(cpp-flags) $(c-flags) $(c-out)$@ $< - -%$(obj) : %.cpp .rebuild - $(target) - $(cxx) $(cpp-flags) $(cxx-flags) $(cxx-out)$@ $< - -# -- Generate assembly files --- - -%$(asm) : %.c .rebuild - $(target) - $(c) $(cpp-flags) $(c-flags) -S $(c-out)$@ $< - -%$(asm) : %.cpp .rebuild - $(target) - $(cxx) $(cpp-flags) $(cxx-flags) -S $(cxx-out)$@ $< - -# -- Compiling asm files --- - -%$(obj) : %$(asm) .rebuild - $(target) - # There is a bug on mic: icc does not work with "-x assembler-with-cpp" option, so we have - # to preprocess file manually and then assembly it. - ifeq "$(arch)" "mic" - $(c) -E $(cpp-flags) $< > $@.tmp - $(as) $(as-flags) -x assembler $(as-out)$@ $@.tmp - else - $(as) $(as-flags) $(as-out)$@ $< - endif - -# -- Expanding variables in template files --- - -# General rule "% : %.var" does not work good, so we have to write more specific rules: -# "%.h : %.h.var", etc. - -.PRECIOUS : %.h %.f %.rc # Do not delete automatically created files. - -expand-vars = $(perl) $(tools_dir)expand-vars.pl --strict $(ev-flags) $< $@ - -# Any generated file depends on kmp_version.c, because we extract build number from that file. - -%.h : %.h.var \ - kmp_version.c $(tools_dir)expand-vars.pl .rebuild - $(target) - $(expand-vars) - -%.f : %.f.var \ - kmp_version.c $(tools_dir)expand-vars.pl .rebuild - $(target) - $(expand-vars) - -%.f90 : %.f90.var \ - kmp_version.c $(tools_dir)expand-vars.pl .rebuild - $(target) - $(expand-vars) - -%.rc : %.rc.var \ - kmp_version.c $(tools_dir)expand-vars.pl .rebuild - $(target) - $(expand-vars) - -# -- Making static library --- - -.PRECIOUS : %$(lib) # Do not delete automatically created files. - -%$(lib) : %$(lib).lst .rebuild - $(target) - $(rm) $@ - $(ar) $(ar-flags) $(ar-out)$@ $$(cat $<) - # strip debug info in case it is requested (works for Linux* OS only) - ifneq "$(dbg_strip)" "" - ifeq "$(DEBUG_INFO)" "off" - ifeq "$(arch)" "mic" - x86_64-k1om-linux-objcopy --strip-debug $@ - else - objcopy --strip-debug $@ - endif - endif - endif - -# -- Making dynamic library --- - -.PRECIOUS : %$(dll) # Do not delete automatically created files. - -# makefile.mk should properly define imp_file, def_file, res_file, and pdb_file: -# lin and mac: def_file and res_file should be empty, imp_file and pdb_file do not matter. -# win: all the variabe may be empty; if a variable specified, it affects ld-flags. -# Note: imp_file and pdb_file are side effect of building this target. -# Note: to workaround CQ215229 $ld-flags-extra introduced to keep options be placed after objects -%$(dll) : %$(dll).lst $(def_file) $(res_file) .rebuild - $(target) - $(ld) $(ld-flags-dll) $(ld-flags) $(ld-out)$@ $$(cat $<) $(ld-flags-extra) $(res_file) - # If stripped pdb exist, rename it to normal pdb name. See devtools.mk for explanation. - ifneq "$(pdb_file)" "" - ifeq "$(DEBUG_INFO)" "off" - mv $(pdb_file) $(pdb_file).nonstripped - mv $(pdb_file).stripped $(pdb_file) - endif - endif - -ifneq "$(pdb_file)" "" -$(pdb_file) : $(lib_file) -endif - -%.dbg : %$(dll) .rebuild - $(target) - ifeq "$(arch)" "mic" - x86_64-k1om-linux-objcopy --only-keep-debug $< $@ - else - objcopy --only-keep-debug $< $@ - endif - - -.PRECIOUS: %.res # Do not delete automatically created files. - -%.res : %.rc .rebuild - $(target) - rc -fo$@ $< - -# --- Building helper tools from sources --- - -.PRECIOUS: %$(exe) # Do not delete automatically created files. - -%$(exe) : $(tools_dir)%.cpp .rebuild - $(target) - $(cxx) $(cxx-out)$@ $< - -# --- Forcing a test --- - -test-%/.force : test-%/.dir - $(target) - $(rm) $(dir $@).{test,force} - -# --- Removing a file in build directory --- - -rm-% : - $(target) - $(rm) $(patsubst rm-%,%,$@) - -# end of file # diff --git a/openmp/runtime/tools/src/common-tools.mk b/openmp/runtime/tools/src/common-tools.mk deleted file mode 100644 index 38614d27ea7..00000000000 --- a/openmp/runtime/tools/src/common-tools.mk +++ /dev/null @@ -1,487 +0,0 @@ -# common-tools.mk # - -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -# -------------------------------------------------------------------------------------------------- -# Dev tools and general options (like -fpic, -O2 or -g). -# -------------------------------------------------------------------------------------------------- - -# c -- C compiler. -# cxx -- C++ compiler. -# cpp -- C preprocessor. -# fort -- Fortran compiler. -# as -- Assembler. -# ar -- Librarian (static library maker). -# ld -- Linker (dynamic library maker). -# *-out -- Flag denoting output file. If space between flag and file name required, add explicit -# space to variable, e. g.: "c-out = -o$(space)". -# *-flags -- Flags to appropriate program, e. g. c-flags -- flags for C compiler, etc. - -# --- Common definitions --- - -# Add current directory (it contains generated files). -# Note: It is important to specify current dir as "./" (not just "."). Otherwise Intel compiler -# on Windows* OS generates such a dependency: "kmp_runtime.obj: .\kmp_i18n.inc", and make complains -# "No rule to build .\kmp_i18n.inc". Using "./" solves the problem. -cpp-flags += -I ./ -# For non-x86 architecture -ifeq "$(filter 32 32e 64 mic,$(arch))" "" - cpp-flags += $(shell pkg-config --cflags libffi) -endif -# Add all VPATH directories to path for searching include files. -cpp-flags += $(foreach i,$(VPATH),-I $(i)) - - -cpp-flags += -D USE_DEBUGGER=1 - -# Shouldn't this be being set from the command line somehow? -cpp-flags += -D USE_ITT_BUILD - -ifeq "$(OPTIMIZATION)" "on" - cpp-flags += -D NDEBUG -else - cpp-flags += -D _DEBUG -D BUILD_DEBUG - ifeq "$(os)" "win" - # This is forced since VS2010 tool produces inconsistent directives - # between objects, resulting in a link failure. - cpp-flags += -D _ITERATOR_DEBUG_LEVEL=0 - endif -endif - -# --- Linux* OS, Intel(R) Many Integrated Core Architecture and OS X* definitions --- - -ifneq "$(filter lin mac,$(os))" "" - # --- C/C++ --- - ifeq "$(c)" "" - c = icc - endif - # C++ compiler is a complement to C compiler. - ifeq "$(c)" "icc" - cxx = icpc - endif - ifeq "$(c)" "gcc" - cxx = g++ - endif - ifeq "$(c)" "clang" - cxx = clang++ - endif - # Output file flag. - c-out = -o$(space) - cxx-out = -o$(space) - # Compile only, no link. - c-flags += -c - cxx-flags += -c - # Generating dependecy file. - c-flags-m += -M -MG - cxx-flags-m += -M -MG - # Enable C99 language. - ifneq "$(CPLUSPLUS)" "on" - c-flags += -std=gnu99 - endif - # Generate position-independent code (SDL requirements). - c-flags += -fPIC - cxx-flags += -fPIC - # Emit debugging information. - ifeq "$(DEBUG_INFO)" "on" - c-flags += -g - cxx-flags += -g - endif - # Instrument program for profiling, gather extra information. - ifeq "$(COVERAGE)" "on" - ifeq "$(c)" "icc" - c-flags += -prof_genx - endif - ifeq "$(cxx)" "icpc" - cxx-flags += -prof_genx - endif - endif - # Turn optimization on or off. - ifeq "$(OPTIMIZATION)" "on" - # -inline-min-size=1 improves performance of PARALLEL EPCC up to 10% on fxi64lin01, - # doesn't change performance on fxe64lin01. - # Presence of the -inline-min-size=1 switch should only help - # to promote performance stability between changes, - # even if it has no observable impact right now. - ifneq "$(filter icl icl.exe,$(c))" "" - c-flags += -O2 -inline-min-size=1 - else - c-flags += -O2 - endif - ifneq "$(filter icl icl.exe,$(cxx))" "" - cxx-flags += -O2 -inline-min-size=1 - else - cxx-flags += -O2 - endif - else - c-flags += -O0 - cxx-flags += -O0 - endif - # --- Assembler --- - ifeq "$(c)" "icc" - as = icc - endif - ifeq "$(c)" "gcc" - as = gcc - endif - ifeq "$(c)" "clang" - as = clang - endif - as-out = -o$(space) - as-flags += $(cpp-flags) - # Compile only, no link. - as-flags += -c - as-flags += -x assembler-with-cpp - # --- Fortran --- - ifeq "$(c)" "icc" - fort = ifort - endif - ifeq "$(c)" "gcc" - fort = gfortran - endif - ifeq "$(c)" "clang" - fort = gfortran - endif - ifeq "$(fort)" "" - fort = ifort - endif - fort-out = -o$(space) - fort-flags += -c -endif - -# --- Linux* OS definitions --- - -ifeq "$(os)" "lin" -ifneq "$(arch)" "mic" - # --- C/C++ --- - # On lin_32, we want to maintain stack alignment to be compatible with GNU binaries built with - # compiler. - ifeq "$(c)" "icc" - ifeq "$(arch)" "32" - c-flags += -falign-stack=maintain-16-byte - cxx-flags += -falign-stack=maintain-16-byte - endif - # Generate code that will run on any Pentium or later processor. - ifeq "$(arch)" "32" - c-flags += -mia32 - cxx-flags += -mia32 - endif - endif - ifeq "$(c)" "gcc" - ifeq "$(arch)" "arm" - c-flags += -marm - endif - endif - # --- Librarian --- - ar = ar - ar-out = $(empty) - ar-flags += cr - # --- Linker --- - # Use ld by default, however, makefile may specify ld=$(c) before including devtools.mk. - ifeq "$(ld)" "" - ld = $(c) - endif - ld-flags-dll += -shared - ifeq "$(ld)" "ld" - ld-out = -o$(space) - ifeq "$(arch)" "32" - ld-flags += -m elf_i386 - endif - ifeq "$(arch)" "32e" - ld-flags += -m elf_x86_64 - endif - ld-flags += -x -lc -ldl - # SDL (Security Development Lifecycle) flags: - # -z noexecstack - Stack execution protection. - # -z relro -z now - Data relocation and protection. - ld-flags += -z relro -z now - ld-flags += -z noexecstack - ld-flags-dll += -soname=$(@F) - endif - ifeq "$(ld)" "$(c)" - ld-out = $(c-out) - # SDL (Security Development Lifecycle) flags: - # -z noexecstack - Stack execution protection. - # -z relro -z now - Data relocation and protection. - ld-flags += -Wl,-z,relro -Wl,-z,now - ld-flags += -Wl,-z,noexecstack - ld-flags-dll += -Wl,-soname=$(@F) - endif - ifeq "$(ld)" "$(cxx)" - ld-out = $(cxx-out) - # SDL (Security Development Lifecycle) flags: - # -z noexecstack - Stack execution protection. - # -z relro -z now - Data relocation and protection. - ld-flags += -Wl,-z,relro -Wl,-z,now - ld-flags += -Wl,-z,noexecstack - ld-flags-dll += -Wl,-soname=$(@F) - endif -endif -endif - -# --- Intel(R) Many Integrated Core Architecture definitions --- - -ifeq "$(arch)" "mic" - # --- C/C++ --- - # Intel(R) Many Integrated Core Architecture specific options, need clarification for purpose: - #c-flags += -mmic -mP2OPT_intrin_disable_name=memcpy -mP2OPT_intrin_disable_name=memset -mGLOB_freestanding -mGLOB_nonstandard_lib -nostdlib -fno-builtin - #cxx-flags += -mmic -mP2OPT_intrin_disable_name=memcpy -mP2OPT_intrin_disable_name=memset -mGLOB_freestanding -mGLOB_nonstandard_lib -nostdlib -fno-builtin - # icc for mic has a bug: it generates dependencies for target like file.obj, while real object - # files are named file.o. -MT is a workaround for the problem. - c-flags-m += -MT $(basename $@).o - cxx-flags-m += -MT $(basename $@).o - # --- Librarian --- - ar = ar - ar-out = $(empty) - ar-flags += cr - # --- Linker --- - # Use $(c) by default, however, makefile may specify another linker (e.g. ld=ld) before including devtools.mk. - ifeq "$(ld)" "" - ld = $(c) - endif - ifeq "$(ld)" "ld" - ld-out = -o$(space) - ld-flags += -m elf_l1om_fbsd - ld-flags-dll += -shared -x -lc - # SDL (Security Development Lifecycle) flags: - # -z noexecstack - Stack execution protection. - # -z relro -z now - Data relocation and protection. - ld-flags += -z noexecstack - ld-flags += -z relro -z now - ld-flags-dll += -soname=$(@F) - # Now find out path to libraries. - ld-flags-L := $(shell $(c) -Wl,-v -\# 2>&1 | grep -e "-L") - $(call debug,ld-flags-L) - # Remove continuation characters; first add a space to the end (" -Lpath1 /" -> "-Lpath1 / ") - ld-flags-L := $(filter-out \,$(ld-flags-L)) - $(call debug,ld-flags-L) - # Linker treats backslash ('\') as an escape symbol, so replace it with forward slash. - ld-flags-L := $(subst \,/,$(ld-flags-L)) - $(call debug,ld-flags-L) - ld-flags += $(ld-flags-L) - endif - ifeq "$(ld)" "$(c)" - ld-out = $(c-out) - ld-flags-dll += -shared -Wl,-x -Wl,-soname=$(@F) - # SDL (Security Development Lifecycle) flags: - # -z noexecstack - Stack execution protection. - # -z relro -z now - Data relocation and protection. - ld-flags += -Wl,-z,noexecstack - ld-flags += -Wl,-z,relro -Wl,-z,now - endif - ifeq "$(ld)" "$(cxx)" - ld-out = $(cxx-out) - ld-flags-dll += -shared -Wl,-x -Wl,-soname=$(@F) - # SDL (Security Development Lifecycle) flags: - # -z noexecstack - Stack execution protection. - # -z relro -z now - Data relocation and protection. - ld-flags += -Wl,-z,noexecstack - ld-flags += -Wl,-z,relro -Wl,-z,now - endif -endif - -# --- OS X* definitions --- - -ifeq "$(os)" "mac" - # --- Librarian --- - ar = libtool - ar-out = -o$(space) - ar-flags += -static - # --- Linker --- - # Use C compiler as linker by default, however, makefile may specify ld=$(libtool) before - # including devtools.mk. - ifeq "$(ld)" "" - ld = $(c) - endif - ifeq "$(ld)" "libtool" - ld-out = -o$(space) - ld-flags-dll += -dynamic - ld-flags += -lc -ldl - endif - ifeq "$(ld)" "$(c)" - ld-out = $(c-out) - ld-flags-dll += -dynamiclib - endif - ifeq "$(ld)" "$(cxx)" - ld-out = $(cxx-out) - ld-flags-dll += -dynamiclib - endif - # These options suitable for any linker, either C compiler or libtool. - ld-flags-dll += -headerpad_max_install_names - ld-flags-dll += -install_name $(@F) -endif - -# --- Windows* OS definitions --- - -ifeq "$(os)" "win" - # Disable warning "function "..." (declared at line ... of ...) was declared deprecated...". - cpp-flags += -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE - # --- C/C++ --- - ifeq "$(c)" "" - c = icl.exe - endif - cxx = $(c) - # Often default icl.cfg file in compiler bin/ directory contains options -Qvc and - # -Qlocation,link. Setting ICLCFG (and IFORTCFG) to specially prepared empty config file - # overrides default config. - ICLCFG = $(tools_dir)icc.cfg - IFORTCFG = $(tools_dir)icc.cfg - export ICLCFG - export IFORTCFG - # Output file. - c-out = -o$(space) - cxx-out = -o$(space) - # Disable annoying compiler logo. - c-flags += -nologo - cxx-flags += -nologo - # Generate code that will run on any Pentium or later processor. - ifeq "$(arch)" "32" - c-flags += -arch:ia32 - cxx-flags += -arch:ia32 - endif - # Compile only, no link. - c-flags += -c - cxx-flags += -c - # -QM -- Generate dependency file. - # -QMM -- do not include system headers. On Windows* OS, system headers may be located in - # "C:\Program Files\...", but path with space confuses make, so we exclude system - # headers. - # -QMG -- Treat missed headers as generated. We do have some generated include files. - c-flags-m += -QM -QMM -QMG - cxx-flags-m += -QM -QMM -QMG - # Enable C99 language. - ifneq "$(CPLUSPLUS)" "on" - c-flags += -Qstd=gnu99 - endif - # Enable C++ exception handling. - # ??? Why we disable it on Linux* OS? - cxx-flags += -EHsc - ifeq "$(arch)" "32" - ifneq "$(filter icl icl.exe,$(c))" "" - c-flags += -Qsafeseh - endif - ifneq "$(filter icl icl.exe,$(cxx))" "" - cxx-flags += -Qsafeseh - endif - endif - # Emit debugging information. - ifeq "$(DEBUG_INFO)" "on" - c-flags += -Zi - cxx-flags += -Zi - endif - # Instrument program for profiling, gather extra information. - ifeq "$(COVERAGE)" "on" - c-flags += -Qprof_genx - cxx-flags += -Qprof_genx - endif - # Turn optimization on or off. - ifeq "$(OPTIMIZATION)" "on" - # Presence of the -inline-min-size=1 switch should only help - # to promote performance stability between changes, - # even if it has no observable impact right now. - # See the Linux* OS section above. - ifneq "$(filter icl icl.exe,$(c))" "" - c-flags += -O2 -Qinline-min-size=1 - else - c-flags += -O2 - endif - ifneq "$(filter icl icl.exe,$(cxx))" "" - cxx-flags += -O2 -Qinline-min-size=1 - else - cxx-flags += -O2 - endif - else - c-flags += -Od - cxx-flags += -Od - # Enable stack frame runtime error checking. - # !!! 0Obsolete option. Should use /RTC instead. - c-flags += -RTC1 - cxx-flags += -RTC1 - endif - # SDL (Security Development Lifecycle) flags: - # GS - Stack-based Buffer Overrun Detection - # DynamicBase - Image Randomization - c-flags += -GS -DynamicBase - cxx-flags += -GS -DynamicBase - # --- Assembler --- - ifeq "$(arch)" "32" - as = ml - endif - ifeq "$(arch)" "32e" - as = ml64 - endif - ifeq "$(as)" "ias" - as-out = -o$(space) - endif - ifneq "$(filter ml ml64,$(as))" "" - as-out = -Fo - as-flags += -nologo -c - # SDL (Security Development Lifecycle) flags: - # DynamicBase - Image Randomization - as-flags += -DynamicBase - endif - # --- Fortran --- - fort = ifort - fort-out = -o$(space) - fort-flags += -nologo - fort-flags += -c - # SDL (Security Development Lifecycle) flags: - # GS - Stack-based Buffer Overrun Detection - # DynamicBase - Image Randomization - fort-flags += -GS -DynamicBase - # --- Librarian --- - ar = link.exe - ar-out = -out: - # Generate static library. Must be the first option. - ar-flags += -lib - # Turn off tool banner. - ar-flags += -nologo - # --- Linker --- - ld = link.exe - ld-out = -out: - # Generate dynamic library. - ld-flags-dll += -dll - # Turn off tool banner. - ld-flags += -nologo - # Generate pdb (Program DataBase, debug information) file. - # If DEBUG_INFO is on, generate normal (full-featured) pdb file. Otherwise, we need only - # stripped pdb. But stripped pdb cannot be generated alone, we have to generate normal *and* - # stripped pdb. After generating both pdb files we rename stripped pdb to normal pdb name (see - # rules.mk). - ifeq "$(DEBUG_INFO)" "on" - ld-flags += $(if $(pdb_file),-debug -pdb:$(pdb_file)) - else - ld-flags += $(if $(pdb_file),-debug -pdb:$(pdb_file) -pdbstripped:$(pdb_file).stripped) - endif - # Use def file, if $(def_file) is specified. - ld-flags += $(if $(def_file),-def:$(def_file)) - # Generate import library, if $(imp_file) is specified. - ld-flags += $(if $(imp_file),-implib:$(imp_file)) - # Specify architecture. - ifeq "$(arch)" "32" - ar-flags += -machine:i386 - ld-flags += -machine:i386 - endif - ifeq "$(arch)" "32e" - ar-flags += -machine:amd64 - ld-flags += -machine:amd64 - endif - # SAFESEH - ifeq "$(arch)" "32" - as-flags += -safeseh - ld-flags += -safeseh - endif - # SDL (Security Development Lifecycle) flags: - # NXCompat - Data Execution Prevention - ld-flags += -NXCompat -DynamicBase -endif - -# end of file # diff --git a/openmp/runtime/tools/windows.inc b/openmp/runtime/tools/windows.inc deleted file mode 100644 index 3d2e070bf3c..00000000000 --- a/openmp/runtime/tools/windows.inc +++ /dev/null @@ -1,27 +0,0 @@ -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -export SHELL = cmd - -# TODO give an error if archs doesn't match -ifndef arch - $(error Could not detect arch: please specify on command line.) -endif - - -CMD=cmd /C -CWD=$(shell cmd /C echo %CD%) -RM=cmd /C del /Q /F -RD=cmd /C rmdir -MD=cmd /c mkdir -SLASH=\\ -NUL = nul - diff --git a/openmp/runtime/tools/wipe-string.pl b/openmp/runtime/tools/wipe-string.pl deleted file mode 100755 index deab95ffad0..00000000000 --- a/openmp/runtime/tools/wipe-string.pl +++ /dev/null @@ -1,183 +0,0 @@ -#!/usr/bin/perl - -# -#//===----------------------------------------------------------------------===// -#// -#// The LLVM Compiler Infrastructure -#// -#// This file is dual licensed under the MIT and the University of Illinois Open -#// Source Licenses. See LICENSE.txt for details. -#// -#//===----------------------------------------------------------------------===// -# - -use strict; -use warnings; - -use File::Glob ":glob"; - -use FindBin; -use lib "$FindBin::Bin/lib"; - -use tools; - -our $VERSION = "0.02"; - -sub wipe($$$) { - - my ( $input, $output, $wipe ) = @_; - my $bulk = read_file( $input, -binary => 1 ); - $bulk =~ s{($wipe)}{ " " x length( $1 ) }ge; - write_file( $output, \$bulk, -binary => 1 ); - return undef; - -}; # sub wipe - -my @wipe; -my $target = "."; -get_options( - "wipe-literal=s" => - sub { my $arg = $_[ 1 ]; push( @wipe, qr{@{ [ quotemeta( $arg ) ] }} ); }, - "wipe-regexp=s" => - sub { my $arg = $_[ 1 ]; push( @wipe, qr{$arg} ); }, - "target-directory=s" => \$target, -); - -# Convert strings to regular expression. -my $wipe = qr{@{ [ join( "|", @wipe ) ] }}; - -my %jobs; - -# Collect files to process. -# jobs: output -> input. -foreach my $arg ( @ARGV ) { - my @inputs = ( $^O eq "MSWin32" ? bsd_glob( $arg ) : ( $arg ) ); - foreach my $input ( @inputs ) { - my $file = get_file( $input ); - my $output = cat_file( $target, $file ); - if ( exists( $jobs{ $output } ) ) { - runtime_error( - "\"$jobs{ $output }\" and \"$input\" input files tend to be written " . - "to the same output file \"$output\"" - ); - }; # if - $jobs{ $output } = $input; - }; # foreach -}; # foreach $file - -# Process files. -%jobs = reverse( %jobs ); # jobs: input -> output. -foreach my $input ( sort( keys( %jobs ) ) ) { - my $output = $jobs{ $input }; - info( "\"$input\" -> \"$output\"" ); - wipe( $input, $output, $wipe ); -}; # foreach $input - -exit( 0 ); - -__END__ - -# -# Embedded documentation. -# - -=pod - -=head1 NAME - -B<wipe-string.pl> -- Wipe string in text or binary files. - -=head1 SYNOPSIS - -B<wipe-string.pl> I<OPTION>... I<FILE>... - -=head1 OPTIONS - -=over - -=item B<--doc> - -=item B<--manual> - -Print full help message and exit. - -=item B<--help> - -Print short help message and exit. - -=item B<--target-directory=>I<dir> - -Directory to put result files to. By default result files are written in the current working -directory. - -=item B<--usage> - -Print very short usage message and exit. - -=item B<--version> - -Print version and exit. - -=item B<--wipe-literal=>I<str> - -Specify literal string to wipe. Multiple literals are allowed. - -=item B<--wipe-regexp=>I<str> - -Specify Perl regular expression to wipe. Multiple regular expressions may be specified. - -Be careful. Protect special characters from beign interpreted by shell. - -=back - -=head1 ARGUMENTS - -=over - -=item I<file> - -File name to wipe string in. - -=back - -=head1 DESCRIPTION - -The script wipes strings in files. String may be specified literally or by Perl regular expression. -Strings are wiped by replacing characters with spaces, so size of file remains the same. The script -may be applied to both text and binary files. - -Result files are written by default to current directory, or to directory specified by -B<--target-directory> option, if any. If multiple input files tend to be written to the same output -file (e. g. identically named input files located in different directories), the script generates an -error. - -The script reads entire file, process it, and the writes to disk. Therefore it is (almost) safe to -update files in-place (see examples). - -=head1 EXAMPLES - -Wipe "Copyright" word in all the files with "txt" suffix in current directory, overwrite original -files (update them in-place): - - wipe-string.pl --wipe-literal="Copyright" *.txt - -Wipe "Copyright" and "Copyleft" words in all the files with "txt" suffix in current directory, -write result files to ../wiped directory: - - wipe-string.pl --wipe-literal=Copyright --wipe-literal=Copyleft --target-dir=../wiped *.txt - -Wipe "Copyright" and "Copyleft" words in files from "doc" directory, write result files to current -directory; - - wipe-string.pl --wipe-regexp="Copyright|Copyleft" doc/* - -Wipe "defaultlib" directive in all the library files: - - wipe-string.pl --wipe-regexp="-defaultlib:[A-Za-z0-9_.]+" *.lib - -(Be careful: the script does not analyze structure of library and object files, it just wipes -U<strings>, so it wipes all the occurrences of strings matching to specified regular expression.) - -=cut - -# end of file # |