Annotation of embedaddon/pimd/Makefile, revision 1.1.1.1

1.1       misho       1: # -*-Makefile-*-
                      2: #
                      3: # Note: We use .gz for distribution archives for the sake of
                      4: #       OpenBSD not having bzip2 in the base distribution.
                      5: #
                      6: 
                      7: #VERSION       = $(shell git tag -l | tail -1)
                      8: VERSION       = 2.3.2
                      9: EXEC          = pimd
                     10: CONFIG        = $(EXEC).conf
                     11: PKG           = $(EXEC)-$(VERSION)
                     12: ARCHTOOL      = `which git-archive-all`
                     13: ARCHIVE       = $(PKG).tar
                     14: ARCHIVEZ      = ../$(ARCHIVE).gz
                     15: 
                     16: ROOTDIR      ?= $(dir $(shell pwd))
                     17: RM            = rm -f
                     18: CC           := $(CROSS)$(CC)
                     19: CHECK        := cppcheck $(CPPFLAGS) --quiet --enable=all
                     20: 
                     21: IGMP_OBJS     = igmp.o igmp_proto.o trace.o
                     22: ROUTER_OBJS   = inet.o kern.o main.o config.o debug.o vers.o callout.o
                     23: PIM_OBJS      = route.o vif.o timer.o mrt.o pim.o pim_proto.o rp.o
                     24: DVMRP_OBJS    = dvmrp_proto.o
                     25: 
                     26: # This magic trick looks like a comment, but works on BSD PMake
                     27: #include <config.mk>
                     28: include config.mk
                     29: 
                     30: prefix       ?= /usr/local
                     31: sysconfdir   ?= /etc
                     32: datadir       = $(prefix)/share/doc/pimd
                     33: mandir        = $(prefix)/share/man/man8
                     34: 
                     35: ## Common
                     36: CPPFLAGS     += -D_PATH_SYSCONF=\"$(sysconfdir)\"
                     37: CFLAGS       += $(INCLUDES) $(DEFS) $(USERCOMPILE)
                     38: CFLAGS       += -W -Wall -Wextra -fno-strict-aliasing
                     39: LDLIBS        = $(EXTRA_LIBS)
                     40: OBJS          = $(IGMP_OBJS) $(ROUTER_OBJS) $(PIM_OBJS) $(DVMRP_OBJS) $(EXTRA_OBJS)
                     41: SRCS          = $(OBJS:.o=.c)
                     42: MANS          = $(EXEC).8
                     43: DISTFILES     = README.md README-config.md README.config.jp README-debug.md ChangeLog.org \
                     44:                CONTRIBUTING.md CODE-OF-CONDUCT.md INSTALL.md LICENSE LICENSE.mrouted     \
                     45:                TODO.org CREDITS FAQ.md AUTHORS
                     46: 
                     47: 
                     48: all: $(EXEC)
                     49: 
                     50: .c.o:
                     51:        @printf "  CC      $@\n"
                     52:        @$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
                     53: 
                     54: $(EXEC): $(OBJS)
                     55:        @printf "  LINK    $@\n"
                     56:        @$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-Map,$@.map -o $@ $(OBJS) $(LDLIBS)
                     57: 
                     58: vers.c:
                     59:        @echo $(VERSION) | sed -e 's/.*/char todaysversion[]="&";/' > vers.c
                     60: 
                     61: install: $(EXEC)
                     62:        @install -d $(DESTDIR)$(prefix)/sbin
                     63:        @install -d $(DESTDIR)$(sysconfdir)
                     64:        @install -d $(DESTDIR)$(datadir)
                     65:        @install -d $(DESTDIR)$(mandir)
                     66:        @install -m 0755 $(EXEC) $(DESTDIR)$(prefix)/sbin/$(EXEC)
                     67:        @install -b -m 0644 $(CONFIG) $(DESTDIR)$(sysconfdir)/$(CONFIG)
                     68:        @for file in $(DISTFILES); do \
                     69:                install -m 0644 $$file $(DESTDIR)$(datadir)/$$file; \
                     70:        done
                     71:        @for file in $(MANS); do \
                     72:                install -m 0644 $$file $(DESTDIR)$(mandir)/$$file; \
                     73:        done
                     74: 
                     75: uninstall:
                     76:        -@$(RM) $(DESTDIR)$(prefix)/sbin/$(EXEC)
                     77:        -@$(RM) $(DESTDIR)$(sysconfdir)/$(CONFIG)
                     78:        -@$(RM) -r $(DESTDIR)$(datadir)
                     79:        @for file in $(DISTFILES); do \
                     80:                $(RM) $(DESTDIR)$(datadir)/$$file; \
                     81:        done
                     82:        -@for file in $(MANS); do \
                     83:                $(RM) $(DESTDIR)$(mandir)/$$file; \
                     84:        done
                     85: 
                     86: clean:
                     87:        -@$(RM) $(OBJS) $(EXEC)
                     88: 
                     89: distclean:
                     90:        -@$(RM) $(OBJS) core $(EXEC) vers.c config.mk tags TAGS *.o *.map .*.d *.out tags
                     91: 
                     92: dist:
                     93:        @if [ x"$(ARCHTOOL)" = x"" ]; then \
                     94:                echo "Missing git-archive-all from https://github.com/Kentzo/git-archive-all"; \
                     95:                exit 1; \
                     96:        fi
                     97:        @if [ -e $(ARCHIVEZ) ]; then \
                     98:                echo "Distribution $(ARCHIVEZ) already exists."; \
                     99:                exit 1; \
                    100:        fi
                    101:        @echo "Building gz tarball of $(PKG) in parent dir ..."
                    102:        @$(ARCHTOOL) ../$(ARCHIVE)
                    103:        @gzip ../$(ARCHIVE)
                    104:        @md5sum $(ARCHIVEZ) | sed 's/..\///' | tee $(ARCHIVEZ).md5
                    105: 
                    106: build-deb:
                    107:        @echo "Building .deb if $(PKG)..."
                    108:        git-buildpackage --git-ignore-new --git-upstream-branch=master
                    109: 
                    110: check lint:
                    111:        $(CHECK) *.c *.h
                    112: 
                    113: tags: $(SRCS)
                    114:        @ctags $(SRCS)
                    115: 
                    116: cflow:
                    117:        @cflow $(MCAST_INCLUDE) $(SRCS) > cflow.out
                    118: 
                    119: cflow2:
                    120:        @cflow -ix $(MCAST_INCLUDE) $(SRCS) > cflow2.out
                    121: 
                    122: rcflow:
                    123:        @cflow -r $(MCAST_INCLUDE) $(SRCS) > rcflow.out
                    124: 
                    125: rcflow2:
                    126:        @cflow -r -ix $(MCAST_INCLUDE) $(SRCS) > rcflow2.out
                    127: 
                    128: TAGS:
                    129:        @etags $(SRCS)
                    130: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>