Commit 0c6dfe52 authored by Jan Moskyto Matejka's avatar Jan Moskyto Matejka
Browse files

Merge branch 'int-new' into int-new-merged

parents 7a7ac656 92912f06
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
D doc/prog-head.sgml
C doc
C nest
C conf
@@ -5,3 +6,4 @@ C filter
C proto
C sysdep
C lib
D doc/prog-foot.sgml

Makefile.in

0 → 100644
+156 −0
Original line number Diff line number Diff line
# Makefile for the BIRD Internet Routing Daemon
# (c) 1999--2000 Martin Mares <mj@ucw.cz>
# (c) 2016       Jan Moskyto Matejka <mq@ucw.cz>

# Disable build-in rules
MAKEFLAGS += -r

# Variable definitions
CPPFLAGS=-I$(objdir) -I$(srcdir) @CPPFLAGS@
CFLAGS=$(CPPFLAGS) @CFLAGS@
LDFLAGS=@LDFLAGS@
LIBS=@LIBS@
CLIENT_LIBS=@CLIENT_LIBS@
CC=@CC@
M4=@M4@
BISON=@BISON@
FLEX=@FLEX@
RANLIB=@RANLIB@
INSTALL=@INSTALL@
INSTALL_PROGRAM=@INSTALL_PROGRAM@
INSTALL_DATA=@INSTALL_DATA@

client=$(addprefix $(exedir)/,@CLIENT@)
daemon=$(exedir)/bird
protocols  = @protocols@

prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
sbindir=@sbindir@
sysconfdir=@sysconfdir@
localstatedir=@localstatedir@
docdir=@prefix@/doc

srcdir := @srcdir@
objdir := @objdir@
exedir := @exedir@

ifeq ($(objdir),.)
  objdir := $(realpath .)
endif

ifeq ($(VERBOSE),)
  Q:=@
else
  Q:=
endif

# Meta rules
cleangoals := clean distclean
docgoals := docs userdocs progdocs
.PHONY: all daemon cli $(cleangoals) $(docgoals) tags
all: daemon cli

daemon: $(daemon)
cli: $(client)

# Include directories
dirs := client conf doc filter lib nest $(addprefix proto/,$(protocols)) @sysdep_dirs@

conf-y-targets := $(addprefix $(objdir)/conf/,cf-parse.y keywords.h commands.h)
cf-local = $(conf-y-targets): $(s)config.Y

src-o-files = $(patsubst %.c,$(o)%.o,$(src))

all-daemon = $(exedir)/bird: $(obj)
all-client = $(exedir)/birdc $(exedir)/birdcl: $(obj)

s = $(dir $(lastword $(MAKEFILE_LIST)))
ifeq ($(srcdir),.)
  o = $(objdir)/$(s)
else
  o = $(patsubst $(srcdir)%,$(objdir)%,$(s))
endif

define clean_in =
clean::
	rm -f $(addprefix $(o),$(1))
endef

clean = $(eval $(call clean_in,$(1)))

include $(addsuffix /Makefile,$(addprefix $(srcdir)/,$(dirs)))

# Generic rules

