Statistics
| Branch: | Revision:

iof-bird-daemon / tools / Rules.in @ b1777248

History | View | Annotate | Download (1.24 KB)

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
objdir=@objdir@
7
exedir=@exedir@
8

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

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

    
22
CPPFLAGS=-I$(root-rel) -I$(srcdir) @CPPFLAGS@
23
CFLAGS=$(CPPFLAGS) @CFLAGS@
24
LDFLAGS=
25
LIBS=@LIBS@
26
CLIENT_LIBS=@CLIENT_LIBS@
27
CC=@CC@
28
M4=@M4@
29
BISON=@BISON@
30
FLEX=@FLEX@
31
RANLIB=@RANLIB@
32

    
33
ifdef source
34

    
35
objs := $(subst .c,.o,$(source))
36

    
37
ifdef dir-name
38
src-path := $(srcdir)/$(dir-name)/
39
endif
40

    
41
all:
42
	cd $(root-rel) && make
43

    
44
ifdef lib-dest
45

    
46
subdir: $(lib-dest)
47

    
48
$(lib-dest): $(objs)
49
	rm -f $@
50
	ar rcs $@ $^
51
	$(RANLIB) $@
52

    
53
else
54

    
55
subdir: all.o
56

    
57
all.o: $(objs)
58
	$(LD) -r -o $@ $^
59

    
60
endif
61

    
62
%.o: $(src-path)%.c
63
	$(CC) $(CFLAGS) -o $@ -c $<
64

    
65
depend:
66
	$(CC) $(CPPFLAGS) -MM $(addprefix $(src-path),$(source)) >depend
67

    
68
ifneq ($(wildcard depend),)
69
include depend
70
endif
71

    
72
endif