Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (1.12 KB)

1
# Makefile fragments for the BIRD Internet Routing Daemon
2
# (c) 1999 Martin Mares <mj@ucw.cz>
3

    
4
srcdir=@srcdir_rel_mf@
5
objdir=@objdir@
6
exedir=@exedir@
7

    
8
protocols=@protocols@
9
static-dirs := nest $(addprefix proto/,$(protocols))
10
static-dir-paths := $(addprefix $(srcdir)/,$(static-dirs))
11
dynamic-dirs := lib conf
12
dynamic-dir-paths := $(dynamic-dirs)
13
dir-makefiles := $(addsuffix /Makefile,$(static-dir-paths) $(dynamic-dir-paths))
14

    
15
all-dirs:=$(static-dirs) $(dynamic-dirs)
16
clean-dirs:=$(all-dirs) proto sysdep
17
dir-objs:=$(addprefix $(objdir)/,$(all-dirs))
18

    
19
CPPFLAGS=-I$(root-rel) -I$(srcdir)
20
CFLAGS=$(CPPFLAGS) @CFLAGS@
21
CC=@CC@
22
M4=@M4@
23
BISON=@BISON@
24
FLEX=@FLEX@
25
RANLIB=@RANLIB@
26

    
27
ifdef source
28

    
29
objs := $(subst .c,.o,$(source))
30

    
31
ifdef dir-name
32
src-path := $(srcdir)/$(dir-name)/
33
endif
34

    
35
all:
36
	cd $(root-rel) && make
37

    
38
ifdef lib-dest
39

    
40
subdir: $(lib-dest)
41

    
42
$(lib-dest): $(objs)
43
	rm -f $@
44
	ar rcs $@ $^
45
	$(RANLIB) $@
46

    
47
else
48

    
49
subdir: all.o
50

    
51
all.o: $(objs)
52
	$(LD) -r -o $@ $^
53

    
54
endif
55

    
56
%.o: $(src-path)%.c
57
	$(CC) $(CFLAGS) -o $@ -c $<
58

    
59
depend:
60
	gcc $(CPPFLAGS) -MM $(addprefix $(src-path),$(source)) >depend
61

    
62
ifneq ($(wildcard depend),)
63
include depend
64
endif
65

    
66
endif