chiark / gitweb /
[PATCH] dump latest klibc into the udev build tree
[elogind.git] / Makefile
index 51087bc8c679a77d25ffa4f5db11f981a38ffbe6..3653595b06c111157ca229a2cb5ee0c945418870 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ DEBUG = false
 
 # Set the following to `true' to make udev emit a D-BUS signal when a
 # new node is created.
-DBUS = false
+USE_DBUS = false
 
 
 ROOT =         udev
@@ -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,11 +53,11 @@ 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
-#KLIBC = true
+#USE_KLIBC = true
 
 # If you are running a cross compiler, you may want to set this
 # to something more interesting, like "arm-linux-".  I you want
@@ -115,7 +116,7 @@ endif
 
 # If we are using our version of klibc, then we need to build and link it.
 # Otherwise, use glibc and link statically.
-ifeq ($(strip $(KLIBC)),true)
+ifeq ($(strip $(USE_KLIBC)),true)
        KLIBC_BASE      = $(PWD)/klibc
        KLIBC_DIR       = $(KLIBC_BASE)/klibc
        INCLUDE_DIR     := $(KLIBC_DIR)/include
@@ -179,11 +180,11 @@ OBJS =    udev.o          \
        $(SYSFS)        \
        $(TDB)
 
-ifeq ($(strip $(KLIBC)),true)
+ifeq ($(strip $(USE_KLIBC)),true)
        OBJS += klibc_fixups.o
 endif
 
-ifeq ($(DBUS), true)
+ifeq ($(USE_DBUS), true)
        CFLAGS += -DUSE_DBUS
        CFLAGS += $(shell pkg-config --cflags dbus-1)
        LDFLAGS += $(shell pkg-config --libs dbus-1)
@@ -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 ; \
@@ -252,7 +261,7 @@ small_release: $(DISTFILES) clean
        @echo "Built $(RELEASE_NAME).tar.gz"
 
 
-ifeq ($(DBUS), true)
+ifeq ($(USE_DBUS), true)
 install-dbus-policy:
        $(INSTALL) -d $(DESTDIR)$(dbusdir)
        $(INSTALL_DATA) udev_sysbus_policy.conf $(DESTDIR)$(dbusdir)
@@ -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)
@@ -287,6 +297,7 @@ uninstall: uninstall-dbus-policy
        - rm $(configdir)/udev.permissions
        - rm $(configdir)/udev.rules
        - rm $(configdir)/udev.conf
+       - rm $(initdir)/udev
        - rm $(mandir)/man8/udev.8
        - rm $(sbindir)/$(ROOT)
        - rmdir $(hotplugdir)