# Makefile for udev
#
# Copyright (C) 2003,2004 Greg Kroah-Hartman <greg@kroah.com>
+# Copyright (C) 2004-2005 Kay Sievers <kay.sievers@vrfy.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# Set the following to control the use of syslog
-# Set it to `false' to remove all logging
+# Set this to make use of syslog
USE_LOG = true
-# Set the following to `true' to log the debug
-# and make a unstripped, unoptimized binary.
-# Leave this set to `false' for production use.
+# Set this to ad development debug messages
DEBUG = false
-# Set this to compile with Security-Enhanced Linux support.
+# Set this to include Security-Enhanced Linux support.
USE_SELINUX = false
+# Set this to comile with the local version of klibc instead of glibc.
+USE_KLIBC = false
+
+# Set this to create statically linked binaries.
+USE_STATIC = false
+
+# To build any of the extras programs, run with:
+# make EXTRAS="extras/a extras/b"
+EXTRAS=
+
+# make the build silent. Set this to something else to make it noisy again.
+V=false
+
ROOT = udev
DAEMON = udevd
SENDER = udevsend
INFO = udevinfo
TESTER = udevtest
STARTER = udevstart
-VERSION = 050
+VERSION = 054
INSTALL_DIR = /usr/local/bin
RELEASE_NAME = $(ROOT)-$(VERSION)
LOCAL_CFG_DIR = etc/udev
HOTPLUG_EXEC = $(ROOT)
-
DESTDIR =
-
KERNEL_DIR = /lib/modules/${shell uname -r}/build
# override this to make udev look in a different location for it's config files
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_SCRIPT = ${INSTALL_PROGRAM}
-# To build any of the extras programs, run with:
-# make EXTRAS="extras/a extras/b"
-EXTRAS=
-
# place to put our device nodes
udevdir = ${prefix}/udev
udevdb = ${udevdir}/.udevdb
-# Comment out this line to build with something other
-# than the local version of klibc
-#USE_KLIBC = true
-
-# make the build silent (well, at least the udev part) Set this
-# to something else to make it noisy again.
-V=false
-
# set up PWD so that older versions of make will work with our build.
PWD = $(shell pwd)
OPTIMIZATION := ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
then echo "-Os"; else echo "-O2" ; fi}
-# add -Wredundant-decls when libsysfs gets cleaned up
-WARNINGS := -Wall
+# check if compiler option is supported
+cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;}
+
+WARNINGS := -Wall -fno-builtin -Wchar-subscripts -Wpointer-arith -Wstrict-prototypes -Wsign-compare
+WARNINGS += $(call cc-supports,-Wno-pointer-sign)
+WARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
CFLAGS := -pipe
+HEADERS = \
+ udev.h \
+ udev_utils.h \
+ namedev.h \
+ udev_version.h \
+ udev_db.h \
+ udev_sysfs.h \
+ logging.h \
+ udev_libc_wrapper.h \
+ udev_selinux.h \
+ list.h
+
+SYSFS_OBJS = \
+ libsysfs/sysfs_class.o \
+ libsysfs/sysfs_device.o \
+ libsysfs/sysfs_dir.o \
+ libsysfs/sysfs_driver.o \
+ libsysfs/sysfs_utils.o \
+ libsysfs/dlist.o
+
+UDEV_OBJS = \
+ udev_utils.o \
+ udev_config.o \
+ udev_add.o \
+ udev_remove.o \
+ udev_start.o \
+ udev_sysfs.o \
+ udev_db.o \
+ udev_multiplex.o \
+ namedev.o \
+ namedev_parse.o \
+ udev_libc_wrapper.o
+
+OBJS = \
+ udev.a \
+ libsysfs/sysfs.a
+
+SYSFS = $(PWD)/libsysfs/sysfs.a
+
+CFLAGS += -I$(PWD)/libsysfs/sysfs \
+ -I$(PWD)/libsysfs
+
ifeq ($(strip $(USE_LOG)),true)
- CFLAGS += -DLOG
+ CFLAGS += -DUSE_LOG
endif
# if DEBUG is enabled, then we do not strip or optimize
endif
# If we are using our version of klibc, then we need to build, link it, and then
-# link udev against it statically.
-# Otherwise, use glibc and link dynamically.
+# link udev against it statically. Otherwise, use glibc and link dynamically.
ifeq ($(strip $(USE_KLIBC)),true)
- KLIBC_FIXUPS_DIR= $(PWD)/klibc_fixups
KLIBC_BASE = $(PWD)/klibc
KLIBC_DIR = $(KLIBC_BASE)/klibc
INCLUDE_DIR := $(KLIBC_BASE)/include
LINUX_INCLUDE_DIR := $(KERNEL_DIR)/include
include $(KLIBC_DIR)/arch/$(ARCH)/MCONFIG
- # arch specific objects
ARCH_LIB_OBJS = $(KLIBC_DIR)/libc.a
-
-
CRT0 = $(KLIBC_DIR)/crt0.o
LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) $(CRT0)
CFLAGS += $(WARNINGS) -nostdinc \
- $(OPTFLAGS) \
+ $(OPTFLAGS) $(REQFLAGS) \
-D__KLIBC__ -fno-builtin-printf \
- -I$(KLIBC_FIXUPS_DIR) \
- -include $(KLIBC_FIXUPS_DIR)/klibc_fixups.h \
-I$(INCLUDE_DIR) \
-I$(INCLUDE_DIR)/arch/$(ARCH) \
-I$(INCLUDE_DIR)/bits$(BITSIZE) \
-I$(GCCINCDIR) \
-I$(LINUX_INCLUDE_DIR)
LIB_OBJS =
- LDFLAGS = --static --nostdlib -nostartfiles -nodefaultlibs
+ LDFLAGS = -static -nostdlib -nostartfiles -nodefaultlibs
else
WARNINGS += -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
CRT0 =
LIBC =
CFLAGS += $(WARNINGS) -I$(GCCINCDIR)
LIB_OBJS = -lc
- LDFLAGS =
endif
ifeq ($(strip $(USE_SELINUX)),true)
- CFLAGS += -DUSE_SELINUX
+ UDEV_OBJS += udev_selinux.o
LIB_OBJS += -lselinux
+ CFLAGS += -DUSE_SELINUX
endif
-CFLAGS += -I$(PWD)/libsysfs/sysfs \
- -I$(PWD)/libsysfs
+ifeq ($(strip $(USE_STATIC)),true)
+ CFLAGS += -DUSE_STATIC
+ LDFLAGS += -static
+endif
+
+ifeq ($(strip $(V)),false)
+ QUIET=@$(PWD)/ccdv
+ HOST_PROGS=ccdv
+else
+ QUIET=
+ HOST_PROGS=
+endif
# config files automatically generated
GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf
fi
$(MAKE) -C klibc SUBDIRS=klibc TESTS=
-HEADERS = \
- udev.h \
- udev_utils.h \
- namedev.h \
- udev_version.h \
- udev_db.h \
- udev_sysfs.h \
- logging.h \
- selinux.h \
- list.h
-
-SYSFS_OBJS = \
- libsysfs/sysfs_bus.o \
- libsysfs/sysfs_class.o \
- libsysfs/sysfs_device.o \
- libsysfs/sysfs_dir.o \
- libsysfs/sysfs_driver.o \
- libsysfs/sysfs_utils.o \
- libsysfs/dlist.o
-
-UDEV_OBJS = \
- udev_utils.o \
- udev_config.o \
- udev_add.o \
- udev_remove.o \
- udev_start.o \
- udev_sysfs.o \
- udev_db.o \
- udev_multiplex.o \
- namedev.o \
- namedev_parse.o
-
-OBJS = \
- libsysfs/sysfs.a \
- udev.a
-
-SYSFS = $(PWD)/libsysfs/sysfs.a
-
-ifeq ($(strip $(USE_KLIBC)),true)
- HEADERS += \
- klibc_fixups/klibc_fixups.h \
- klibc_fixups/mntent.h \
- klibc_fixups/pwd.h
-
- KLIBC_FIXUP_OBJS = \
- klibc_fixups/klibc_fixups.o
-
- OBJS += klibc_fixups/klibc_fixups.a
-endif
-
-ifeq ($(strip $(V)),false)
- QUIET=@$(PWD)/ccdv
- HOST_PROGS=ccdv
-else
- QUIET=
- HOST_PROGS=
-endif
-
udev.a: $(UDEV_OBJS)
rm -f $@
$(QUIET) $(AR) cq $@ $(UDEV_OBJS)
$(QUIET) $(AR) cq $@ $(SYSFS_OBJS)
$(QUIET) $(RANLIB) $@
-klibc_fixups/klibc_fixups.a: $(KLIBC_FIXUP_OBJS)
- rm -f $@
- $(QUIET) $(AR) cq $@ $(KLIBC_FIXUP_OBJS)
- $(QUIET) $(RANLIB) $@
-
# header files automatically generated
GEN_HEADERS = udev_version.h
$(UDEV_OBJS): $(GEN_HEADERS) $(HOST_PROGS)
$(SYSFS_OBJS): $(HOST_PROGS)
-$(KLIBC_FIXUP_OBJS): $(HOST_PROGS)
$(OBJS): $(GEN_HEADERS) $(HOST_PROGS)
$(ROOT).o: $(GEN_HEADERS) $(HOST_PROGS)
$(TESTER).o: $(GEN_HEADERS) $(HOST_PROGS)
-rm -rf $(DISTDIR)
mkdir $(DISTDIR)
chmod 777 $(DISTDIR)
- bk export $(DISTDIR)
+ bk export -w $(DISTDIR)
tar -c $(DISTDIR) | gzip -9 > $(RELEASE_NAME).tar.gz
rm -rf $(DISTDIR)
@echo "$(RELEASE_NAME).tar.gz created"