chiark / gitweb /
volume_id: clean up linux_raid code
[elogind.git] / Makefile
index d7801296bd7c150319aa76110ef6a562e025aeaa..cf8c1d1eedd2a1fdcbf2799175fd6f70b00d0c7b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,3 @@
-# Makefile for udev
 #
 # Copyright (C) 2003-2004 Greg Kroah-Hartman <greg@kroah.com>
 # Copyright (C) 2004-2006 Kay Sievers <kay.sievers@vrfy.org>
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 #
 
-VERSION = 098
+VERSION = 121
 
 # set this to make use of syslog
 USE_LOG = true
@@ -44,15 +43,9 @@ EXTRAS =
 V =
 
 PROGRAMS = \
-       udev                            \
        udevd                           \
-       udevtrigger                     \
-       udevsettle                      \
-       udevcontrol                     \
-       udevmonitor                     \
-       udevinfo                        \
-       udevtest                        \
-       udevstart
+       udevadm                         \
+       test-udev
 
 HEADERS = \
        udev.h                          \
@@ -74,19 +67,19 @@ UDEV_OBJS = \
        udev_utils.o                    \
        udev_utils_string.o             \
        udev_utils_file.o               \
-       udev_utils_run.o                \
+       udevmonitor.o                   \
+       udevinfo.o                      \
+       udevcontrol.o                   \
+       udevtrigger.o                   \
+       udevsettle.o                    \
+       udevtest.o                      \
        udev_sysdeps.o
 LIBUDEV = libudev.a
 
 MAN_PAGES = \
        udev.7                          \
-       udevmonitor.8                   \
        udevd.8                         \
-       udevtrigger.8                   \
-       udevsettle.8                    \
-       udevtest.8                      \
-       udevinfo.8                      \
-       udevstart.8
+       udevadm.8
 
 GEN_HEADERS = \
        udev_version.h
@@ -95,17 +88,16 @@ prefix ?=
 etcdir =       ${prefix}/etc
 sbindir =      ${prefix}/sbin
 usrbindir =    ${prefix}/usr/bin
-usrsbindir =   ${prefix}/usr/sbin
 libudevdir =   ${prefix}/lib/udev
 mandir =       ${prefix}/usr/share/man
 configdir =    ${etcdir}/udev
 udevdir =      /dev
 DESTDIR =
 
-INSTALL = /usr/bin/install -c
+INSTALL = install -c
 INSTALL_PROGRAM = ${INSTALL}
 INSTALL_DATA = ${INSTALL} -m 644
-INSTALL_SCRIPT = ${INSTALL_PROGRAM}
+INSTALL_SCRIPT = ${INSTALL}
 PWD = $(shell pwd)
 
 CROSS_COMPILE ?=
@@ -114,13 +106,13 @@ LD = $(CROSS_COMPILE)gcc
 AR = $(CROSS_COMPILE)ar
 RANLIB = $(CROSS_COMPILE)ranlib
 
-CFLAGS         = -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
+CFLAGS         += -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
 WARNINGS       = -Wstrict-prototypes -Wsign-compare -Wshadow \
                  -Wchar-subscripts -Wmissing-declarations -Wnested-externs \
                  -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes
 CFLAGS         += $(WARNINGS)
 
-LDFLAGS = -Wl,-warn-common
+LDFLAGS += -Wl,-warn-common,--as-needed
 
 OPTFLAGS = -Os
 CFLAGS += $(OPTFLAGS)
@@ -200,7 +192,7 @@ udev_version.h:
        $(Q) echo \#define UDEV_VERSION         \"$(VERSION)\" >> $@
        $(Q) echo \#define UDEV_ROOT            \"$(udevdir)\" >> $@
        $(Q) echo \#define UDEV_CONFIG_FILE     \"$(configdir)/udev.conf\" >> $@
-       $(Q) echo \#define UDEV_RULES_FILE      \"$(configdir)/rules.d\" >> $@
+       $(Q) echo \#define UDEV_RULES_DIR       \"$(configdir)/rules.d\" >> $@
 
 # man pages
 %.8 %.7: %.xml
@@ -221,40 +213,33 @@ clean:
        $(Q) - rm -f core $(PROGRAMS) $(GEN_HEADERS)
        $(Q) - rm -f udev-$(VERSION).tar.gz
        $(Q) - rm -f udev-$(VERSION).tar.bz2
+       $(Q) - rm -f udev-git-HEAD.patch
        @ extras="$(EXTRAS)"; for target in $$extras; do \
                $(MAKE) -C $$target $@ || exit 1; \
        done;
 .PHONY: clean
 
