Tagging module libnl - libnl-1.1-2
[libnl.git] / Makefile
index b21669a..53dd322 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,64 +1,54 @@
-#
-# Makefile
-#
-#      This library is free software; you can redistribute it and/or
-#      modify it under the terms of the GNU Lesser General Public
-#      License as published by the Free Software Foundation version 2.1
-#      of the License.
-#
-# Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
-#
-
-ifeq ($(shell [ ! -r Makefile.opts ] && echo 1),)
-    include Makefile.opts
-endif
-
-SUBDIRS := lib include doc src
-.PHONY: all clean distclean install gendoc $(SUBDIRS)
-
-all: Makefile.opts
-       @for dir in $(SUBDIRS); do \
-               echo "Entering $$dir" && cd $$dir && $(MAKE) && cd ..; \
-       done
-
-clean: Makefile.opts
-       rm -f cscope.*
-       @for dir in $(SUBDIRS); do \
-               echo "Entering $$dir" && cd $$dir && $(MAKE) clean && cd ..; \
-       done
-
-distclean: clean
-       @$(RM) -rf Makefile.opts autom4te.cache config.log config.status
-       @for dir in $(SUBDIRS); do \
-               echo "Entering $$dir" && cd $$dir && $(MAKE) distclean && cd ..; \
-       done
-
-install: Makefile.opts
-       @for dir in $(SUBDIRS); do \
-               echo "Entering $$dir" && cd $$dir && $(MAKE) install && cd ..; \
-       done
-       mkdir -p $(DESTDIR)$(libdir)/pkgconfig/
-       install -m 0644 libnl-1.pc $(DESTDIR)$(libdir)/pkgconfig/
-
-gendoc:
-       $(MAKE) -C doc gendoc
-
-show: Makefile.opts
-       @echo "CC:          $(CC)"
-       @echo "RM:          $(RM)"
-       @echo "CFLAGS:      $(CFLAGS)"
-       @echo "DEPFLAGS:    $(DEPFLAGS)"
-       @echo "LDFLAGS:     $(LDFLAGS)"
-       @echo "DESTDIR:     $(DESTDIR)"
-       @echo "prefix:      $(prefix)"
-       @echo "libdir:      $(libdir)"
-       @echo "includedir:  $(includedir)"
-
-cscope:
-       cscope -b -q -R -Iinclude -slib -ssrc
-
-
-$(SUBDIRS):
-       cd $@ && $(MAKE)
-
--include Makefile.rules
+# $Id: Makefile 10670 2008-09-26 13:43:51Z thierry $
+CURL   := curl -H Pragma: -O -R -S --fail --show-error
+SHA1SUM        = sha1sum
+
+# default - overridden by the build
+SPECFILE = libnl.spec
+
+version=1.1
+
+main.URL       := http://build.planet-lab.org/third-party/libnl-$(version).tar.gz
+main.SHA1SUM    := 54c7d02f93b09b43338e5cbf42f1373e83566577
+
+main.FILE      := $(notdir $(main.URL))
+
+# Thierry - when called from within the build, PWD is /build
+SOURCEFILES := $(main.FILE)
+
+$(main.FILE): #FORCE
+       @if [ ! -e "$@" ] ; then echo "$(CURL) $(main.URL)" ; $(CURL) $(main.URL) ; fi
+       @if [ ! -e "$@" ] ; then echo "Could not download source file: $@ does not exist" ; exit 1 ; fi
+       @if test "$$(sha1sum $@ | awk '{print $$1}')" != "$(main.SHA1SUM)" ; then \
+           echo "sha1sum of the downloaded $@ does not match the one from 'sources' file" ; \
+           echo "Local copy: $$(sha1sum $@)" ; \
+           echo "In sources: $(main.SHA1SUM)" ; \
+           exit 1 ; \
+       else \
+           ls -l $@ ; \
+       fi
+
+sources: $(SOURCEFILES)
+.PHONY: sources
+
+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:
+       rm -f *.rpm *.tgz *.bz2 *.gz
+
+++%: varname=$(subst +,,$@)
+++%:
+       @echo "$(varname)=$($(varname))"
++%: varname=$(subst +,,$@)
++%:
+       @echo "$($(varname))"