|
| 1 | +#/ |
| 2 | +# @license Apache-2.0 |
| 3 | +# |
| 4 | +# Copyright (c) 2026 The Stdlib Authors. |
| 5 | +# |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +# you may not use this file except in compliance with the License. |
| 8 | +# You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, software |
| 13 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +# See the License for the specific language governing permissions and |
| 16 | +# limitations under the License. |
| 17 | +#/ |
| 18 | + |
| 19 | +# VARIABLES # |
| 20 | + |
| 21 | +# Define the download URL: |
| 22 | +DEPS_FFTPACK_URL ?= https://github.com/marton78/pffft/archive/refs/tags/v$(DEPS_FFTPACK_VERSION).tar.gz |
| 23 | + |
| 24 | +# Determine the basename for the download: |
| 25 | +deps_fftpack_basename := pffft-$(DEPS_FFTPACK_VERSION).tar.gz |
| 26 | + |
| 27 | +# Define the path to the file containing a checksum to verify a download: |
| 28 | +DEPS_FFTPACK_CHECKSUM ?= $(shell $(CAT) $(DEPS_CHECKSUMS_DIR)/$(subst .,_,$(subst -,_,$(deps_fftpack_basename)))/sha256) |
| 29 | + |
| 30 | +# Define the output path when downloading: |
| 31 | +DEPS_FFTPACK_DOWNLOAD_OUT ?= $(DEPS_TMP_DIR)/$(deps_fftpack_basename) |
| 32 | + |
| 33 | +# Define a list of source files: |
| 34 | +deps_fftpack_src := \ |
| 35 | + src/fftpack.c |
| 36 | + |
| 37 | +# Resolve a list of source files to absolute filepaths: |
| 38 | +DEPS_FFTPACK_SRC ?= $(addprefix $(DEPS_FFTPACK_BUILD_OUT)/,$(deps_fftpack_src)) |
| 39 | + |
| 40 | +# Define the path to the directory containing tests: |
| 41 | +DEPS_FFTPACK_TEST_DIR ?= $(DEPS_DIR)/test/fftpack |
| 42 | + |
| 43 | +# Define the output directory path for compiled tests: |
| 44 | +DEPS_FFTPACK_TEST_OUT ?= $(DEPS_FFTPACK_TEST_DIR)/build |
| 45 | + |
| 46 | +# Define the path to a test file for checking an installation: |
| 47 | +DEPS_FFTPACK_TEST_INSTALL ?= $(DEPS_FFTPACK_TEST_DIR)/test_install.c |
| 48 | + |
| 49 | +# Define the output path for a test file: |
| 50 | +DEPS_FFTPACK_TEST_INSTALL_OUT ?= $(DEPS_FFTPACK_TEST_OUT)/test_install |
| 51 | + |
| 52 | + |
| 53 | +# RULES # |
| 54 | + |
| 55 | +#/ |
| 56 | +# Downloads an FFTPACK distribution. |
| 57 | +# |
| 58 | +# @private |
| 59 | +#/ |
| 60 | +$(DEPS_FFTPACK_DOWNLOAD_OUT): | $(DEPS_TMP_DIR) |
| 61 | + $(QUIET) echo 'Downloading FFTPACK...' >&2 |
| 62 | + $(QUIET) $(DEPS_DOWNLOAD_BIN) $(DEPS_FFTPACK_URL) $(DEPS_FFTPACK_DOWNLOAD_OUT) |
| 63 | + |
| 64 | +#/ |
| 65 | +# Extracts an FFTPACK gzipped tar archive. |
| 66 | +# |
| 67 | +# @private |
| 68 | +#/ |
| 69 | +$(DEPS_FFTPACK_BUILD_OUT): $(DEPS_FFTPACK_DOWNLOAD_OUT) | $(DEPS_BUILD_DIR) |
| 70 | + $(QUIET) echo 'Extracting FFTPACK...' >&2 |
| 71 | + $(QUIET) $(TAR) -zxf $(DEPS_FFTPACK_DOWNLOAD_OUT) -C $(DEPS_BUILD_DIR) |
| 72 | + |
| 73 | +#/ |
| 74 | +# Creates a directory for storing compiled tests. |
| 75 | +# |
| 76 | +# @private |
| 77 | +#/ |
| 78 | +$(DEPS_FFTPACK_TEST_OUT): |
| 79 | + $(QUIET) $(MKDIR_RECURSIVE) $(DEPS_FFTPACK_TEST_OUT) |
| 80 | + |
| 81 | +#/ |
| 82 | +# Compiles a test file for testing an FFTPACK installation. |
| 83 | +# |
| 84 | +# @private |
| 85 | +#/ |
| 86 | +$(DEPS_FFTPACK_TEST_INSTALL_OUT): $(DEPS_FFTPACK_BUILD_OUT) $(DEPS_FFTPACK_TEST_OUT) |
| 87 | + $(QUIET) $(CC) -I $(DEPS_FFTPACK_BUILD_OUT) $(DEPS_FFTPACK_TEST_INSTALL) $(DEPS_FFTPACK_SRC) -o $(DEPS_FFTPACK_TEST_INSTALL_OUT) |
| 88 | + |
| 89 | +#/ |
| 90 | +# Downloads an FFTPACK distribution. |
| 91 | +# |
| 92 | +# @private |
| 93 | +# |
| 94 | +# @example |
| 95 | +# make deps-download-fftpack |
| 96 | +#/ |
| 97 | +deps-download-fftpack: $(DEPS_FFTPACK_DOWNLOAD_OUT) |
| 98 | + |
| 99 | +.PHONY: deps-download-fftpack |
| 100 | + |
| 101 | +#/ |
| 102 | +# Verifies a downloaded FFTPACK distribution. |
| 103 | +# |
| 104 | +# @private |
| 105 | +# |
| 106 | +# @example |
| 107 | +# make deps-verify-fftpack |
| 108 | +#/ |
| 109 | +deps-verify-fftpack: deps-download-fftpack |
| 110 | + $(QUIET) echo 'Verifying download...' >&2 |
| 111 | + $(QUIET) $(DEPS_CHECKSUM_BIN) $(DEPS_FFTPACK_DOWNLOAD_OUT) $(DEPS_FFTPACK_CHECKSUM) >&2 |
| 112 | + |
| 113 | +.PHONY: deps-verify-fftpack |
| 114 | + |
| 115 | +#/ |
| 116 | +# Extracts a downloaded FFTPACK distribution. |
| 117 | +# |
| 118 | +# @private |
| 119 | +# |
| 120 | +# @example |
| 121 | +# make deps-extract-fftpack |
| 122 | +#/ |
| 123 | +deps-extract-fftpack: $(DEPS_FFTPACK_BUILD_OUT) |
| 124 | + |
| 125 | +.PHONY: deps-extract-fftpack |
| 126 | + |
| 127 | +#/ |
| 128 | +# Tests an installed FFTPACK distribution. |
| 129 | +# |
| 130 | +# @private |
| 131 | +# |
| 132 | +# @example |
| 133 | +# make deps-test-fftpack |
| 134 | +#/ |
| 135 | +deps-test-fftpack: $(DEPS_FFTPACK_TEST_INSTALL_OUT) |
| 136 | + $(QUIET) echo 'Running tests...' >&2 |
| 137 | + $(QUIET) $(DEPS_FFTPACK_TEST_INSTALL_OUT) |
| 138 | + $(QUIET) echo '' >&2 |
| 139 | + $(QUIET) echo 'Success.' >&2 |
| 140 | + |
| 141 | +.PHONY: deps-test-fftpack |
| 142 | + |
| 143 | +#/ |
| 144 | +# Installs FFTPACK. |
| 145 | +# |
| 146 | +# @example |
| 147 | +# make install-deps-fftpack |
| 148 | +#/ |
| 149 | +install-deps-fftpack: deps-download-fftpack deps-verify-fftpack deps-extract-fftpack deps-test-fftpack |
| 150 | + |
| 151 | +.PHONY: install-deps-fftpack |
| 152 | + |
| 153 | +#/ |
| 154 | +# Removes an installed FFTPACK distribution. |
| 155 | +# |
| 156 | +# ## Notes |
| 157 | +# |
| 158 | +# - The rule does **not** remove an FFTPACK download (if one exists). |
| 159 | +# |
| 160 | +# @example |
| 161 | +# make clean-deps-fftpack |
| 162 | +#/ |
| 163 | +clean-deps-fftpack: clean-deps-fftpack-tests |
| 164 | + $(QUIET) $(DELETE) $(DELETE_FLAGS) $(DEPS_FFTPACK_BUILD_OUT) |
| 165 | + |
| 166 | +.PHONY: clean-deps-fftpack |
| 167 | + |
| 168 | +#/ |
| 169 | +# Removes compiled FFTPACK installation tests. |
| 170 | +# |
| 171 | +# @example |
| 172 | +# make clean-deps-fftpack-tests |
| 173 | +#/ |
| 174 | +clean-deps-fftpack-tests: |
| 175 | + $(QUIET) $(DELETE) $(DELETE_FLAGS) $(DEPS_FFTPACK_TEST_OUT) |
| 176 | + |
| 177 | +.PHONY: clean-deps-fftpack-tests |
0 commit comments