summaryrefslogtreecommitdiff
path: root/proto/Makefile
blob: 98f0f4aa6ad67bd8c184d059dbb2388758fcc209 (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
# Copyright (C) 2015-2016 Luke Shumaker <lukeshu@sbcglobal.net>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA

ifeq ($(origin topsrcdir),undefined)
srcdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
.DEFAULT_GOAL = all
else
include $(topsrcdir)/build-aux/Makefile.head.mk
endif

std.gen_files += server/interface_backend.go
std.gen_files += server/func_handlerequest.go
std.gen_files += server/type_nilbackend.go
std.secondary_gen_files += requests.txt

$(srcdir)/requests.txt: $(srcdir)/nslcd_h.go $(srcdir)/Makefile
	< $< grep -Eo '\btype Request_([^_ ]+)(_\S+)?' | sed 's/^type Request_//' > $@

_nslcd.srcdir := $(srcdir)
_nslcd.rel=$(patsubst $(abspath $(_nslcd.srcdir))/%,./%,$(abspath $1))
$(srcdir)/%.go: $(srcdir)/%.go.sh
	cd $(_nslcd.srcdir) && $(call _nslcd.rel,$^) > $(call _nslcd.rel,$@)

$(srcdir)/server/interface_backend.go: $(srcdir)/requests.txt
$(srcdir)/server/func_handlerequest.go: $(srcdir)/requests.txt
$(srcdir)/server/type_nilbackend.go: $(srcdir)/server/interface_backend.go

ifeq ($(origin topsrcdir),undefined)
include $(srcdir)/common.mk
else
include $(topsrcdir)/build-aux/Makefile.tail.mk
endif