X-Git-Url: http://git.onelab.eu/?p=iproute2.git;a=blobdiff_plain;f=Makefile;h=c363cf36fe57eee7695f155cbab4fa20a6616bdc;hp=1d11462b7ad1c89c3f3fdec29bac2e4f3d2898f2;hb=HEAD;hpb=4f7d3057911ebc5df78113896cb02e1b4ffbfabe diff --git a/Makefile b/Makefile index 1d11462..c363cf3 100644 --- a/Makefile +++ b/Makefile @@ -1,68 +1,61 @@ -DESTDIR= -SBINDIR=/usr/sbin -CONFDIR=/etc/iproute2 -DOCDIR=/usr/share/doc/iproute2 -MANDIR=/usr/share/man -KERNEL_INCLUDE=/usr/include - -# Path to db_185.h include -DBM_INCLUDE:=/usr/include - -DEFINES= -DRESOLVE_HOSTNAMES - -#options if you have a bind>=4.9.4 libresolv (or, maybe, glibc) -LDLIBS=-lresolv -ADDLIB= - -#options for decnet -ADDLIB+=dnet_ntop.o dnet_pton.o - -#options for ipx -ADDLIB+=ipx_ntop.o ipx_pton.o - -CC = gcc -HOSTCC = gcc -CCOPTS = -D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -CFLAGS = $(CCOPTS) -I../include $(DEFINES) - -LDLIBS += -L../lib -lnetlink -lutil - -SUBDIRS=lib ip tc misc netem - -LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a - -all: Config - @for i in $(SUBDIRS); \ - do $(MAKE) $(MFLAGS) -C $$i; done - -Config: - ./configure $(KERNEL_INCLUDE) - -install: all - install -m 0755 -d $(DESTDIR)$(SBINDIR) - install -m 0755 -d $(DESTDIR)$(CONFDIR) - install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples - install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples/diffserv - install -m 0644 README.iproute2+tc $(shell find examples -maxdepth 1 -type f) \ - $(DESTDIR)$(DOCDIR)/examples - install -m 0644 $(shell find examples/diffserv -maxdepth 1 -type f) \ - $(DESTDIR)$(DOCDIR)/examples/diffserv - @for i in $(SUBDIRS) doc; do $(MAKE) -C $$i install; done - install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONFDIR) - install -m 0755 -d $(DESTDIR)$(MANDIR)/man8 - install -m 0644 $(shell find man/man8 -maxdepth 1 -type f) $(DESTDIR)$(MANDIR)/man8 - ln -sf $(MANDIR)/man8/tc-pbfifo.8 $(DESTDIR)$(MANDIR)/man8/tc-bfifo.8 - ln -sf $(MANDIR)/man8/tc-pbfifo.8 $(DESTDIR)$(MANDIR)/man8/tc-pfifo.8 - install -m 0755 -d $(DESTDIR)$(MANDIR)/man3 - install -m 0644 $(shell find man/man3 -maxdepth 1 -type f) $(DESTDIR)$(MANDIR)/man3 +# +WEBFETCH := wget +SHA1SUM := sha1sum + +ALL += iproute2 +#iproute2-URL := http://devresources.linuxfoundation.org/dev/iproute2/download/iproute2-2.6.38.tar.bz2 +iproute2-URL := http://mirror.onelab.eu/third-party/iproute2-2.6.38.tar.bz2 +iproute2-SHA1SUM := e9f6d457a06866a2a20a6cba6b3a039b2ec3e14a +iproute2 := $(notdir $(iproute2-URL)) + +all: $(ALL) +.PHONY: all + +############################## +define download_target +$(1): $($(1)) +.PHONY: $($(1)) +$($(1)): + @if [ ! -e "$($(1))" ] ; then echo "$(WEBFETCH) $($(1)-URL)" ; $(WEBFETCH) $($(1)-URL) ; fi + @if [ ! -e "$($(1))" ] ; then echo "Could not download source file: $($(1)) does not exist" ; exit 1 ; fi + @if test "$$$$($(SHA1SUM) $($(1)) | awk '{print $$$$1}')" != "$($(1)-SHA1SUM)" ; then \ + echo "sha1sum of the downloaded $($(1)) does not match the one from 'Makefile'" ; \ + echo "Local copy: $$$$($(SHA1SUM) $($(1)))" ; \ + echo "In Makefile: $($(1)-SHA1SUM)" ; \ + false ; \ + else \ + ls -l $($(1)) ; \ + fi +endef + +$(eval $(call download_target,iproute2)) + +sources: $(ALL) +.PHONY: sources + +#################### +# default - overridden by the build +SPECFILE = iproute.spec + +PWD=$(shell pwd) +PREPARCH ?= noarch +RPMDIRDEFS = --define "_sourcedir $(PWD)" --define "_builddir $(PWD)" --define "_srcrpmdir $(PWD)" --define "_rpmdir $(PWD)" +trees: sources + rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bp --target $(PREPARCH) $(SPECFILE) + +srpm: sources + rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bs $(SPECFILE) + +TARGET ?= $(shell uname -m) +rpm: sources + rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps --target $(TARGET) -bb $(SPECFILE) clean: - @for i in $(SUBDIRS) doc; \ - do $(MAKE) $(MFLAGS) -C $$i clean; done - -clobber: clean - rm -f Config - -distclean: clean clobber - -.EXPORT_ALL_VARIABLES: + rm -f *.rpm *.tgz *.bz2 *.gz + +++%: varname=$(subst +,,$@) +++%: + @echo "$(varname)=$($(varname))" ++%: varname=$(subst +,,$@) ++%: + @echo "$($(varname))"