]> git.ipfire.org Git - thirdparty/bird.git/blobdiff - Makefile.in
Doc: Fix typo in previous LinuxDoc change
[thirdparty/bird.git] / Makefile.in
index 25af140cbec96693694ef964174fffbc8af84e6b..0ecd68114db680d863459d5e698c8e4e6cd1c2b9 100644 (file)
@@ -9,6 +9,8 @@ MAKEFLAGS += -r
 CPPFLAGS=-I$(objdir) -I$(srcdir) @CPPFLAGS@
 CFLAGS=$(CPPFLAGS) @CFLAGS@
 LDFLAGS=@LDFLAGS@
+M4FLAGS=@M4FLAGS@
+BISONFLAGS=@BISONFLAGS@
 LIBS=@LIBS@
 DAEMON_LIBS=@DAEMON_LIBS@
 CLIENT_LIBS=@CLIENT_LIBS@
@@ -31,12 +33,18 @@ bindir=@bindir@
 sbindir=@sbindir@
 sysconfdir=@sysconfdir@
 localstatedir=@localstatedir@
+runstatedir=@runstatedir@
 docdir=@prefix@/doc
 
 srcdir := @srcdir@
 objdir := @objdir@
 exedir := @exedir@
 
+git-label:=$(strip $(shell cd $(srcdir) && [ "$$(git rev-parse --show-toplevel)" = "$$(readlink -f .)" ] && git describe --always --dirty=-x 2>/dev/null))
+ifneq ($(git-label),)
+        CFLAGS += -DGIT_LABEL="$(git-label)"
+endif
+
 ifeq ($(objdir),.)
   objdir := $(realpath .)
 endif
@@ -49,11 +57,15 @@ else
   Q:=
 endif
 
+ifneq ($(COLOR),)
+  CFLAGS += -fdiagnostics-color=always
+endif
+
 # Meta rules
 docgoals := docs userdocs progdocs
 testgoals := check test tests tests_run
 cleangoals := clean distclean testsclean
-.PHONY: all daemon cli $(docgoals) $(testgoals) $(cleangoals) tags
+.PHONY: all daemon cli $(docgoals) $(testgoals) $(cleangoals) tags cscope
 all: daemon cli
 
 daemon: $(daemon)
@@ -90,7 +102,7 @@ clean = $(eval $(call clean_in,$(1)))
 include $(addsuffix /Makefile,$(addprefix $(srcdir)/,$(dirs)))
 
 # Generic rules
-
+# Object file rules
 $(objdir)/%.o: $(srcdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h
        $(E)echo CC -o $@ -c $<
        $(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -c $<
@@ -99,7 +111,16 @@ $(objdir)/%.o: $(objdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h
        $(E)echo CC -o $@ -c $<
        $(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -c $<
 
+# Debug: Preprocessed source rules
+$(objdir)/%.E: $(srcdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h
+       $(E)echo CC -o $@ -E $<
+       $(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -E $<
 
+$(objdir)/%.E: $(objdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h
+       $(E)echo CC -o $@ -E $<
+       $(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -E $<
+
+# Debug: Assembler object rules
 $(objdir)/%.S: $(srcdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h
        $(E)echo CC -o $@ -S $<
        $(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -S $<
@@ -130,9 +151,12 @@ $(objdir)/sysdep/paths.h: Makefile
 tests_targets_ok = $(addsuffix .ok,$(tests_targets))
 
 $(tests_targets): %: %.o $(tests_objs)
-       $(E)echo LD $(LDFLAGS) -o $@ $^ $(LIBS)
+       $(E)echo LD $(LDFLAGS) -o $@ $< "..." $(LIBS)
        $(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
 
+# Hack to avoid problems with tests linking everything
+$(tests_targets): LIBS += $(DAEMON_LIBS)
+
 $(tests_targets_ok): %.ok: %
        $(Q)$* 2>/dev/null && touch $*.ok
 
@@ -154,15 +178,16 @@ endif
 tags:
        cd $(srcdir) ; etags -lc `find $(dirs) -name *.[chY]`
 
+cscope:
+       cd $(srcdir) ; find $(dirs) -name *.[chY] > cscope.files ; cscope -b
+
 # Install
 
 install: all
-       $(INSTALL) -d $(DESTDIR)/$(sbindir) $(DESTDIR)/$(sysconfdir) $(DESTDIR)/@runtimedir@
-       $(INSTALL_PROGRAM) $(exedir)/bird $(DESTDIR)/$(sbindir)/bird
-       $(INSTALL_PROGRAM) $(exedir)/birdcl $(DESTDIR)/$(sbindir)/birdcl
-       if test -n "@CLIENT@" ; then                                                            \
-               $(INSTALL_PROGRAM) $(exedir)/birdc $(DESTDIR)/$(sbindir)/birdc ;                \
-       fi
+       $(INSTALL) -d $(DESTDIR)/$(sbindir) $(DESTDIR)/$(sysconfdir) $(DESTDIR)/$(runstatedir)
+       for BIN in bird @CLIENT@ ; do                                                           \
+               $(INSTALL_PROGRAM) $(exedir)/$$BIN $(DESTDIR)/$(sbindir)/$$BIN ;                \
+       done
        if ! test -f $(DESTDIR)/@CONFIG_FILE@ ; then                                            \
                $(INSTALL_DATA) $(srcdir)/doc/bird.conf.example $(DESTDIR)/@CONFIG_FILE@ ;      \
        else                                                                                    \