1999-01-10 00:18:32 +00:00
|
|
|
# Makefile fragments for the BIRD Internet Routing Daemon
|
2000-05-05 17:15:56 +00:00
|
|
|
# (c) 1999--2000 Martin Mares <mj@ucw.cz>
|
1999-01-10 00:18:32 +00:00
|
|
|
|
|
|
|
srcdir=@srcdir_rel_mf@
|
2000-05-05 17:15:56 +00:00
|
|
|
srcdir_abs := $(shell cd $(srcdir) ; pwd)
|
1999-01-10 00:18:32 +00:00
|
|
|
objdir=@objdir@
|
|
|
|
exedir=@exedir@
|
|
|
|
|
|
|
|
protocols=@protocols@
|
1999-01-15 16:52:14 +00:00
|
|
|
static-dirs := nest filter $(addprefix proto/,$(protocols))
|
1999-01-10 00:18:32 +00:00
|
|
|
static-dir-paths := $(addprefix $(srcdir)/,$(static-dirs))
|
|
|
|
dynamic-dirs := lib conf
|
|
|
|
dynamic-dir-paths := $(dynamic-dirs)
|
2013-04-19 11:59:08 +00:00
|
|
|
client-dirs := client
|
|
|
|
client-dir-paths := $(client-dirs)
|
2000-05-05 17:15:56 +00:00
|
|
|
doc-dirs := doc
|
|
|
|
doc-dir-paths := $(doc-dirs)
|
1999-01-10 00:18:32 +00:00
|
|
|
|
2013-04-19 11:59:08 +00:00
|
|
|
all-dirs:=$(static-dirs) $(dynamic-dirs) $(client-dirs) $(doc-dirs)
|
1999-01-10 00:18:32 +00:00
|
|
|
clean-dirs:=$(all-dirs) proto sysdep
|
|
|
|
|
1999-05-21 14:28:44 +00:00
|
|
|
CPPFLAGS=-I$(root-rel) -I$(srcdir) @CPPFLAGS@
|
1999-01-10 00:18:32 +00:00
|
|
|
CFLAGS=$(CPPFLAGS) @CFLAGS@
|
2004-08-19 09:15:36 +00:00
|
|
|
LDFLAGS=@LDFLAGS@
|
1999-03-04 11:36:26 +00:00
|
|
|
LIBS=@LIBS@
|
2000-01-20 13:13:30 +00:00
|
|
|
CLIENT_LIBS=@CLIENT_LIBS@
|
1999-01-10 00:18:32 +00:00
|
|
|
CC=@CC@
|
|
|
|
M4=@M4@
|
|
|
|
BISON=@BISON@
|
|
|
|
FLEX=@FLEX@
|
|
|
|
RANLIB=@RANLIB@
|
2000-05-08 13:54:59 +00:00
|
|
|
INSTALL=@INSTALL@
|
|
|
|
INSTALL_PROGRAM=@INSTALL_PROGRAM@
|
|
|
|
INSTALL_DATA=@INSTALL_DATA@
|
|
|
|
|
|
|
|
prefix=@prefix@
|
|
|
|
exec_prefix=@exec_prefix@
|
|
|
|
bindir=@bindir@
|
|
|
|
sbindir=@sbindir@
|
|
|
|
sysconfdir=@sysconfdir@
|
2000-05-08 14:19:47 +00:00
|
|
|
localstatedir=@localstatedir@
|
2000-06-09 06:31:43 +00:00
|
|
|
docdir=@prefix@/doc
|
1999-01-10 00:18:32 +00:00
|
|
|
|
2015-03-23 16:40:13 +00:00
|
|
|
|
|
|
|
tests_sources := $(wildcard $(srcdir)/$(dir-name)/*_test.c)
|
|
|
|
tests_executables := $(notdir $(basename $(tests_sources)))
|
|
|
|
|
|
|
|
tests: $(tests_executables)
|
|
|
|
|
2015-04-15 10:07:10 +00:00
|
|
|
%_test.o: $(srcdir)/$(dir-name)/%_test.c
|
2015-07-29 08:41:37 +00:00
|
|
|
$(CC) $(CFLAGS) $^ -c -o $@ $(LDFLAGS)
|
2015-04-15 10:07:10 +00:00
|
|
|
|
|
|
|
%_test: $(srcdir)/$(dir-name)/%_test.o $(root-rel)test/birdtest.o
|
2015-07-29 08:41:37 +00:00
|
|
|
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
|
2015-03-13 17:23:31 +00:00
|
|
|
|
1999-01-10 00:18:32 +00:00
|
|
|
ifdef source
|
|
|
|
|
|
|
|
objs := $(subst .c,.o,$(source))
|
|
|
|
|
2015-03-13 17:23:31 +00:00
|
|
|
|
|
|
|
ifndef dynamic-dir
|
1999-01-10 00:18:32 +00:00
|
|
|
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)
|
2010-08-04 11:53:52 +00:00
|
|
|
# $(LD) -r -o $@ $^
|
|
|
|
# Changed to $(CC) because $(LD) has problems with crosscompiling
|
|
|
|
$(CC) -nostdlib -r -o $@ $^
|
1999-01-10 00:18:32 +00:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
%.o: $(src-path)%.c
|
1999-01-12 20:36:18 +00:00
|
|
|
$(CC) $(CFLAGS) -o $@ -c $<
|
1999-01-10 00:18:32 +00:00
|
|
|
|
2013-04-19 11:59:08 +00:00
|
|
|
ifndef source-dep
|
|
|
|
source-dep := $(source)
|
|
|
|
endif
|
|
|
|
|
1999-01-10 00:18:32 +00:00
|
|
|
depend:
|
2015-04-03 10:40:07 +00:00
|
|
|
$(CC) $(CPPFLAGS) -MM $(addprefix $(src-path),$(source-dep)) $(tests_sources) >depend
|
1999-01-10 00:18:32 +00:00
|
|
|
|
1999-01-12 20:36:18 +00:00
|
|
|
ifneq ($(wildcard depend),)
|
|
|
|
include depend
|
1999-01-10 00:18:32 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|