summaryrefslogtreecommitdiff
path: root/src/nslcd_proto/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/nslcd_proto/Makefile')
-rw-r--r--src/nslcd_proto/Makefile31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/nslcd_proto/Makefile b/src/nslcd_proto/Makefile
new file mode 100644
index 0000000..2014bdd
--- /dev/null
+++ b/src/nslcd_proto/Makefile
@@ -0,0 +1,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: