summaryrefslogtreecommitdiff
path: root/src/nslcd_proto/Makefile
blob: 2014bdd9bf38daae6ae68b5252c1cc51a1001081 (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
all: struct_backend.go func_handlerequest.go
.PHONY: all

clean:
	rm -f -- struct_backend.go func_handlerequest.go enumerator@*.go
	rm -f -- enumerator-list.mk requests.txt responses.txt
.PHONY: clean

ifeq (,$(filter clean,$(MAKECMDGOALS)))
-include enumerator-list.mk
endif

enumerator@%.go: enumerator@T.got
	< $< sed 's/<T>/$*/g' > $@

enumerator-list.mk: responses.txt Makefile
	< $< sed -rn 's/.*/all: enumerator@&.go/p' > $@

requests.txt: nslcd_h.go Makefile
	< $< grep -Eo 'Request_([^_ ]+)(_\S+)?' | sed 's/^Request_//' > $@
responses.txt: struct_backend.go Makefile
	< $< sed -rn 's/.* (\S+)_Enumerator$$/\1/p' | sort -u > $@

%.go: %.go.sh
	./$^ > $@

struct_backend.go: requests.txt
func_handlerequest.go: requests.txt

.DELETE_ON_ERROR:
.SECONDARY: