On 10/15/06, Bryan Kadzban <[EMAIL PROTECTED]> wrote:
Dan Nicholson wrote:
> The sucky part is that I couldn't figure out how to query the udev
> version from the installed files,

Well, this:

UDEV_VERSION = $(lastword $(shell udevinfo -V))

seems to work fine here.  I doubt it's portable to other versions of
Make, but that's OK, because udev will be using the installed GNU make.

udevinfo! I couldn't get the version out of any of the udev binaries.
Must not have tried that one. $(lastword ) didn't work, I think
because the string returned by udevinfo has a , in it and that has
special meaning to the make functions. Someone better schooled in make
could probably do it, but I did it a different way. See below.

Regarding Makefile details: I think we should also use install instead
of /usr/bin/install, to let the shell search for it.  This doesn't
affect by-the-book builds, but it does help for people that use the
pkg-user hint.  The hint provides wrapper scripts in /usr/lib/pkgusr
that prevent known-to-fail install commands (such as install -d on an
existing directory) from failing the make run.

That's a good idea. I just used what I saw in autotools generated
Makefiles, but I forgot that they find this during configure. I made a
couple other changes. I nixed the Makefile in the doc directory so I
could just do all the "figure out directory" stuff at the top-level
and not worry about how it got passed down. A couple other tweaks.
Attaching try 2.

--
Dan
Index: udev-config/Makefile
===================================================================
--- udev-config/Makefile	(revision 0)
+++ udev-config/Makefile	(revision 0)
@@ -0,0 +1,41 @@
+# Makefile to install udev rules and documentation
+
+PREFIX = /usr
+RULES_DIR = /etc/udev/rules.d
+INSTALL = install
+INSTALL_DATA = $(INSTALL) -m644
+RULES_FILES = \
+	05-udev-early.rules \
+	25-lfs.rules \
+	26-modprobe.rules \
+	27-firmware.rules \
+	60-persistent-input.rules \
+	60-persistent-storage.rules \
+	81-cdrom.rules \
+	95-udev-late.rules
+DOC_FILES = $(RULES_FILES:.rules=.txt)
+
+# Figure out where to install the docs
+UDEVINFO = udevinfo
+UDEV_VERSION = $(shell $(UDEVINFO) -V 2>/dev/null | awk '{print $$NF}')
+DOC_DIR = $(PREFIX)/share/doc/udev-$(UDEV_VERSION)
+
+all:
+
+install: install-rules
+
+install-rules:
+	$(INSTALL) -d $(DESTDIR)$(RULES_DIR)
+	for rule in $(RULES_FILES); do \
+		$(INSTALL_DATA) $$rule $(DESTDIR)$(RULES_DIR) || exit 1; \
+	done;
+
+install-doc:
+	@if [ -z "$(UDEV_VERSION)" ]; then \
+		echo "Error: Can't get udev version from udevinfo" >&2; \
+		exit 1; \
+	fi
+	$(INSTALL) -d $(DESTDIR)$(DOC_DIR)
+	for doc in $(DOC_FILES); do \
+		$(INSTALL_DATA) doc/$$doc $(DESTDIR)$(DOC_DIR) || exit 1; \
+	done;
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to