blob: 53b4424d2d24750b9a9437643a02d2fb74ca2b90 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
_ := $(MAKEFILE_LIST)
d := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
generate := $d/interface_backend.go $d/func_handlerequest.go $d/struct_null_backend.go
secondary := $d/enumerator-list.mk $d/requests.txt $d/responses.txt $d/enumerator@*.go
ifeq (,$(filter clean,$(MAKECMDGOALS)))
-include $d/enumerator-list.mk
endif
ifeq (1,$(words $_))
all: generate
.PHONY: all
generate: $(generate)
.PHONY: generate
clean:
rm -f -- $(generate) $(secondary)
.PHONY: clean
.DELETE_ON_ERROR:
.SECONDARY:
endif
$d/enumerator@%.go: $d/enumerator@T.got
< $< sed 's/<T>/$*/g' > $@
$d/enumerator-list.mk: $d/responses.txt $d/Makefile
< $< sed -rn 's|.*|generate += $$d/enumerator@&.go|p' > $@
$d/requests.txt: $d/nslcd_h.go $d/Makefile
< $< grep -Eo '\btype Request_([^_ ]+)(_\S+)?' | sed 's/^type Request_//' > $@
$d/responses.txt: $d/interface_backend.go $d/Makefile
< $< sed -rn 's/.* (\S+)_Enumerator$$/\1/p' | sort -u > $@
%.go: %.go.sh
./$^ > $@
$d/interface_backend.go: $d/requests.txt
$d/func_handlerequest.go: $d/requests.txt
$d/struct_null_backend.go: $d/interface_backend.go
|