Statistics
| Branch: | Revision:

iof-bird-daemon / Makefile.in @ d6f027ef

History | View | Annotate | Download (3.83 KB)

1
# Makefile for the BIRD Internet Routing Daemon
2
# (c) 1999--2000 Martin Mares <mj@ucw.cz>
3
# (c) 2016       Jan Moskyto Matejka <mq@ucw.cz>
4

    
5
# Disable build-in rules
6
MAKEFLAGS += -r
7

    
8
# Variable definitions
9
CPPFLAGS=-I$(objdir) -I$(srcdir) @CPPFLAGS@
10
CFLAGS=$(CPPFLAGS) @CFLAGS@
11
LDFLAGS=@LDFLAGS@
12
LIBS=@LIBS@
13
CLIENT_LIBS=@CLIENT_LIBS@
14
CC=@CC@
15
M4=@M4@
16
BISON=@BISON@
17
FLEX=@FLEX@
18
RANLIB=@RANLIB@
19
INSTALL=@INSTALL@
20
INSTALL_PROGRAM=@INSTALL_PROGRAM@
21
INSTALL_DATA=@INSTALL_DATA@
22

    
23
client=$(addprefix $(exedir)/,@CLIENT@)
24
daemon=$(exedir)/bird
25
protocols  = @protocols@
26

    
27
prefix=@prefix@
28
exec_prefix=@exec_prefix@
29
bindir=@bindir@
30
sbindir=@sbindir@
31
sysconfdir=@sysconfdir@
32
localstatedir=@localstatedir@
33
docdir=@prefix@/doc
34

    
35
srcdir := @srcdir@
36
objdir := @objdir@
37
exedir := @exedir@
38

    
39
ifeq ($(objdir),.)
40
  objdir := $(realpath .)
41
endif
42

    
43
ifeq ($(VERBOSE),)
44
  E:=@
45
  Q:=@
46
else
47
  E:=@\#
48
  Q:=
49
endif
50

    
51
# Meta rules
52
cleangoals := clean distclean
53
docgoals := docs userdocs progdocs
54
.PHONY: all daemon cli $(cleangoals) $(docgoals) tags
55
all: daemon cli
56

    
57
daemon: $(daemon)
58
cli: $(client)
59

    
60
# Include directories
61
dirs := client conf doc filter lib nest $(addprefix proto/,$(protocols)) @sysdep_dirs@
62

    
63
conf-y-targets := $(addprefix $(objdir)/conf/,cf-parse.y keywords.h commands.h)
64
cf-local = $(conf-y-targets): $(s)config.Y
65

    
66
src-o-files = $(patsubst %.c,$(o)%.o,$(src))
67

    
68
all-daemon = $(exedir)/bird: $(obj)
69
all-client = $(exedir)/birdc $(exedir)/birdcl: $(obj)
70

    
71
s = $(dir $(lastword $(MAKEFILE_LIST)))
72
ifeq ($(srcdir),.)
73
  o = $(objdir)/$(s)
74
else
75
  o = $(patsubst $(srcdir)%,$(objdir)%,$(s))
76
endif
77

    
78
define clean_in =
79
clean::
80
	rm -f $(addprefix $(o),$(1))
81
endef
82

    
83
clean = $(eval $(call clean_in,$(1)))
84

    
85
include $(addsuffix /Makefile,$(addprefix $(srcdir)/,$(dirs)))
86

    
87
# Generic rules
88

    
89
$(objdir)/%.o: $(srcdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h
90
	$(E)echo CC -o $@ -c $<
91
	$(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -c $<
92

    
93
$(objdir)/%.o: $(objdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h
94
	$(E)echo CC -o $@ -c $<
95
	$(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -c $<
96

    
97
$(objdir)/.dir-stamp:
98
	$(E)echo MKDIR -p $(addprefix $(objdir)/,$(dirs) doc)
99
	$(Q)mkdir -p $(addprefix $(objdir)/,$(dirs) doc)
100
	$(Q)touch $@
101

    
102
$(client) $(daemon):
103
	$(E)echo LD $(LDFLAGS) -o $@ $^ $(LIBS)
104
	$(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
105

    
106
$(objdir)/sysdep/paths.h: Makefile
107
	echo  >$@ "/* Generated by Makefile, don't edit manually! */"
108
	echo >>$@ "#define PATH_CONFIG_FILE \"@CONFIG_FILE@\""
109
	echo >>$@ "#define PATH_CONTROL_SOCKET \"@CONTROL_SOCKET@\""
110
	if test -n "@iproutedir@" ; then echo >>$@ "#define PATH_IPROUTE_DIR \"@iproutedir@\"" ; fi
111

    
112
# Finally include the computed dependencies
113

    
114
ifneq ($(filter-out $(cleangoals),$(MAKECMDGOALS)),)
115
-include $(shell find $(objdir) -name "*.d")
116
endif
117

    
118
ifeq ($(MAKECMDGOALS),)
119
-include $(shell find $(objdir) -name "*.d")
120
endif
121

    
122
tags:
123
	cd $(srcdir) ; etags -lc `find $(dirs) -name *.[chY]`
124

    
125
# Install
126

    
127
install: all
128
	$(INSTALL) -d $(DESTDIR)/$(sbindir) $(DESTDIR)/$(sysconfdir) $(DESTDIR)/@runtimedir@
129
	$(INSTALL_PROGRAM) $(exedir)/bird $(DESTDIR)/$(sbindir)/bird
130
	$(INSTALL_PROGRAM) $(exedir)/birdcl $(DESTDIR)/$(sbindir)/birdcl
131
	if test -n "@CLIENT@" ; then								\
132
		$(INSTALL_PROGRAM) $(exedir)/birdc $(DESTDIR)/$(sbindir)/birdc ;		\
133
	fi
134
	if ! test -f $(DESTDIR)/@CONFIG_FILE@ ; then						\
135
		$(INSTALL_DATA) $(srcdir)/doc/bird.conf.example $(DESTDIR)/@CONFIG_FILE@ ;	\
136
	else											\
137
		echo "Not overwriting old bird.conf" ;						\
138
	fi
139

    
140
install-docs:
141
	$(INSTALL) -d $(DESTDIR)/$(docdir)
142
	$(INSTALL_DATA) $(objdir)/doc/{bird,prog}{,-*}.html $(DESTDIR)/$(docdir)/
143

    
144
# Cleanup
145
clean::
146
	rm -f $(objdir)/sysdep/paths.h
147
	rm -f $(addprefix $(exedir)/,bird birdc birdcl)
148
	find $(objdir) -name "*.[od]" -exec rm -f '{}' '+'
149

    
150
ifeq ($(objdir),obj)
151
distclean: clean
152
	rm -rf $(objdir)
153
	rm -f config.log config.status configure Makefile
154
else
155
distclean: clean
156
	rm -rf * .dir-stamp
157
	rm -f config.log config.status configure Makefile
158
endif