Simplified the protocol hookup code in Makefiles

This commit is contained in:
Maria Matejka 2022-08-18 18:32:33 +02:00
parent bc4ad83dac
commit dc28c6ed1c
14 changed files with 3 additions and 26 deletions

View file

@ -26,6 +26,7 @@ INSTALL_DATA=@INSTALL_DATA@
client=$(addprefix $(exedir)/,@CLIENT@)
daemon=$(exedir)/bird
protocols=@protocols@
PROTO_BUILD := $(protocols) dev kif krt
prefix=@prefix@
exec_prefix=@exec_prefix@
@ -82,9 +83,6 @@ conf-lex-targets := $(addprefix $(objdir)/conf/,cf-lex.o)
conf-y-targets := $(addprefix $(objdir)/conf/,cf-parse.y keywords.h commands.h)
cf-local = $(conf-y-targets): $(s)config.Y
# nest/Makefile declarations needed for all other modules
proto-build-c := $(addprefix $(objdir)/nest/,proto-build.c)
src-o-files = $(patsubst %.c,$(o)%.o,$(src))
tests-target-files = $(patsubst %.c,$(o)%,$(tests_src))
@ -98,13 +96,6 @@ else
o = $(patsubst $(srcdir)%,$(objdir)%,$(s))
endif
define proto-build_in =
PROTO_BUILD += $(1)
$(proto-build-c): $(lastword $(MAKEFILE_LIST))
endef
proto-build = $(eval $(call proto-build_in,$(1)))
define clean_in =
clean::
rm -f $(addprefix $(o),$(1))

View file

@ -2,11 +2,10 @@ src := a-path.c a-set.c cli.c cmds.c iface.c locks.c neighbor.c password.c proto
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,dev_build)
$(proto-build-c): $(lastword $(MAKEFILE_LIST))
$(objdir)/nest/proto-build.c: $(lastword $(MAKEFILE_LIST))
$(E)echo GEN $@
$(Q)echo "$(patsubst %,void %(void); ,$(PROTO_BUILD)) void protos_build_gen(void) { $(patsubst %, %(); ,$(PROTO_BUILD))}" > $@
$(Q)echo "$(patsubst %,void %_build(void); ,$(PROTO_BUILD)) void protos_build_gen(void) { $(patsubst %, %_build(); ,$(PROTO_BUILD))}" > $@
tests_src := a-set_test.c a-path_test.c
tests_targets := $(tests_targets) $(tests-target-files)

View file

@ -2,6 +2,5 @@ src := babel.c packets.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,babel_build)
tests_objs := $(tests_objs) $(src-o-files)

View file

@ -2,6 +2,5 @@ src := bfd.c io.c packets.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,bfd_build)
tests_objs := $(tests_objs) $(src-o-files)

View file

@ -2,6 +2,5 @@ src := attrs.c bgp.c packets.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,bgp_build)
tests_objs := $(tests_objs) $(src-o-files)

View file

@ -2,6 +2,5 @@ src := mrt.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,mrt_build)
tests_objs := $(tests_objs) $(src-o-files)

View file

@ -2,6 +2,5 @@ src := dbdes.c hello.c iface.c lsack.c lsalib.c lsreq.c lsupd.c neighbor.c ospf.
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,ospf_build)
tests_objs := $(tests_objs) $(src-o-files)

View file

@ -2,6 +2,5 @@ src := perf.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,perf_build)
tests_objs := $(tests_objs) $(src-o-files)

View file

@ -2,6 +2,5 @@ src := pipe.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,pipe_build)
tests_objs := $(tests_objs) $(src-o-files)

View file

@ -2,6 +2,5 @@ src := packets.c radv.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,radv_build)
tests_objs := $(tests_objs) $(src-o-files)

View file

@ -2,6 +2,5 @@ src := packets.c rip.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,rip_build)
tests_objs := $(tests_objs) $(src-o-files)

View file

@ -2,6 +2,5 @@ src := rpki.c packets.c tcp_transport.c ssh_transport.c transport.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,rpki_build)
tests_objs := $(tests_objs) $(src-o-files)

View file

@ -2,6 +2,5 @@ src := static.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,static_build)
tests_objs := $(tests_objs) $(src-o-files)

View file

@ -2,8 +2,6 @@ src := alloc.c io.c krt.c log.c main.c random.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,kif_build)
$(call proto-build,krt_build)
$(conf-y-targets): $(s)krt.Y
src := $(filter-out main.c, $(src))