-release:
-       git-tar-tree HEAD udev-$(VERSION) | gzip -9v > udev-$(VERSION).tar.gz
-       git-tar-tree HEAD udev-$(VERSION) | bzip2 -9v > udev-$(VERSION).tar.bz2
-.PHONY: release
-
 install-config:
        $(INSTALL) -d $(DESTDIR)$(configdir)/rules.d
        @ if [ ! -r $(DESTDIR)$(configdir)/udev.conf ]; then \
                $(INSTALL_DATA) etc/udev/udev.conf $(DESTDIR)$(configdir); \
        fi
-       @ if [ ! -r $(DESTDIR)$(configdir)/rules.d/50-udev.rules ]; then \
-               echo; \
-               echo "pick a udev rules file from the etc/udev directory that matches your distribution"; \
-               echo; \
-       fi
+       @ for i in etc/udev/rules.d/*.rules; do \
+               if [ ! -r $(DESTDIR)$(configdir)/rules.d/$$(basename $$i) ]; then \
+                       $(INSTALL_DATA) $$i $(DESTDIR)$(configdir)/rules.d; \
+               fi \
+       done
        @ extras="$(EXTRAS)"; for target in $$extras; do \
                $(MAKE) -C $$target $@ || exit 1; \
        done;
 .PHONY: install-config
 
 install-man:
-       $(INSTALL_DATA) -D udev.7 $(DESTDIR)$(mandir)/man7/udev.7
-       $(INSTALL_DATA) -D udevinfo.8 $(DESTDIR)$(mandir)/man8/udevinfo.8
-       $(INSTALL_DATA) -D udevtest.8 $(DESTDIR)$(mandir)/man8/udevtest.8
-       $(INSTALL_DATA) -D udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8
-       $(INSTALL_DATA) -D udevtrigger.8 $(DESTDIR)$(mandir)/man8/udevtrigger.8
-       $(INSTALL_DATA) -D udevsettle.8 $(DESTDIR)$(mandir)/man8/udevsettle.8
-       $(INSTALL_DATA) -D udevmonitor.8 $(DESTDIR)$(mandir)/man8/udevmonitor.8
-       - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevcontrol.8
+       $(INSTALL) -d $(DESTDIR)$(mandir)/man7
+       $(INSTALL_DATA) udev.7 $(DESTDIR)$(mandir)/man7/udev.7
+       $(INSTALL) -d $(DESTDIR)$(mandir)/man8
+       $(INSTALL_DATA) udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8
+       $(INSTALL_DATA) udevadm.8 $(DESTDIR)$(mandir)/man8/udevadm.8
        @extras="$(EXTRAS)"; for target in $$extras; do \
                $(MAKE) -C $$target $@ || exit 1; \
        done;
@@ -262,27 +247,22 @@ install-man:
 
 uninstall-man:
        - rm -f $(DESTDIR)$(mandir)/man7/udev.7
-       - rm -f $(DESTDIR)$(mandir)/man8/udevinfo.8
-       - rm -f $(DESTDIR)$(mandir)/man8/udevtest.8
+       - rm -f $(DESTDIR)$(mandir)/man8/udevadm.8
        - rm -f $(DESTDIR)$(mandir)/man8/udevd.8
-       - rm -f $(DESTDIR)$(mandir)/man8/udevtrigger.8
-       - rm -f $(DESTDIR)$(mandir)/man8/udevsettle.8
-       - rm -f $(DESTDIR)$(mandir)/man8/udevmonitor.8
-       - rm -f $(DESTDIR)$(mandir)/man8/udevcontrol.8
        @ extras="$(EXTRAS)"; for target in $$extras; do \
                $(MAKE) -C $$target $@ || exit 1; \
        done;
 .PHONY: uninstall-man
 
 install-bin:
-       $(INSTALL) -d $(DESTDIR)$(udevdir)
-       $(INSTALL_PROGRAM) -D udevd $(DESTDIR)$(sbindir)/udevd
-       $(INSTALL_PROGRAM) -D udevtrigger $(DESTDIR)$(sbindir)/udevtrigger
-       $(INSTALL_PROGRAM) -D udevsettle $(DESTDIR)$(sbindir)/udevsettle
-       $(INSTALL_PROGRAM) -D udevcontrol $(DESTDIR)$(sbindir)/udevcontrol
-       $(INSTALL_PROGRAM) -D udevmonitor $(DESTDIR)$(usrsbindir)/udevmonitor
-       $(INSTALL_PROGRAM) -D udevinfo $(DESTDIR)$(usrbindir)/udevinfo
-       $(INSTALL_PROGRAM) -D udevtest $(DESTDIR)$(usrbindir)/udevtest
+       $(INSTALL) -d $(DESTDIR)$(sbindir)
+       $(INSTALL_PROGRAM) udevd $(DESTDIR)$(sbindir)/udevd
+       $(INSTALL_PROGRAM) udevadm $(DESTDIR)$(sbindir)/udevadm
+       ln -f -s udevadm $(DESTDIR)$(sbindir)/udevtrigger
+       ln -f -s udevadm $(DESTDIR)$(sbindir)/udevsettle
+       ln -f -s udevadm $(DESTDIR)$(sbindir)/udevcontrol
+       $(INSTALL) -d $(DESTDIR)$(usrbindir)
+       ln -f -s $(sbindir)/udevadm $(DESTDIR)$(usrbindir)/udevinfo
        @extras="$(EXTRAS)"; for target in $$extras; do \
                $(MAKE) -C $$target $@ || exit 1; \
        done;
@@ -295,12 +275,11 @@ endif
 
 uninstall-bin:
        - rm -f $(DESTDIR)$(sbindir)/udevd
+       - rm -f $(DESTDIR)$(sbindir)/udevadm
        - rm -f $(DESTDIR)$(sbindir)/udevtrigger
        - rm -f $(DESTDIR)$(sbindir)/udevsettle
        - rm -f $(DESTDIR)$(sbindir)/udevcontrol
-       - rm -f $(DESTDIR)$(usrsbindir)/udevmonitor
        - rm -f $(DESTDIR)$(usrbindir)/udevinfo
-       - rm -f $(DESTDIR)$(usrbindir)/udevtest
 ifndef DESTDIR
        - killall udevd
        - rm -rf /dev/.udev
@@ -318,23 +297,47 @@ uninstall: uninstall-bin uninstall-man
 
 test tests: all
        @ cd test && ./udev-test.pl
-       @ cd test && ./udevstart-test.pl
 .PHONY: test tests
 
 buildtest:
        test/simple-build-check.sh
 .PHONY: buildtest
 
-ChangeLog: Makefile
+ChangeLog:
+       head -1 $@ | grep -q "to v$(shell echo $$(($(VERSION) - 1)))"
        @ mv $@ $@.tmp
-       @ echo "Summary of changes from v$(shell printf '%03i' $$(expr $(VERSION) - 1)) to v$(VERSION)" >> $@
+       @ echo "Summary of changes from v$(shell echo $$(($(VERSION) - 1))) to v$(VERSION)" >> $@
        @ echo "============================================" >> $@
        @ echo >> $@
-       @ git log --pretty=short $(shell printf '%03i' $$(expr $(VERSION) - 1))..HEAD | git shortlog  >> $@
+       @ git log --pretty=short $(shell echo $$(($(VERSION) - 1)))..HEAD | git shortlog  >> $@
        @ echo >> $@
        @ cat $@
        @ cat $@.tmp >> $@
        @ rm $@.tmp
+       head -1 $@ | grep -q "to v$(VERSION)"
+.PHONY: ChangeLog
+.PRECIOUS: ChangeLog
+
+release:
+       $(Q) - rm -f udev-$(VERSION).tar.gz
+       $(Q) - rm -f udev-$(VERSION).tar.bz2
+       head -1 ChangeLog | grep -q "to v$(VERSION)"
+       head -1 RELEASE-NOTES | grep -q "udev $(VERSION)"
+       git commit -a -m "release $(VERSION)"
+       cat .git/refs/heads/master > .git/refs/tags/$(VERSION)
+       @ echo
+       git-archive --format=tar --prefix=udev-$(VERSION)/ HEAD | gzip -9v > udev-$(VERSION).tar.gz
+       git-archive --format=tar --prefix=udev-$(VERSION)/ HEAD | bzip2 -9v > udev-$(VERSION).tar.bz2
+.PHONY: release
+
+dist:
+       git-archive --format=tar --prefix=udev-$(VERSION)/ HEAD | gzip -9v > udev-$(VERSION).tar.gz
+       git-archive --format=tar --prefix=udev-$(VERSION)/ HEAD | bzip2 -9v > udev-$(VERSION).tar.bz2
+.PHONY: dist
+
+patch:
+       git diff $(shell echo $$(($(VERSION) - 1))) HEAD > udev-git-HEAD.patch
+.PHONY: patch
 
 gcov-all:
        $(MAKE) clean all USE_GCOV=true