blob: 52e58f5dd54345366e4bbd1325f6b003e86fdd28 (
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
45
46
|
_ := $(MAKEFILE_LIST)
d := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
generate := $(generate) $d/interface_backend.go $d/func_handlerequest.go $d/util/struct_null_backend.go
secondary := $(secondary) $d/enumerator-list.mk $d/requests.txt $d/responses.txt $d/*@*.go $d/util/*@*.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/util/enumerator@%.go: $d/util/enumerator@T.got
< $< sed 's/<T>/$*/g' > $@
$d/enumerator-list.mk: $d/responses.txt $d/Makefile
< $< sed -rn 's|.*|generate += $$d/enumerator@&.go $$d/util/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/util/struct_null_backend.go: $d/interface_backend.go
|