|
| 1 | + |
| 2 | +# VERBOSITY # |
| 3 | + |
| 4 | +ifndef VERBOSE |
| 5 | + QUIET := @ |
| 6 | +endif |
| 7 | + |
| 8 | + |
| 9 | +# GENERAL VARIABLES # |
| 10 | + |
| 11 | +# Define supported Node.js versions: |
| 12 | +NODE_VERSIONS ?= '0.10 0.12 1 2 3 4 5 6 7 node' |
| 13 | + |
| 14 | +# Define a license SPDX identifier whitelist: |
| 15 | +LICENSES_WHITELIST ?= 'Apache-2.0,Artistic-2.0,BSD-2-Clause,BSD-3-Clause,BSL-1.0,CC0-1.0,ISC,MIT,MPL-2.0,Unlicense,WTFPL' |
| 16 | + |
| 17 | + |
| 18 | +# ENVIRONMENTS # |
| 19 | + |
| 20 | +# Determine the OS: |
| 21 | +# |
| 22 | +# [1]: https://en.wikipedia.org/wiki/Uname#Examples |
| 23 | +# [2]: http://stackoverflow.com/a/27776822/2225624 |
| 24 | +OS ?= $(shell uname) |
| 25 | +ifneq (, $(findstring MINGW,$(OS))) |
| 26 | + OS := WINNT |
| 27 | +else |
| 28 | +ifneq (, $(findstring MSYS,$(OS))) |
| 29 | + OS := WINNT |
| 30 | +else |
| 31 | +ifneq (, $(findstring CYGWIN,$(OS))) |
| 32 | + OS := WINNT |
| 33 | +endif |
| 34 | +endif |
| 35 | +endif |
| 36 | + |
| 37 | +# Define whether the make commands are running on a hosted continuous integration service: |
| 38 | +ifeq ($(TRAVIS), true) |
| 39 | + CI_SERVICE ?= travis |
| 40 | +else |
| 41 | +ifeq ($(APPVEYOR), true) |
| 42 | + CI_SERVICE ?= appveyor |
| 43 | +else |
| 44 | + CI_SERVICE ?= none |
| 45 | +endif |
| 46 | +endif |
| 47 | + |
| 48 | + |
| 49 | +# TOOLS # |
| 50 | + |
| 51 | +# Define the test runner to use when running JavaScript tests: |
| 52 | +JAVASCRIPT_TEST_RUNNER ?= tape |
| 53 | + |
| 54 | +# Define the linter to use when linting JavaScript source files: |
| 55 | +JAVASCRIPT_LINTER ?= eslint |
| 56 | + |
| 57 | +# Define the code coverage instrumentation utility: |
| 58 | +JAVASCRIPT_CODE_INSTRUMENTER ?= istanbul |
| 59 | + |
| 60 | +# Define the browser test runner: |
| 61 | +BROWSER_TEST_RUNNER ?= testling |
| 62 | + |
| 63 | +# Define the analysis tool to use when analyzing JavaScript files: |
| 64 | +JAVASCRIPT_COMPLEXITY_TOOL ?= plato |
| 65 | + |
| 66 | +# Define the source code documentation generator: |
| 67 | +SRC_DOC_GENERATOR ?= jsdoc |
| 68 | + |
| 69 | +# Define the code coverage service to use: |
| 70 | +COVERAGE_SERVICE ?= codecov |
| 71 | + |
| 72 | + |
| 73 | +# COMMANDS # |
| 74 | + |
| 75 | +# Define whether delete operations should be safe (i.e., deleted items are sent to trash, rather than permanently deleted): |
| 76 | +SAFE_DELETE ?= false |
| 77 | + |
| 78 | +# Define the delete command: |
| 79 | +ifeq ($(SAFE_DELETE), true) |
| 80 | + # FIXME: -rm -rf |
| 81 | + DELETE := -rm |
| 82 | + DELETE_FLAGS := -rf |
| 83 | +else |
| 84 | + DELETE ?= -rm |
| 85 | + DELETE_FLAGS ?= -rf |
| 86 | +endif |
| 87 | + |
| 88 | +# Define the command for setting executable permissions: |
| 89 | +MAKE_EXECUTABLE ?= chmod +x |
| 90 | + |
| 91 | +# Define the command for recursively creating directories (WARNING: portability issues on some systems!): |
| 92 | +MKDIR_RECURSIVE ?= mkdir -p |
| 93 | + |
| 94 | +# Define the command for extracting tarfiles: |
| 95 | +TAR ?= tar |
| 96 | + |
| 97 | +# Define the command to `cat` a file: |
| 98 | +CAT ?= cat |
| 99 | + |
| 100 | +# Define the command to copy files: |
| 101 | +CP ?= cp |
| 102 | + |
| 103 | +# Define the command to recursively sync directories: |
| 104 | +RSYNC_RECURSIVE ?= rsync -r |
| 105 | + |
| 106 | +# Define the `git` command: |
| 107 | +GIT ?= git |
| 108 | + |
| 109 | +# Define the command for staging files: |
| 110 | +GIT_ADD ?= $(GIT) add |
| 111 | + |
| 112 | +# Define the command for committing files: |
| 113 | +GIT_COMMIT ?= $(GIT) commit |
| 114 | + |
| 115 | +# Determine the `open` command: |
| 116 | +ifeq ($(OS), Darwin) |
| 117 | + OPEN ?= open |
| 118 | +else |
| 119 | + OPEN ?= xdg-open |
| 120 | +endif |
| 121 | +# TODO: add Windows command |
| 122 | + |
| 123 | +# Define the command for `node`: |
| 124 | +NODE ?= node |
| 125 | + |
| 126 | +# Define the command for `npm`: |
| 127 | +NPM ?= npm |
| 128 | + |
| 129 | + |
| 130 | +# COMPILERS # |
| 131 | + |
| 132 | +# Define the C compiler: |
| 133 | +C_COMPILER ?= gcc |
| 134 | + |
| 135 | +# Define the C++ compiler: |
| 136 | +CXX_COMPILER ?= g++ |
| 137 | + |
| 138 | +# Define the Fortran compiler: |
| 139 | +FORTRAN_COMPILER ?= gfortran |
| 140 | +FC := $(FORTRAN_COMPILER) |
| 141 | + |
| 142 | +# Define the command for `ranlib` (generates an index from object file contents and stores the index in the file; used by a linker): |
| 143 | +RANLIB ?= ranlib |
| 144 | + |
| 145 | +# Determine whether to generate [position independent code][1]: |
| 146 | +# |
| 147 | +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options |
| 148 | +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option |
| 149 | +ifeq ($(OS), WINNT) |
| 150 | + fPIC ?= |
| 151 | +else |
| 152 | + fPIC ?= -fPIC |
| 153 | +endif |
| 154 | + |
| 155 | + |
| 156 | +# VENDOR DEPENDENCIES # |
| 157 | + |
| 158 | +# Define the BLAS library to use: |
| 159 | +BLAS ?= |
| 160 | + |
| 161 | +# Define the path to the BLAS library (used for includes and linking): |
| 162 | +BLAS_DIR ?= |
| 163 | + |
| 164 | +# Define the Boost version: |
| 165 | +DEPS_BOOST_VERSION ?= 1.62.0 |
| 166 | + |
| 167 | +# Generate a version slug: |
| 168 | +deps_boost_version_slug := $(subst .,_,$(DEPS_BOOST_VERSION)) |
| 169 | + |
| 170 | +# Define the output path when building Boost: |
| 171 | +DEPS_BOOST_BUILD_OUT ?= $(DEPS_BUILD_DIR)/boost_$(deps_boost_version_slug) |
| 172 | + |
| 173 | +# Define the OpenBLAS version: |
| 174 | +DEPS_OPENBLAS_VERSION ?= 0.2.19 |
| 175 | + |
| 176 | +# Generate a version slug: |
| 177 | +deps_openblas_version_slug := $(subst .,_,$(DEPS_OPENBLAS_VERSION)) |
| 178 | + |
| 179 | +# Define the output path when building OpenBLAS: |
| 180 | +DEPS_OPENBLAS_BUILD_OUT ?= $(DEPS_BUILD_DIR)/openblas_$(deps_openblas_version_slug) |
| 181 | + |
| 182 | +# Host architecture: |
| 183 | +DEPS_OPENBLAS_ARCH := $(shell $(CC) -dumpmachine | sed "s/\([^-]*\).*$$/\1/") |
| 184 | + |
| 185 | +# Target binary (32-bit or 64-bit): |
| 186 | +DEPS_OPENBLAS_BINARY ?= 64 |
| 187 | + |
| 188 | +# Target architecture (cross-compiling): |
| 189 | +DEPS_OPENBLAS_TARGET_ARCH ?= |
| 190 | + |
| 191 | +# Host C compiler (cross-compiling): |
| 192 | +DEPS_OPENBLAS_HOSTCC ?= |
| 193 | + |
| 194 | +# C compiler flags: |
| 195 | +DEPS_OPENBLAS_CFLAGS ?= |
| 196 | + |
| 197 | +# Fortran compiler flags: |
| 198 | +DEPS_OPENBLAS_FFLAGS ?= -O3 $(fPIC) |
| 199 | + |
| 200 | +# Specify stack alignment on Windows. |
| 201 | +# |
| 202 | +# [1]: https://gcc.gnu.org/onlinedocs/gcc-4.5.3/gcc/i386-and-x86_002d64-Options.html |
| 203 | +ifeq ($(OS), WINNT) |
| 204 | +ifneq ($(DEPS_OPENBLAS_ARCH), x86_64) |
| 205 | +ifneq ($(DEPS_OPENBLAS_USE_CLANG), 1) |
| 206 | + DEPS_OPENBLAS_CFLAGS += -mincoming-stack-boundary=2 |
| 207 | +endif |
| 208 | + DEPS_OPENBLAS_FFLAGS += -mincoming-stack-boundary=2 |
| 209 | +endif |
| 210 | +endif |
| 211 | + |
| 212 | +# Unless for distribution (i.e., a need exists for supporting multiple architectures in a single binary), disable building for all architectures: |
| 213 | +DEPS_OPENBLAS_DYNAMIC_ARCH ?= 0 |
| 214 | + |
| 215 | +# Define whether to compile a debug build: |
| 216 | +DEPS_OPENBLAS_DEBUG ?= 0 |
| 217 | + |
| 218 | +# Specify whether to build a 64-bit (8 byte integers) BLAS interface (not all Fortran compilers support this; safe to disable): |
| 219 | +DEPS_OPENBLAS_USE_BLAS64 ?= 0 |
| 220 | + |
| 221 | +# When building a 64-bit BLAS interface, add a prefix and/or suffix to all exported symbol names in the shared library. Doing so helps avoid conflicts with other BLAS libraries, especially when using 64-bit integer interfaces in OpenBLAS. Note that the same prefix and suffix are added to the library name: `lib$(SYMBOLPREFIX)openblas$(SYMBOLSUFFIX)` rather than `libopenblas`. |
| 222 | +DEPS_OPENBLAS_SYMBOLSUFFIX ?= |
| 223 | +DEPS_OPENBLAS_SYMBOLPREFIX ?= |
| 224 | + |
| 225 | +# Define whether to use threading (determined automatically if not specified): |
| 226 | +DEPS_OPENBLAS_USE_THREAD ?= |
| 227 | + |
| 228 | +# Specify whether to use the AVX kernel on Sandy Bridge. |
| 229 | +DEPS_OPENBLAS_NO_AVX ?= 1 |
| 230 | + |
| 231 | +# Specify whether to use Haswell optimizations if binutils is too old (e.g. RHEL6): |
| 232 | +DEPS_OPENBLAS_NO_AVX2 ?= 1 |
| 233 | + |
| 234 | +# Specify whether to compile CBLAS: |
| 235 | +DEPS_OPENBLAS_NO_CBLAS ?= 0 |
| 236 | + |
| 237 | +# Specify whether to only compile CBLAS: |
| 238 | +DEPS_OPENBLAS_ONLY_CBLAS ?= 0 |
| 239 | + |
| 240 | +# Specify whether to compile LAPACK (also disables compiling the C interface to LAPACK): |
| 241 | +DEPS_OPENBLAS_NO_LAPACK ?= 0 |
| 242 | + |
| 243 | +# Specify whether to compile the C interface to LAPACK: |
| 244 | +DEPS_OPENBLAS_NO_LAPACKE ?= 0 |
| 245 | + |
| 246 | +# Attempt to resolve a BLAS directory: |
| 247 | +ifeq ($(BLAS), openblas) |
| 248 | +ifeq (, $(BLAS_DIR)) |
| 249 | + # Use the `wildcard` function to check for the OpenBLAS vendor dependency: |
| 250 | + BLAS_DIR = $(wildcard $(DEPS_OPENBLAS_BUILD_OUT)) |
| 251 | +endif |
| 252 | +endif |
0 commit comments