$(objdir)/%.o: $(srcdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h
	$(Q)echo CC -o $@ -c $<
	$(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -c $<

$(objdir)/%.o: $(objdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h
	$(Q)echo CC -o $@ -c $<
	$(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -c $<

$(objdir)/.dir-stamp:
	$(Q)echo MKDIR -p $(addprefix $(objdir)/,$(dirs) doc)
	$(Q)mkdir -p $(addprefix $(objdir)/,$(dirs) doc)
	$(Q)touch $@

$(client) $(daemon):
	$(Q)echo LD $(LDFLAGS) -o $@ $^ $(LIBS)
	$(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)

$(objdir)/sysdep/paths.h: Makefile
	echo  >$@ "/* Generated by Makefile, don't edit manually! */"
	echo >>$@ "#define PATH_CONFIG_FILE \"@CONFIG_FILE@\""
	echo >>$@ "#define PATH_CONTROL_SOCKET \"@CONTROL_SOCKET@\""
	if test -n "@iproutedir@" ; then echo >>$@ "#define PATH_IPROUTE_DIR \"@iproutedir@\"" ; fi

# Finally include the computed dependencies

ifneq ($(filter-out $(cleangoals),$(MAKECMDGOALS)),)
-include $(shell find $(objdir) -name "*.d")
endif

ifeq ($(MAKECMDGOALS),)
-include $(shell find $(objdir) -name "*.d")
endif

tags:
	cd $(srcdir) ; etags -lc `find $(dirs) -name *.[chY]`

# Install

install: all
	$(INSTALL) -d $(DESTDIR)/$(sbindir) $(DESTDIR)/$(sysconfdir) $(DESTDIR)/@runtimedir@
	$(INSTALL_PROGRAM) $(exedir)/bird $(DESTDIR)/$(sbindir)/bird
	$(INSTALL_PROGRAM) $(exedir)/birdcl $(DESTDIR)/$(sbindir)/birdcl
	if test -n "@CLIENT@" ; then								\
		$(INSTALL_PROGRAM) $(exedir)/birdc $(DESTDIR)/$(sbindir)/birdc ;		\
	fi
	if ! test -f $(DESTDIR)/@CONFIG_FILE@ ; then						\
		$(INSTALL_DATA) $(srcdir)/doc/bird.conf.example $(DESTDIR)/@CONFIG_FILE@ ;	\
	else											\
		echo "Not overwriting old bird.conf" ;						\
	fi

install-docs:
	$(INSTALL) -d $(DESTDIR)/$(docdir)
	$(INSTALL_DATA) $(objdir)/doc/{bird,prog}{,-*}.html $(DESTDIR)/$(docdir)/

# Cleanup
clean::
	rm -f $(objdir)/sysdep/paths.h
	rm -f $(addprefix $(exedir)/,bird birdc birdcl)
	find $(objdir) -name "*.[od]" -exec rm -f '{}' '+'

ifeq ($(objdir),obj)
distclean: clean
	rm -rf $(objdir)
	rm -f config.log config.status configure Makefile
else
distclean: clean
	rm -rf * .dir-stamp
	rm -f config.log config.status configure Makefile
endif
+7 −7
Original line number Diff line number Diff line
source=commands.c util.c client.c
root-rel=../
dir-name=client
src := commands.c util.c client.c
obj := $(src-o-files)

clients := $(client) birdcl
$(all-client)

source-dep := $(source) $(addsuffix .c,$(clients))
$(o)commands.c.dep: $(objdir)/conf/commands.h

subdir: $(addsuffix .o,$(clients))
$(exedir)/birdc: $(o)birdc.o
$(exedir)/birdc: LIBS += $(CLIENT_LIBS)

include ../Rules
$(exedir)/birdcl: $(o)birdcl.o
+16 −18
Original line number Diff line number Diff line
source=cf-parse.tab.c cf-lex.c conf.c
root-rel=../
src := cf-parse.tab.c cf-lex.c conf.c
obj := $(src-o-files)

include ../Rules

conf-src=$(srcdir)/conf
conf-fragments=$(conf-src)/confbase.Y @CONFS@ $(addsuffix /config.Y,$(static-dir-paths))
$(all-daemon)

ifdef DEBUG
BISON_DEBUG=-t
#FLEX_DEBUG=-d
endif

cf-parse.tab.h: cf-parse.tab.c
$(o)cf-parse.tab.h: $(o)cf-parse.tab.c

cf-parse.tab.c: cf-parse.y
	$(BISON) -bcf-parse -dv -pcf_ $(BISON_DEBUG) cf-parse.y
$(o)cf-parse.tab.c: $(o)cf-parse.y
	echo $< $@ $(o)
	$(BISON) -b$(@:.tab.c=) -dv -pcf_ $(BISON_DEBUG) $<

cf-parse.y: $(conf-fragments) $(conf-src)/gen_parser.m4
	$(M4) -P $(conf-src)/gen_parser.m4 $(conf-fragments) >cf-parse.y
$(conf-y-targets): $(s)confbase.Y
	$(M4) -P $| $^ >$@

keywords.h: $(conf-fragments) $(conf-src)/gen_keywords.m4
	$(M4) -P $(conf-src)/gen_keywords.m4 $(conf-fragments) >keywords.h
$(o)cf-parse.y: | $(s)gen_parser.m4
$(o)keywords.h: | $(s)gen_keywords.m4
$(o)commands.h: | $(s)gen_commands.m4 $(srcdir)/client/cmds.m4

commands.h: $(conf-fragments) $(conf-src)/gen_commands.m4 $(srcdir)/client/cmds.m4
	$(M4) -P $(conf-src)/gen_commands.m4 $(srcdir)/client/cmds.m4 $(conf-fragments) | sort >commands.h
$(o)cf-lex.c: $(s)cf-lex.l $(o)cf-parse.tab.h $(o)keywords.h $(o)commands.h
	$(FLEX) $(FLEX_DEBUG) -s -B -8 -o$@ -Pcf_ $<

cf-lex.c: cf-lex.l
	$(FLEX) $(FLEX_DEBUG) -s -B -8 -ocf-lex.c -Pcf_ cf-lex.l
$(addprefix $(o),cf-parse.tab.h cf-parse.tab.c cf-parse.y keywords.h commands.h cf-lex.c): $(objdir)/.dir-stamp

depend: keywords.h commands.h cf-parse.tab.c cf-lex.c
$(call clean,cf-parse.tab.h cf-parse.tab.c cf-parse.y keywords.h commands.h cf-lex.c cf-parse.output)
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@
#include "lib/resource.h"
#include "lib/string.h"
#include "lib/event.h"
#include "lib/timer.h"
#include "sysdep/unix/timer.h"
#include "conf/conf.h"
#include "filter/filter.h"

Loading