Rules.in 1.67 KB
Newer Older
1
# Makefile fragments for the BIRD Internet Routing Daemon
2
# (c) 1999--2000 Martin Mares <mj@ucw.cz>
3 4

srcdir=@srcdir_rel_mf@
5
srcdir_abs := $(shell cd $(srcdir) ; pwd)
6 7 8 9
objdir=@objdir@
exedir=@exedir@

protocols=@protocols@
10
static-dirs := nest filter $(addprefix proto/,$(protocols))
11 12 13
static-dir-paths := $(addprefix $(srcdir)/,$(static-dirs))
dynamic-dirs := lib conf
dynamic-dir-paths := $(dynamic-dirs)
14 15
client-dirs := client
client-dir-paths := $(client-dirs)
16 17
doc-dirs := doc
doc-dir-paths := $(doc-dirs)
18

19
all-dirs:=$(static-dirs) $(dynamic-dirs) $(client-dirs) $(doc-dirs)
20 21
clean-dirs:=$(all-dirs) proto sysdep

22
CPPFLAGS=-I$(root-rel) -I$(srcdir) @CPPFLAGS@
23
CFLAGS=$(CPPFLAGS) @CFLAGS@
24
LDFLAGS=@LDFLAGS@
25
LIBS=@LIBS@
26
CLIENT_LIBS=@CLIENT_LIBS@
27 28 29 30 31
CC=@CC@
M4=@M4@
BISON=@BISON@
FLEX=@FLEX@
RANLIB=@RANLIB@
32 33 34 35 36 37 38 39 40
INSTALL=@INSTALL@
INSTALL_PROGRAM=@INSTALL_PROGRAM@
INSTALL_DATA=@INSTALL_DATA@

prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
sbindir=@sbindir@
sysconfdir=@sysconfdir@
41
localstatedir=@localstatedir@
42
docdir=@prefix@/doc
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68

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)
69 70
#       $(LD) -r -o $@ $^
#	Changed to $(CC) because $(LD) has problems with crosscompiling
71 72
	@echo LD -r -o $@ $^
	@$(CC) -nostdlib -r -o $@ $^
73 74 75 76

endif

%.o: $(src-path)%.c
77 78
	@echo CC -o $@ -c $<
	@$(CC) $(CFLAGS) -o $@ -c $<
79

80 81 82 83
ifndef source-dep
source-dep := $(source)
endif

84
depend:
85
	$(CC) $(CPPFLAGS) -MM $(addprefix $(src-path),$(source-dep)) >depend
86

87 88
ifneq ($(wildcard depend),)
include depend
89 90 91
endif

endif