Skip to content

Commit 730f5e5

Browse files
committed
Add rule to list Makefiles
1 parent 9b15410 commit 730f5e5

File tree

5 files changed

+85
-15
lines changed

5 files changed

+85
-15
lines changed

tools/make/lib/debug/Makefile

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@
1616
# limitations under the License.
1717
#/
1818

19-
# VARIABLES #
20-
21-
# Define command flags:
22-
FIND_MAKEFILES_FLAGS ?= \
23-
-name 'Makefile' \
24-
-o \
25-
-name '*.mk'
26-
27-
2819
# RULES #
2920

3021
#/

tools/make/lib/help/Makefile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@
2121
# Define the path to the Makefile usage text file for displaying help information:
2222
MAKE_USAGE ?= $(TOOLS_MAKE_DIR)/usage.txt
2323

24-
# Define command flags:
25-
FIND_MAKEFILES_FLAGS ?= \
26-
-name 'Makefile' \
27-
-o \
28-
-name '*.mk'
29-
3024

3125
# RULES #
3226

tools/make/lib/ls/Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ MARKDOWN_PATTERN ?= *.$(MARKDOWN_FILENAME_EXT)
183183
MARKDOWN_FILTER ?= .*/.*
184184

185185

186+
# Define a filename pattern for Makefile files:
187+
MAKEFILE_PATTERN ?= *.$(MAKEFILE_FILENAME_EXT)
188+
189+
# Define a file pattern for Makefile files:
190+
MAKEFILE_FILTER ?= .*/.*
191+
192+
186193
# Define a filename pattern for Python files:
187194
PYTHON_PATTERN ?= *.$(PYTHON_FILENAME_EXT)
188195

@@ -281,6 +288,9 @@ FIND_LIB_PACKAGES_EXCLUDE_FLAGS ?= \
281288
-not -path "$(ROOT_DIR)/**/$(DOCUMENTATION_FOLDER)/*" \
282289
-not -path "$(ROOT_DIR)/**/$(SCRIPTS_FOLDER)/*"
283290

291+
# Makefile exclude flags:
292+
FIND_MAKEFILES_EXCLUDE_FLAGS ?= $(FIND_EXCLUDE_FLAGS)
293+
284294
# Markdown exclude flags:
285295
FIND_MARKDOWN_EXCLUDE_FLAGS ?= $(FIND_EXCLUDE_FLAGS)
286296

@@ -383,6 +393,7 @@ include $(TOOLS_MAKE_LIB_DIR)/ls/files.mk
383393
include $(TOOLS_MAKE_LIB_DIR)/ls/fortran/Makefile
384394
include $(TOOLS_MAKE_LIB_DIR)/ls/javascript/Makefile
385395
include $(TOOLS_MAKE_LIB_DIR)/ls/julia/Makefile
396+
include $(TOOLS_MAKE_LIB_DIR)/ls/make/Makefile
386397
include $(TOOLS_MAKE_LIB_DIR)/ls/markdown/Makefile
387398
include $(TOOLS_MAKE_LIB_DIR)/ls/pkgs/Makefile
388399
include $(TOOLS_MAKE_LIB_DIR)/ls/python/Makefile

tools/make/lib/ls/make/Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2018 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+
# DEPENDENCIES #
20+
21+
# Note: keep in alphabetical order
22+
include $(TOOLS_MAKE_LIB_DIR)/ls/make/files.mk

tools/make/lib/ls/make/files.mk

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2018 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 command flags:
22+
FIND_MAKEFILES_FLAGS ?= \
23+
-type f \
24+
\( \
25+
-name 'Makefile' \
26+
-o \
27+
-name "$(MAKEFILE_PATTERN)" \
28+
\) \
29+
-regex "$(MAKEFILE_FILTER)" \
30+
$(FIND_MAKEFILES_EXCLUDE_FLAGS)
31+
32+
ifneq ($(OS), Darwin)
33+
FIND_MAKEFILES_FLAGS := -regextype posix-extended $(FIND_MAKEFILES_FLAGS)
34+
endif
35+
36+
# Define a command for listing Makefile files:
37+
FIND_MAKEFILES_CMD ?= find $(find_kernel_prefix) $(ROOT_DIR) $(FIND_MAKEFILES_FLAGS)
38+
39+
# Define the list of files:
40+
MAKEFILES_FILES ?= $(shell $(FIND_MAKEFILES_CMD))
41+
42+
43+
# TARGETS #
44+
45+
# List all Makefile files.
46+
#
47+
# This target prints a list of all Makefile files.
48+
49+
list-makefiles-files:
50+
$(QUIET) find $(find_kernel_prefix) $(ROOT_DIR) $(FIND_MAKEFILES_FLAGS) $(find_print_list)
51+
52+
.PHONY: list-makefiles-files

0 commit comments

Comments
 (0)