aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2016-04-12 11:14:54 +0200
committerJan Moskyto Matejka <mq@ucw.cz>2016-05-10 14:07:34 +0200
commit7152e5efbb0fade868d5f2d2c7bc10ed52b3d19d (patch)
treeebb3ff35e34cdf37c0757e0aa6a6e8de30a71278 /tools
parent4bdf1881dc6230b742d7efcaad8eeac4ed25f445 (diff)
downloadbird-7152e5efbb0fade868d5f2d2c7bc10ed52b3d19d.tar.gz
Build system reworked to one global Makefile with includes and no nesting
Also removed the lib-dir merging with sysdep. Updated #include's accordingly. Fixed make doc on recent Debian together with moving generated doc into objdir. Moved Makefile.in into root dir Retired all.o and birdlib.a Linking the final binaries directly from all the .o files.
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile-top.in20
-rw-r--r--tools/Makefile.in97
-rw-r--r--tools/Rules.in91
-rwxr-xr-xtools/mergedirs63
-rwxr-xr-xtools/progdoc33
5 files changed, 26 insertions, 278 deletions
diff --git a/tools/Makefile-top.in b/tools/Makefile-top.in
deleted file mode 100644
index cf59f7a1..00000000
--- a/tools/Makefile-top.in
+++ /dev/null
@@ -1,20 +0,0 @@
-# Makefile for in place build of BIRD
-# (c) 1999--2000 Martin Mares <mj@ucw.cz>
-
-objdir=@objdir@
-
-all depend tags install install-docs:
- $(MAKE) -C $(objdir) $@
-
-docs userdocs progdocs:
- $(MAKE) -C doc $@
-
-clean:
- $(MAKE) -C $(objdir) clean
- find . -name "*~" -or -name "*.[oa]" -or -name "\#*\#" -or -name TAGS -or -name core -or -name depend -or -name ".#*" | xargs rm -f
-
-distclean: clean
- $(MAKE) -C doc distclean
- rm -rf $(objdir) autom4te.cache
- rm -f config.* configure sysdep/autoconf.h sysdep/paths.h Makefile
-
diff --git a/tools/Makefile.in b/tools/Makefile.in
deleted file mode 100644
index 5de323ab..00000000
--- a/tools/Makefile.in
+++ /dev/null
@@ -1,97 +0,0 @@
-# Makefile for the BIRD Internet Routing Daemon
-# (c) 1999--2000 Martin Mares <mj@ucw.cz>
-
-include Rules
-
-.PHONY: all daemon birdc birdcl subdir depend clean distclean tags docs userdocs progdocs
-
-all: sysdep/paths.h .dep-stamp subdir daemon birdcl @CLIENT@
-
-daemon: $(exedir)/bird
-
-birdc: $(exedir)/birdc
-
-birdcl: $(exedir)/birdcl
-
-bird-dep := $(addsuffix /all.o, $(static-dirs)) conf/all.o lib/birdlib.a
-
-$(bird-dep): sysdep/paths.h .dep-stamp subdir
-
-birdc-dep := client/birdc.o client/all.o lib/birdlib.a
-
-$(birdc-dep): sysdep/paths.h .dep-stamp subdir
-
-birdcl-dep := client/birdcl.o client/all.o lib/birdlib.a
-
-$(birdcl-dep): sysdep/paths.h .dep-stamp subdir
-
-
-export client := @CLIENT@
-
-depend: sysdep/paths.h .dir-stamp
- set -e ; for a in $(dynamic-dirs) ; do $(MAKE) -C $$a $@ ; done
- set -e ; for a in $(static-dirs) $(client-dirs) ; do $(MAKE) -C $$a -f $(srcdir_abs)/$$a/Makefile $@ ; done
-
-subdir: sysdep/paths.h .dir-stamp .dep-stamp
- set -e ; for a in $(dynamic-dirs) ; do $(MAKE) -C $$a $@ ; done
- set -e ; for a in $(static-dirs) $(client-dirs) ; do $(MAKE) -C $$a -f $(srcdir_abs)/$$a/Makefile $@ ; done
-
-$(exedir)/bird: $(bird-dep)
- @echo LD $(LDFLAGS) -o $@ $^ $(LIBS)
- @$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
-
-$(exedir)/birdc: $(birdc-dep)
- @echo LD $(LDFLAGS) -o $@ $^ $(LIBS) $(CLIENT_LIBS)
- @$(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(CLIENT_LIBS)
-
-$(exedir)/birdcl: $(birdcl-dep)
- @echo LD $(LDFLAGS) -o $@ $^ $(LIBS)
- @$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
-
-.dir-stamp: sysdep/paths.h
- mkdir -p $(static-dirs) $(client-dirs) $(doc-dirs)
- touch .dir-stamp
-
-.dep-stamp:
- $(MAKE) depend
- touch .dep-stamp
-
-docs: userdocs progdocs
-
-userdocs progdocs: .dir-stamp
- $(MAKE) -C doc -f $(srcdir_abs)/doc/Makefile $@
-
-sysdep/paths.h:
- echo >sysdep/paths.h "/* Generated by Makefile, don't edit manually! */"
- echo >>sysdep/paths.h "#define PATH_CONFIG_FILE \"@CONFIG_FILE@\""
- echo >>sysdep/paths.h "#define PATH_CONTROL_SOCKET \"@CONTROL_SOCKET@\""
- if test -n "@iproutedir@" ; then echo >>sysdep/paths.h "#define PATH_IPROUTE_DIR \"@iproutedir@\"" ; fi
-
-tags:
- cd $(srcdir) ; etags -lc `find $(static-dirs) $(addprefix $(objdir)/,$(dynamic-dirs)) $(client-dirs) -name *.[chY]`
-
-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) $(srcdir)/doc/{bird,prog}{,-*}.html $(DESTDIR)/$(docdir)/
-
-clean:
- find . -name "*.[oa]" -o -name core -o -name depend -o -name "*.html" | xargs rm -f
- rm -f conf/cf-lex.c conf/cf-parse.* conf/commands.h conf/keywords.h
- rm -f $(exedir)/bird $(exedir)/birdcl $(exedir)/birdc $(exedir)/bird.ctl $(exedir)/bird6.ctl .dep-stamp
-
-distclean: clean
- rm -f config.* configure sysdep/autoconf.h sysdep/paths.h Makefile Rules
- rm -rf .dir-stamp $(clean-dirs)
diff --git a/tools/Rules.in b/tools/Rules.in
deleted file mode 100644
index f00c85d1..00000000
--- a/tools/Rules.in
+++ /dev/null
@@ -1,91 +0,0 @@
-# Makefile fragments for the BIRD Internet Routing Daemon
-# (c) 1999--2000 Martin Mares <mj@ucw.cz>
-
-srcdir=@srcdir_rel_mf@
-srcdir_abs := $(shell cd $(srcdir) ; pwd)
-objdir=@objdir@
-exedir=@exedir@
-
-protocols=@protocols@
-static-dirs := nest filter $(addprefix proto/,$(protocols))
-static-dir-paths := $(addprefix $(srcdir)/,$(static-dirs))
-dynamic-dirs := lib conf
-dynamic-dir-paths := $(dynamic-dirs)
-client-dirs := client
-client-dir-paths := $(client-dirs)
-doc-dirs := doc
-doc-dir-paths := $(doc-dirs)
-
-all-dirs:=$(static-dirs) $(dynamic-dirs) $(client-dirs) $(doc-dirs)
-clean-dirs:=$(all-dirs) proto sysdep
-
-CPPFLAGS=-I$(root-rel) -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@
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-bindir=@bindir@
-sbindir=@sbindir@
-sysconfdir=@sysconfdir@
-localstatedir=@localstatedir@
-docdir=@prefix@/doc
-
-ifdef source
-
-objs := $(subst .c,.o,$(source))
-
-ifdef dir-name
-src-path := $(srcdir)/$(dir-name)/
-endif
-
-all:
- cd $(root-rel) && make
-
-ifdef lib-dest
-
-subdir: $(lib-dest)
-
-$(lib-dest): $(objs)
- rm -f $@
- ar rcs $@ $^
- $(RANLIB) $@
-
-else
-
-subdir: all.o
-
-all.o: $(objs)
-# $(LD) -r -o $@ $^
-# Changed to $(CC) because $(LD) has problems with crosscompiling
- @echo LD -r -o $@ $^
- @$(CC) -nostdlib -r -o $@ $^
-
-endif
-
-%.o: $(src-path)%.c
- @echo CC -o $@ -c $<
- @$(CC) $(CFLAGS) -o $@ -c $<
-
-ifndef source-dep
-source-dep := $(source)
-endif
-
-depend:
- $(CC) $(CPPFLAGS) -MM $(addprefix $(src-path),$(source-dep)) >depend
-
-ifneq ($(wildcard depend),)
-include depend
-endif
-
-endif
diff --git a/tools/mergedirs b/tools/mergedirs
deleted file mode 100755
index fb48c6c7..00000000
--- a/tools/mergedirs
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/sh
-
-if [ -z "$4" ] ; then
- echo "Usage: mergedirs <src-dir> <src-dir-rel> <obj-dir> <list-of-dirs>"
- exit 1
- fi
-cpp=${CPP:-cc -E}
-SRCDIR=$1
-shift
-SRCREL=$1
-case $SRCDIR in
- /*) ;;
- *) SRCREL="../$SRCREL" ;;
- esac
-shift
-OBJDIR=$1
-LIBDIR=$OBJDIR/lib
-CONFDIR=$OBJDIR/conf
-shift
-
-echo "Merging system-dependent modules ($@)"
-MODULES=`for a in $@ ; do
- cat $SRCDIR/sysdep/config.h $SRCDIR/$a/Modules |
- $cpp -U unix -D MACROS_ONLY -I $OBJDIR - |
- sed "/^[ ]*\$/d;/^#/d;s@\\(.*\\)@\\1 $a/\\1@"
- done |
- sort -k1,1 -u |
- cut -d ' ' -f 2`
-rm -rf $LIBDIR $CONFDIR
-mkdir -p $LIBDIR $CONFDIR
-for a in $MODULES ; do
- b=`basename $a`
- case $b in
- *.h) ln -s $SRCREL/$a $LIBDIR/$b
- ;;
- *.c) OBJ=`echo $b | sed 's/\.c$/\.o/'`
- OBJS="$OBJS $OBJ"
- SRCS="$SRCS \\
- $b"
- ln -s $SRCREL/$a $LIBDIR/$b
- ;;
- *.Y) CONFS="$CONFS\$(srcdir)/$a "
- ln -s $SRCREL/$a $CONFDIR/$b
- ;;
- *) echo "$b: Unknown file type"
- exit 1
- ;;
- esac
- done
-
-cat >$LIBDIR/Makefile <<EOF
-source=$SRCS
-lib-dest=birdlib.a
-root-rel=../
-
-include ../Rules
-EOF
-
-sed <$SRCDIR/conf/Makefile >$CONFDIR/Makefile "s|@CONFS@|$CONFS|"
-CONFS=`cd $SRCDIR ; ls conf/*.[chl]`
-for a in $CONFS ; do
- ln -s $SRCREL/$a $CONFDIR/
-done
diff --git a/tools/progdoc b/tools/progdoc
index ef44d3aa..fc4024bf 100755
--- a/tools/progdoc
+++ b/tools/progdoc
@@ -1,17 +1,18 @@
#!/usr/bin/perl
$srcdir = $ARGV[0];
+$out = $ARGV[1];
-open(OUT, ">prog.sgml") || die "Cannot create output file";
-include("doc/prog-head.sgml");
-process("");
-include("doc/prog-foot.sgml");
+open(OUT, ">", $out) || die "Cannot create output file";
+process($srcdir);
close OUT;
+gen_deps();
exit 0;
sub include {
my $f = shift @_;
- open(IN, "$srcdir/$f") || die "Unable to find $f";
+ open(IN, "$f") || die "Unable to find $f";
+ push(@deps, "$f");
while (<IN>) {
print OUT;
}
@@ -21,7 +22,8 @@ sub include {
sub process {
my $dir = shift @_;
print "$dir/Doc\n";
- open(IN, "$srcdir/$dir/Doc") || die "Unable to read $dir/Doc";
+ open(IN, "$dir/Doc") || die "Unable to read $dir/Doc";
+ push(@deps, "$dir/Doc");
my @docfile = <IN>;
close IN;
foreach $_ (@docfile) {
@@ -36,7 +38,10 @@ sub process {
print OUT "<chapt>$arg\n";
} elsif ($cmd eq "S") {
print " $arg\n";
- open(DOC, "cd $srcdir/$dir ; $srcdir/doc/kernel-doc -bird $arg |") || die "Unable to start kernel-doc";
+ my @files = map("$dir/$_", split(' ', $arg));
+ my $fargs = join(' ', @files);
+ open(DOC, "$srcdir/doc/kernel-doc -bird $fargs |") || die "Unable to start kernel-doc";
+ push(@deps, @files);
while (<DOC>) { print OUT; }
close DOC;
} elsif ($cmd eq "D") {
@@ -45,3 +50,17 @@ sub process {
} else { die "Unknown command: $cmd"; }
}
}
+
+sub gen_deps {
+ open(DEP, ">", "$out.d");
+ print DEP "$out:";
+ foreach $f (@deps) {
+ print DEP " \\\n $f";
+ }
+ print DEP "\n\n";
+
+ foreach $f (@deps) {
+ print DEP "$f:\n\n";
+ }
+ close DEP;
+}