Skip to content

Commit cd7ab7a

Browse files
committed
Fix target regex to handle a semicolon
targets : prerequisites ; recipe
1 parent 4f7b731 commit cd7ab7a

5 files changed

Lines changed: 28 additions & 6 deletions

File tree

makefile-doc.awk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ BEGIN {
10631063
initialize_colors()
10641064

10651065
VARIABLES_REGEX = VARIABLES_REGEX == "" ? VARIABLES_REGEX_DEFAULT : VARIABLES_REGEX
1066-
TARGETS_REGEX = TARGETS_REGEX == "" ? "^ *[^.#][ ,a-zA-Z0-9$_/%.(){}-]* *&?(:|::)( |$)" : TARGETS_REGEX
1066+
TARGETS_REGEX = TARGETS_REGEX == "" ? "^ *[^.#][ ,a-zA-Z0-9$_/%.(){}-]* *&?(:|::)( |$|.*;)" : TARGETS_REGEX
10671067
VARS = VARS == "" ? 1 : VARS
10681068
PADDING = PADDING == "" ? " " : PADDING
10691069
DEPRECATED = DEPRECATED == "" ? 1 : DEPRECATED

test/Makefile.semicolon

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## 1
2+
t1:;
3+
4+
## 2
5+
t2: ;
6+
7+
t3:;@echo 1 ## 3
8+
9+
deps:
10+
@echo deps
11+
12+
## 4
13+
t4:deps; @echo 1

test/recipes/test-help

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ Usage: awk [-v option=value] -f makefile-doc.awk [Makefile ...]
33
Description: Generate docs for Makefile variables and targets
44
Options:
55
OUTPUT_FORMAT: ANSI
6-
EXPORT_THEME (theme for HTML/LATEX output):
7-
SUB (substitutions):
8-
DEBUG ([bool] output debug info):
6+
EXPORT_THEME (theme for HTML/LATEX output):
7+
SUB (substitutions):
8+
DEBUG ([bool] output debug info):
99
DEBUG_FILE (debug info file): .debug-makefile-doc.org
10-
TARGETS_REGEX (regex for matching targets): ^ *[^.#][ ,a-zA-Z0-9$_/%.(){}-]* *&?(:|::)( |$)
10+
TARGETS_REGEX (regex for matching targets): ^ *[^.#][ ,a-zA-Z0-9$_/%.(){}-]* *&?(:|::)( |$|.*;)
1111
VARIABLES_REGEX (regex for matching variables): ^ *( *(override|unexport|export|private) *)* *[^.#][a-zA-Z0-9_-]* *(=|:=|::=|:::=|!=|\?=|\+=)
1212
VARS ([bool] show documented variables): 1
1313
PADDING (a padding character between anchors and docs): " "

test/recipes/test-semicolon

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
test/Makefile.semicolon
2+
-----------------------
3+
Available targets:
4+
-----------------------
5+
t1 1
6+
t2 2
7+
t3 3
8+
t4 4
9+
-----------------------

test/test-debug-expected-result.org

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
+ ~FS~: :
44
+ ~DEBUG_FILE~: /tmp/.debug-makefile-doc.org
55
+ ~SUB~: <L:0,M:0>$(TARGET):label:this that
6-
+ ~TARGETS_REGEX~: ^ *[^.#][ ,a-zA-Z0-9$_/%.(){}-]* *&?(:|::)( |$)
6+
+ ~TARGETS_REGEX~: ^ *[^.#][ ,a-zA-Z0-9$_/%.(){}-]* *&?(:|::)( |$|.*;)
77
+ ~VARIABLES_REGEX~: ^ *( *(override|unexport|export|private) *)* *[^.#][a-zA-Z0-9_-]* *(=|:=|::=|:::=|!=|\?=|\+=)
88
+ ~VARS~: 1
99
+ ~PADDING~:

0 commit comments

Comments
 (0)