iof-bird-daemon / tools / Rules.in @ d2c392d4
History | View | Annotate | Download (1.62 KB)
1 | 49e7e5ee | Martin Mares | # Makefile fragments for the BIRD Internet Routing Daemon |
---|---|---|---|
2 | b1777248 | Martin Mares | # (c) 1999--2000 Martin Mares <mj@ucw.cz> |
3 | 49e7e5ee | Martin Mares | |
4 | srcdir=@srcdir_rel_mf@ |
||
5 | b1777248 | Martin Mares | srcdir_abs := $(shell cd $(srcdir) ; pwd) |
6 | 49e7e5ee | Martin Mares | objdir=@objdir@ |
7 | exedir=@exedir@ |
||
8 | |||
9 | protocols=@protocols@ |
||
10 | ca6dfded | Pavel Machek | static-dirs := nest filter $(addprefix proto/,$(protocols)) |
11 | 49e7e5ee | Martin Mares | static-dir-paths := $(addprefix $(srcdir)/,$(static-dirs)) |
12 | dynamic-dirs := lib conf |
||
13 | dynamic-dir-paths := $(dynamic-dirs) |
||
14 | d2c392d4 | Ondrej Zajicek | client-dirs := client |
15 | client-dir-paths := $(client-dirs) |
||
16 | b1777248 | Martin Mares | doc-dirs := doc |
17 | doc-dir-paths := $(doc-dirs) |
||
18 | 49e7e5ee | Martin Mares | |
19 | d2c392d4 | Ondrej Zajicek | all-dirs:=$(static-dirs) $(dynamic-dirs) $(client-dirs) $(doc-dirs) |
20 | 49e7e5ee | Martin Mares | clean-dirs:=$(all-dirs) proto sysdep |
21 | |||
22 | a70693ca | Martin Mares | CPPFLAGS=-I$(root-rel) -I$(srcdir) @CPPFLAGS@ |
23 | 49e7e5ee | Martin Mares | CFLAGS=$(CPPFLAGS) @CFLAGS@ |
24 | 27e3e5e0 | Martin Mares | LDFLAGS=@LDFLAGS@ |
25 | 7a2105be | Martin Mares | LIBS=@LIBS@ |
26 | 7211be1c | Martin Mares | CLIENT_LIBS=@CLIENT_LIBS@ |
27 | 49e7e5ee | Martin Mares | CC=@CC@ |
28 | M4=@M4@ |
||
29 | BISON=@BISON@ |
||
30 | FLEX=@FLEX@ |
||
31 | RANLIB=@RANLIB@ |
||
32 | d8508f70 | Martin Mares | INSTALL=@INSTALL@ |
33 | INSTALL_PROGRAM=@INSTALL_PROGRAM@ |
||
34 | INSTALL_DATA=@INSTALL_DATA@ |
||
35 | |||
36 | prefix=@prefix@ |
||
37 | exec_prefix=@exec_prefix@ |
||
38 | bindir=@bindir@ |
||
39 | sbindir=@sbindir@ |
||
40 | sysconfdir=@sysconfdir@ |
||
41 | f9254d23 | Martin Mares | localstatedir=@localstatedir@ |
42 | 99955b54 | Martin Mares | docdir=@prefix@/doc |
43 | 49e7e5ee | Martin Mares | |
44 | ifdef source |
||
45 | |||
46 | objs := $(subst .c,.o,$(source)) |
||
47 | |||
48 | ifdef dir-name |
||
49 | src-path := $(srcdir)/$(dir-name)/ |
||
50 | endif |
||
51 | |||
52 | all: |
||
53 | cd $(root-rel) && make |
||
54 | |||
55 | ifdef lib-dest |
||
56 | |||
57 | subdir: $(lib-dest) |
||
58 | |||
59 | $(lib-dest): $(objs) |
||
60 | rm -f $@ |
||
61 | ar rcs $@ $^ |
||
62 | $(RANLIB) $@ |
||
63 | |||
64 | else |
||
65 | |||
66 | subdir: all.o |
||
67 | |||
68 | all.o: $(objs) |
||
69 | 373d3dbe | Ondrej Zajicek | # $(LD) -r -o $@ $^ |
70 | # Changed to $(CC) because $(LD) has problems with crosscompiling |
||
71 | $(CC) -nostdlib -r -o $@ $^ |
||
72 | 49e7e5ee | Martin Mares | |
73 | endif |
||
74 | |||
75 | %.o: $(src-path)%.c |
||
76 | cceb3e7d | Martin Mares | $(CC) $(CFLAGS) -o $@ -c $< |
77 | 49e7e5ee | Martin Mares | |
78 | d2c392d4 | Ondrej Zajicek | ifndef source-dep |
79 | source-dep := $(source) |
||
80 | endif |
||
81 | |||
82 | 49e7e5ee | Martin Mares | depend: |
83 | d2c392d4 | Ondrej Zajicek | $(CC) $(CPPFLAGS) -MM $(addprefix $(src-path),$(source-dep)) >depend |
84 | 49e7e5ee | Martin Mares | |
85 | cceb3e7d | Martin Mares | ifneq ($(wildcard depend),) |
86 | include depend |
||
87 | 49e7e5ee | Martin Mares | endif |
88 | |||
89 | endif |