Statistics
| Branch: | Revision:

iof-bird-daemon / Makefile.in @ milani/bird-2.0.1

History | View | Annotate | Download (4.9 KB)

1 7152e5ef Jan Moskyto Matejka
# 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 65d2a88d Pavel Tvrdík
DAEMON_LIBS=@DAEMON_LIBS@
14 7152e5ef Jan Moskyto Matejka
CLIENT_LIBS=@CLIENT_LIBS@
15
CC=@CC@
16
M4=@M4@
17
BISON=@BISON@
18
FLEX=@FLEX@
19
RANLIB=@RANLIB@
20
INSTALL=@INSTALL@
21
INSTALL_PROGRAM=@INSTALL_PROGRAM@
22
INSTALL_DATA=@INSTALL_DATA@
23
24 c36a298c Ondrej Zajicek (work)
git-label:=$(strip $(shell git describe --always --dirty=-x 2>/dev/null))
25
ifneq ($(git-label),)
26
        CFLAGS += -DGIT_LABEL="$(git-label)"
27
endif
28
29 7152e5ef Jan Moskyto Matejka
client=$(addprefix $(exedir)/,@CLIENT@)
30
daemon=$(exedir)/bird
31 9b0a0ba9 Ondrej Zajicek (work)
protocols=@protocols@
32 7152e5ef Jan Moskyto Matejka
33
prefix=@prefix@
34
exec_prefix=@exec_prefix@
35
bindir=@bindir@
36
sbindir=@sbindir@
37
sysconfdir=@sysconfdir@
38
localstatedir=@localstatedir@
39
docdir=@prefix@/doc
40
41
srcdir := @srcdir@
42
objdir := @objdir@
43
exedir := @exedir@
44
45
ifeq ($(objdir),.)
46
  objdir := $(realpath .)
47
endif
48
49
ifeq ($(VERBOSE),)
50 d6f027ef Ondrej Zajicek (work)
  E:=@
51 7152e5ef Jan Moskyto Matejka
  Q:=@
52
else
53 d6f027ef Ondrej Zajicek (work)
  E:=@\#
54 7152e5ef Jan Moskyto Matejka
  Q:=
55
endif
56
57
# Meta rules
58
docgoals := docs userdocs progdocs
59 9b0a0ba9 Ondrej Zajicek (work)
testgoals := check test tests tests_run
60
cleangoals := clean distclean testsclean
61
.PHONY: all daemon cli $(docgoals) $(testgoals) $(cleangoals) tags
62 7152e5ef Jan Moskyto Matejka
all: daemon cli
63
64
daemon: $(daemon)
65
cli: $(client)
66
67 65d2a88d Pavel Tvrdík
$(daemon): LIBS += $(DAEMON_LIBS)
68
69 7152e5ef Jan Moskyto Matejka
# Include directories
70 9b0a0ba9 Ondrej Zajicek (work)
dirs := client conf doc filter lib nest test $(addprefix proto/,$(protocols)) @sysdep_dirs@
71 7152e5ef Jan Moskyto Matejka
72
conf-y-targets := $(addprefix $(objdir)/conf/,cf-parse.y keywords.h commands.h)
73
cf-local = $(conf-y-targets): $(s)config.Y
74
75
src-o-files = $(patsubst %.c,$(o)%.o,$(src))
76 9b0a0ba9 Ondrej Zajicek (work)
tests-target-files = $(patsubst %.c,$(o)%,$(tests_src))
77 7152e5ef Jan Moskyto Matejka
78 9b0a0ba9 Ondrej Zajicek (work)
all-daemon = $(daemon): $(obj)
79
all-client = $(client): $(obj)
80 7152e5ef Jan Moskyto Matejka
81
s = $(dir $(lastword $(MAKEFILE_LIST)))
82
ifeq ($(srcdir),.)
83
  o = $(objdir)/$(s)
84
else
85
  o = $(patsubst $(srcdir)%,$(objdir)%,$(s))
86
endif
87
88
define clean_in =
89
clean::
90
	rm -f $(addprefix $(o),$(1))
