summaryrefslogtreecommitdiff
path: root/nslcd_server/Makefile
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-05-12 12:30:28 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2017-05-12 12:30:28 -0400
commit317ac622459c877406fde4dcd8ba38089afe99d4 (patch)
tree003b5f0b2c17f7a7c27b3790c0cccdfb030dc851 /nslcd_server/Makefile
parentba55c749d613f861474435be89940e788d2d06d0 (diff)
Have the Makefile be AutoThing friendly.
While it mostly played nice with autothing before, by having autothing treat `go generate` as an opaque step, it didn't populate `files.src.gen`.
Diffstat (limited to 'nslcd_server/Makefile')
-rw-r--r--nslcd_server/Makefile36
1 files changed, 25 insertions, 11 deletions
diff --git a/nslcd_server/Makefile b/nslcd_server/Makefile
index 06fe88c..a48cb6d 100644
--- a/nslcd_server/Makefile
+++ b/nslcd_server/Makefile
@@ -15,24 +15,38 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
+# header
+ifneq ($(topsrcdir),)
+include $(topsrcdir)/build-aux/Makefile.head.mk
+else
+srcdir = .
+.DEFAULT_GOAL = files.generate
+endif
+
+# body
+
files.src.gen += func_handlerequest.go
files.src.gen += interface_backend.go
files.src.gen += type_nilbackend.go
files.src.int += requests.txt
-files.generate: $(files.src.gen)
-maintainer-clean:
- rm -f -- $(files.src.gen) $(files.src.int)
-.PHONY: files.generate maintainer-clean
+$(srcdir)/%.go: $(srcdir)/%.go.gen
+ cd $(@D) && ./$(^F) > $(@F)
-%.go: %.go.gen
- ./$^ > $@
+$(srcdir)/func_handlerequest.go: $(srcdir)/requests.txt
+$(srcdir)/interface_backend.go: $(srcdir)/requests.txt
+$(srcdir)/type_nilbackend.go: $(srcdir)/interface_backend.go
-func_handlerequest.go: requests.txt
-interface_backend.go: requests.txt
-type_nilbackend.go: interface_backend.go
-
-requests.txt: ../nslcd_proto/nslcd_h.go Makefile
+$(srcdir)/requests.txt: $(srcdir)/../nslcd_proto/nslcd_h.go $(srcdir)/Makefile
< $< grep -Eo '\btype Request_([^_ ]+)(_\S+)?' | sed 's/^type Request_//' > $@
+# footer
+ifneq ($(topsrcdir),)
+include $(topsrcdir)/build-aux/Makefile.tail.mk
+else
+files.generate: $(files.src.gen)
+maintainer-clean:
+ rm -f -- $(files.src.gen) $(files.src.int)
+.PHONY: files.generate maintainer-clean
.DELETE_ON_ERROR:
+endif