chiark / gitweb /
[PATCH] pre-libsysfs-0.4.0 patch
[elogind.git] / Makefile
index aa1d45bdb72a584bd24c5dc3ca05d187e30db265..9415e1ec975ded757575b803e30589fe6653b912 100644 (file)
--- a/Makefile
+++ b/Makefile
 # Leave this set to `false' for production use.
 DEBUG = false
 
+# Set the following to `true' to make udev emit a D-BUS signal when a
+# new node is created.
+DBUS = false
+
 
 ROOT =         udev
 VERSION =      008_bk
@@ -34,6 +38,7 @@ etcdir =      ${prefix}/etc
 sbindir =      ${exec_prefix}/sbin
 mandir =       ${prefix}/usr/share/man
 hotplugdir =   ${etcdir}/hotplug.d/default
+dbusdir =      ${etcdir}/dbus-1/system.d
 configdir =    ${etcdir}/udev/
 srcdir = .
 
@@ -47,7 +52,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
@@ -178,19 +183,34 @@ ifeq ($(strip $(KLIBC)),true)
        OBJS += klibc_fixups.o
 endif
 
+ifeq ($(DBUS), true)
+       CFLAGS += -DUSE_DBUS
+       CFLAGS += $(shell pkg-config --cflags dbus-1)
+       LDFLAGS += $(shell pkg-config --libs dbus-1)
+       OBJS += udev_dbus.o
+endif
+
 # header files automatically generated
 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)
@@ -200,7 +220,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 ; \
@@ -240,7 +260,20 @@ small_release: $(DISTFILES) clean
        @echo "Built $(RELEASE_NAME).tar.gz"
 
 
-install: all
+ifeq ($(DBUS), true)
+install-dbus-policy:
+       $(INSTALL) -d $(DESTDIR)$(dbusdir)
+       $(INSTALL_DATA) udev_sysbus_policy.conf $(DESTDIR)$(dbusdir)
+uninstall-dbus-policy:
+       - rm $(DESTDIR)$(dbusdir)/udev_sysbus_policy.conf
+else
+install-dbus-policy:
+       -
+uninstall-dbus-policy:
+       -
+endif
+
+install: install-dbus-policy all $(GEN_CONFIGS)
        $(INSTALL) -d $(DESTDIR)$(udevdir)
        $(INSTALL) -d $(DESTDIR)$(configdir)
        $(INSTALL) -d $(DESTDIR)$(hotplugdir)
@@ -257,7 +290,7 @@ install: all
                        -C $$target $@ ; \
        done ; \
 
-uninstall:
+uninstall: uninstall-dbus-policy
        - rm $(hotplugdir)/udev.hotplug
        - rm $(configdir)/udev.permissions
        - rm $(configdir)/udev.rules