From 49e7e5ee0b2848f5bf120a962e2e7eb11b86566a Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sun, 10 Jan 1999 00:18:32 +0000 Subject: New makefiles. Includes support for out-of-source-tree builds. --- tools/Rules.in | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 tools/Rules.in (limited to 'tools/Rules.in') diff --git a/tools/Rules.in b/tools/Rules.in new file mode 100644 index 0000000..56c0903 --- /dev/null +++ b/tools/Rules.in @@ -0,0 +1,66 @@ +# Makefile fragments for the BIRD Internet Routing Daemon +# (c) 1999 Martin Mares + +srcdir=@srcdir_rel_mf@ +objdir=@objdir@ +exedir=@exedir@ + +protocols=@protocols@ +static-dirs := nest $(addprefix proto/,$(protocols)) +static-dir-paths := $(addprefix $(srcdir)/,$(static-dirs)) +dynamic-dirs := lib conf +dynamic-dir-paths := $(dynamic-dirs) +dir-makefiles := $(addsuffix /Makefile,$(static-dir-paths) $(dynamic-dir-paths)) + +all-dirs:=$(static-dirs) $(dynamic-dirs) +clean-dirs:=$(all-dirs) proto sysdep +dir-objs:=$(addprefix $(objdir)/,$(all-dirs)) + +CPPFLAGS=-I$(root-rel) -I$(srcdir) +CFLAGS=$(CPPFLAGS) @CFLAGS@ +CC=@CC@ +M4=@M4@ +BISON=@BISON@ +FLEX=@FLEX@ +RANLIB=@RANLIB@ + +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 $@ $^ + +endif + +%.o: $(src-path)%.c + $(CC) $(CFLAGS) -o $@ -c $^ + +depend: + gcc $(CPPFLAGS) -MM $(addprefix $(src-path),$(source)) >depend + +ifneq ($(wildcard .depend),) +include .depend +endif + +endif -- cgit v1.2.3