chiark / gitweb /
[PATCH] add init.d/udev to "make install"
[elogind.git] / Makefile
index 51087bc8c679a77d25ffa4f5db11f981a38ffbe6..bd9a9035eebb4a6ab6e6e9859d3d2ebcfea28e19 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -40,6 +40,7 @@ mandir =      ${prefix}/usr/share/man
 hotplugdir =   ${etcdir}/hotplug.d/default
 dbusdir =      ${etcdir}/dbus-1/system.d
 configdir =    ${etcdir}/udev/
+initdir =      ${etcdir}/init.d/
 srcdir = .
 
 INSTALL = /usr/bin/install -c
@@ -52,7 +53,7 @@ INSTALL_SCRIPT = ${INSTALL_PROGRAM}
 EXTRAS=
 
 # place to put our device nodes
-udevdir = ${prefix}/udev/
+udevdir = ${prefix}/udev
 
 # Comment out this line to build with something other 
 # than the local version of klibc
@@ -196,13 +197,21 @@ GEN_HEADERS =     udev_version.h
 # Rules on how to create the generated header files
 udev_version.h:
        @echo \#define UDEV_VERSION     \"$(VERSION)\" > $@
-       @echo \#define UDEV_ROOT        \"$(udevdir)\" >> $@
-       @echo \#define UDEV_DB          \"$(udevdir)\.udev.tdb\" >> $@
+       @echo \#define UDEV_ROOT        \"$(udevdir)/\" >> $@
+       @echo \#define UDEV_DB          \"$(udevdir)/\.udev.tdb\" >> $@
        @echo \#define UDEV_CONFIG_DIR  \"$(configdir)\" >> $@
        @echo \#define UDEV_CONFIG_FILE \"$(configdir)\udev.conf\" >> $@
        @echo \#define UDEV_RULES_FILE  \"$(configdir)\udev.rules\" >> $@
        @echo \#define UDEV_PERMISSION_FILE     \"$(configdir)\udev.permissions\" >> $@
 
+# config files automatically generated
+GEN_CONFIGS =  udev.conf
+
+# Rules on how to create the generated config files
+udev.conf:
+       sed -e "s-@udevdir@-$(udevdir)-" < udev.conf.in > $@
+
+
 $(OBJS): $(GEN_HEADERS)
 
 $(ROOT): $(OBJS)
@@ -212,7 +221,7 @@ $(ROOT): $(OBJS)
 clean:
        -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \
         | xargs rm -f 
-       -rm -f core $(ROOT) $(GEN_HEADERS)
+       -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS)
        $(MAKE) -C klibc clean
        @for target in $(EXTRAS) ; do \
                echo $$target ; \
@@ -265,11 +274,12 @@ uninstall-dbus-policy:
        -
 endif
 
-install: install-dbus-policy all
+install: install-dbus-policy all $(GEN_CONFIGS)
        $(INSTALL) -d $(DESTDIR)$(udevdir)
        $(INSTALL) -d $(DESTDIR)$(configdir)
        $(INSTALL) -d $(DESTDIR)$(hotplugdir)
        $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT)
+       $(INSTALL_PROGRAM) -D etc/init.d/udev $(DESTDIR)$(initdir)/udev
        $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8
        $(INSTALL_DATA) udev.conf $(DESTDIR)$(configdir)
        $(INSTALL_DATA) udev.rules $(DESTDIR)$(configdir)