91
endef
92
93
clean = $(eval $(call clean_in,$(1)))
94
95
include $(addsuffix /Makefile,$(addprefix $(srcdir)/,$(dirs)))
96
97
# Generic rules
98
99
$(objdir)/%.o: $(srcdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h
100 d6f027ef Ondrej Zajicek (work)
	$(E)echo CC -o $@ -c $<
101 7152e5ef Jan Moskyto Matejka
	$(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -c $<
102
103
$(objdir)/%.o: $(objdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h
104 d6f027ef Ondrej Zajicek (work)
	$(E)echo CC -o $@ -c $<
105 7152e5ef Jan Moskyto Matejka
	$(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -c $<
106
107 a2fd34f8 Jan Moskyto Matejka
108
$(objdir)/%.S: $(srcdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h
109
	$(E)echo CC -o $@ -S $<
110
	$(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -S $<
111
112
$(objdir)/%.S: $(objdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h
113
	$(E)echo CC -o $@ -S $<
114
	$(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -S $<
115
116
117
118 7152e5ef Jan Moskyto Matejka
$(objdir)/.dir-stamp:
119 d6f027ef Ondrej Zajicek (work)
	$(E)echo MKDIR -p $(addprefix $(objdir)/,$(dirs) doc)
120 7152e5ef Jan Moskyto Matejka
	$(Q)mkdir -p $(addprefix $(objdir)/,$(dirs) doc)
121
	$(Q)touch $@
122
123
$(client) $(daemon):
124 d6f027ef Ondrej Zajicek (work)
	$(E)echo LD $(LDFLAGS) -o $@ $^ $(LIBS)
125 7152e5ef Jan Moskyto Matejka
	$(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
126
127
$(objdir)/sysdep/paths.h: Makefile
128
	echo  >$@ "/* Generated by Makefile, don't edit manually! */"
129
	echo >>$@ "#define PATH_CONFIG_FILE \"@CONFIG_FILE@\""
130
	echo >>$@ "#define PATH_CONTROL_SOCKET \"@CONTROL_SOCKET@\""
131
	if test -n "@iproutedir@" ; then echo >>$@ "#define PATH_IPROUTE_DIR \"@iproutedir@\"" ; fi
132
133 9b0a0ba9 Ondrej Zajicek (work)
# Unit tests rules
134
135
tests_targets_ok = $(addsuffix .ok,$(tests_targets))
136
137
$(tests_targets): %: %.o $(tests_objs)
138 7d5e61a6 Ondrej Zajicek (work)
	$(E)echo LD $(LDFLAGS) -o $@ $< "..." $(LIBS)
139 9b0a0ba9 Ondrej Zajicek (work)
	$(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
140
141 7d5e61a6 Ondrej Zajicek (work)
# Hack to avoid problems with tests linking everything
142
$(tests_targets): LIBS += $(DAEMON_LIBS)
143
144 9b0a0ba9 Ondrej Zajicek (work)
$(tests_targets_ok): %.ok: %
145
	$(Q)$* 2>/dev/null && touch $*.ok
146
147
test: testsclean check
148
check: tests tests_run
149
tests: $(tests_targets)
150
tests_run: $(tests_targets_ok)
151
152 7152e5ef Jan Moskyto Matejka
# Finally include the computed dependencies
153
154
ifneq ($(filter-out $(cleangoals),$(MAKECMDGOALS)),)
155
-include $(shell find $(objdir) -name "*.d")
156
endif
157
158
ifeq ($(MAKECMDGOALS),)
159
-include $(shell find $(objdir) -name "*.d")
160
endif
161
162
tags:
163
	cd $(srcdir) ; etags -lc `find $(dirs) -name *.[chY]`
164
165
# Install
166
167
install: all
168
	$(INSTALL) -d $(DESTDIR)/$(sbindir) $(DESTDIR)/$(sysconfdir) $(DESTDIR)/@runtimedir@
169
	$(INSTALL_PROGRAM) $(exedir)/bird $(DESTDIR)/$(sbindir)/bird
170
	$(INSTALL_PROGRAM) $(exedir)/birdcl $(DESTDIR)/$(sbindir)/birdcl
171
	if test -n "@CLIENT@" ; then								\
172
		$(INSTALL_PROGRAM) $(exedir)/birdc $(DESTDIR)/$(sbindir)/birdc ;		\
173
	fi
174
	if ! test -f $(DESTDIR)/@CONFIG_FILE@ ; then						\
175
		$(INSTALL_DATA) $(srcdir)/doc/bird.conf.example $(DESTDIR)/@CONFIG_FILE@ ;	\
176
	else											\
177
		echo "Not overwriting old bird.conf" ;						\
178
	fi
179
180
install-docs:
181
	$(INSTALL) -d $(DESTDIR)/$(docdir)
182
	$(INSTALL_DATA) $(objdir)/doc/{bird,prog}{,-*}.html $(DESTDIR)/$(docdir)/
183
184
# Cleanup
185
clean::
186
	rm -f $(objdir)/sysdep/paths.h
187
	rm -f $(addprefix $(exedir)/,bird birdc birdcl)
188
	find $(objdir) -name "*.[od]" -exec rm -f '{}' '+'
189
190 9b0a0ba9 Ondrej Zajicek (work)
testsclean:
191
	rm -f $(tests_targets_ok)
192
193 7152e5ef Jan Moskyto Matejka
ifeq ($(objdir),obj)
194
distclean: clean
195
	rm -rf $(objdir)
196
	rm -f config.log config.status configure Makefile
197
else
198
distclean: clean
199
	rm -rf * .dir-stamp
200
	rm -f config.log config.status configure Makefile
201
endif