Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (1.14 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 filter $(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
LDFLAGS=@LIBS@
22
CC=@CC@
23
M4=@M4@
24
BISON=@BISON@
25
FLEX=@FLEX@
26
RANLIB=@RANLIB@
27

    
28
ifdef source
29

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

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

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

    
39
ifdef lib-dest
40

    
41
subdir: $(lib-dest)
42

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

    
48
else
49

    
50
subdir: all.o
51

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

    
55
endif
56

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

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

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

    
67
endif