adjust defconfig
[buildroot.git] / package / udev / udev.mk
blob08f0cb6e0c9dc254c2176cd56093da01b69f1def
1 #############################################################
3 # udev
5 #############################################################
6 UDEV_VERSION:=116
7 UDEV_VOLUME_ID_CURRENT:=0
8 UDEV_VOLUME_ID_AGE:=80
9 UDEV_VOLUME_ID_REVISION:=0
10 UDEV_VOLUME_ID_VERSION:=$(UDEV_VOLUME_ID_CURRENT).$(UDEV_VOLUME_ID_AGE).$(UDEV_VOLUME_ID_REVISION)
11 UDEV_SOURCE:=udev-$(UDEV_VERSION).tar.bz2
12 UDEV_SITE:=$(BR2_KERNEL_MIRROR)/linux/utils/kernel/hotplug
13 UDEV_CAT:=$(BZCAT)
14 UDEV_DIR:=$(BUILD_DIR)/udev-$(UDEV_VERSION)
15 UDEV_TARGET_BINARY:=sbin/udevd
16 UDEV_BINARY:=udevd
18 BR2_UDEV_CFLAGS:=$(TARGET_CFLAGS) -D_GNU_SOURCE
19 ifneq ($(BR2_LARGEFILE),y)
20 BR2_UDEV_CFLAGS+=-U_FILE_OFFSET_BITS
21 endif
23 ifeq ($(BR2_PACKAGE_SELINUX),y)
24 UDEV_USE_SELINUX:=true
25 else
26 UDEV_USE_SELINUX:=false
27 endif
29 # UDEV_ROOT is /dev so we can replace devfs, not /udev for experiments
30 UDEV_ROOT:=/dev
32 $(DL_DIR)/$(UDEV_SOURCE):
33 $(WGET) -P $(DL_DIR) $(UDEV_SITE)/$(UDEV_SOURCE)
35 $(UDEV_DIR)/.unpacked: $(DL_DIR)/$(UDEV_SOURCE)
36 $(UDEV_CAT) $(DL_DIR)/$(UDEV_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
37 toolchain/patch-kernel.sh $(UDEV_DIR) package/udev \*.patch
38 -$(SED) '/_FILE_OFFSET_BITS=/s/-D_FILE_OFFSET_BITS=[^[:space:]]*//g' $(UDEV_DIR)/Makefile
39 touch $@
41 $(UDEV_DIR)/$(UDEV_BINARY): $(UDEV_DIR)/.unpacked
42 $(MAKE) CROSS_COMPILE=$(TARGET_CROSS) CC=$(TARGET_CC) LD=$(TARGET_CC)\
43 CFLAGS="$(BR2_UDEV_CFLAGS)" \
44 USE_LOG=false USE_SELINUX=$(UDEV_USE_SELINUX) \
45 udevdir=$(UDEV_ROOT) -C $(UDEV_DIR)
46 touch -c $@
48 $(TARGET_DIR)/$(UDEV_TARGET_BINARY): $(UDEV_DIR)/$(UDEV_BINARY)
49 $(INSTALL) -d $(TARGET_DIR)/sys
50 $(MAKE) $(TARGET_CONFIGURE_OPTS) \
51 DESTDIR=$(TARGET_DIR) \
52 CFLAGS="$(BR2_UDEV_CFLAGS)" \
53 LDFLAGS="-warn-common" \
54 USE_LOG=false USE_SELINUX=$(UDEV_USE_SELINUX) \
55 udevdir=$(UDEV_ROOT) -C $(UDEV_DIR) install
57 $(UDEV_DIR)/.target_install: $(UDEV_DIR)/$(UDEV_BINARY)
58 $(INSTALL) -D -m 0755 package/udev/S10udev $(TARGET_DIR)/etc/init.d/S10udev
59 $(INSTALL) -d $(TARGET_DIR)/etc/udev/rules.d
60 $(INSTALL) -m 0644 $(UDEV_DIR)/etc/udev/frugalware/* $(TARGET_DIR)/etc/udev/rules.d
61 ( grep udev_root $(TARGET_DIR)/etc/udev/udev.conf > /dev/null 2>&1 || echo 'udev_root=/dev' >> $(TARGET_DIR)/etc/udev/udev.conf )
62 $(INSTALL) -D -m 0755 $(UDEV_DIR)/udevstart $(TARGET_DIR)/sbin/udevstart
63 ifneq ($(BR2_HAVE_MANPAGES),y)
64 rm -rf $(TARGET_DIR)/usr/share/man
65 endif
66 ifneq ($(BR2_PACKAGE_UDEV_UTILS),y)
67 rm -f $(TARGET_DIR)/usr/sbin/udevmonitor \
68 $(TARGET_DIR)/usr/bin/udevinfo \
69 $(TARGET_DIR)/usr/bin/udevtest
70 endif
71 touch $@
73 udev: uclibc $(TARGET_DIR)/$(UDEV_TARGET_BINARY) $(UDEV_DIR)/.target_install
75 udev-source: $(DL_DIR)/$(UDEV_SOURCE)
77 udev-clean: $(UDEV_CLEAN_DEPS)
78 -$(MAKE) -C $(UDEV_DIR) clean
79 rm -f $(TARGET_DIR)/etc/init.d/S10udev $(TARGET_DIR)/sbin/udev* \
80 $(TARGET_DIR)/usr/sbin/udevmonitor $(TARGET_DIR)/usr/bin/udev*
81 rm -rf $(TARGET_DIR)/sys
83 udev-dirclean: $(UDEV_DIRCLEAN_DEPS)
84 rm -rf $(UDEV_DIR)
86 #####################################################################
87 ifeq ($(BR2_PACKAGE_UDEV_VOLUME_ID),y)
89 $(STAGING_DIR)/usr/lib/libvolume_id.so.$(UDEV_VOLUME_ID_VERSION):
90 $(MAKE) CROSS_COMPILE=$(TARGET_CROSS) CC=$(TARGET_CC) LD=$(TARGET_CC)\
91 CFLAGS="$(BR2_UDEV_CFLAGS)" \
92 USE_LOG=false USE_SELINUX=$(UDEV_USE_SELINUX) \
93 udevdir=$(UDEV_ROOT) EXTRAS="extras/volume_id" -C $(UDEV_DIR)
94 $(INSTALL) -D -m 0644 $(UDEV_DIR)/extras/volume_id/lib/libvolume_id.h $(STAGING_DIR)/usr/include/libvolume_id.h
95 $(INSTALL) -D -m 0755 $(UDEV_DIR)/extras/volume_id/lib/libvolume_id.so.$(UDEV_VOLUME_ID_VERSION) $(STAGING_DIR)/usr/lib/libvolume_id.so.$(UDEV_VOLUME_ID_VERSION)
96 -ln -sf libvolume_id.so.$(UDEV_VOLUME_ID_VERSION) $(STAGING_DIR)/usr/lib/libvolume_id.so.0
97 -ln -sf libvolume_id.so.$(UDEV_VOLUME_ID_VERSION) $(STAGING_DIR)/usr/lib/libvolume_id.so
99 $(STAGING_DIR)/usr/lib/libvolume_id.la: $(STAGING_DIR)/usr/lib/libvolume_id.so.$(UDEV_VOLUME_ID_VERSION)
100 $(INSTALL) -D -m 0755 package/udev/libvolume_id.la.tmpl $(STAGING_DIR)/usr/lib/libvolume_id.la
101 $(SED) 's/REPLACE_CURRENT/$(UDEV_VOLUME_ID_CURRENT)/g' \
102 -e 's/REPLACE_AGE/$(UDEV_VOLUME_ID_AGE)/g' \
103 -e 's/REPLACE_REVISION/$(UDEV_VOLUME_ID_REVISION)/g' \
104 -e 's,REPLACE_LIB_DIR,$(STAGING_DIR)/usr/lib,g' \
105 $(STAGING_DIR)/usr/lib/libvolume_id.la
107 $(TARGET_DIR)/lib/udev/vol_id: $(STAGING_DIR)/usr/lib/libvolume_id.la
108 $(INSTALL) -D -m 0755 $(UDEV_DIR)/extras/volume_id/lib/libvolume_id.so.$(UDEV_VOLUME_ID_VERSION) $(TARGET_DIR)/usr/lib/libvolume_id.so.$(UDEV_VOLUME_ID_VERSION)
109 -ln -sf libvolume_id.so.$(UDEV_VOLUME_ID_VERSION) $(TARGET_DIR)/usr/lib/libvolume_id.so.0
110 -ln -sf libvolume_id.so.$(UDEV_VOLUME_ID_VERSION) $(TARGET_DIR)/usr/lib/libvolume_id.so
111 $(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/usr/lib/libvolume_id.so.$(UDEV_VOLUME_ID_VERSION)
112 $(INSTALL) -D -m 0755 $(UDEV_DIR)/extras/volume_id/vol_id $(TARGET_DIR)/lib/udev/vol_id
113 $(STRIPCMD) $(STRIP_STRIP_ALL) $(TARGET_DIR)/lib/udev/vol_id
115 udev-volume_id: udev $(TARGET_DIR)/lib/udev/vol_id
117 udev-volume_id-clean:
118 rm -f $(STAGING_DIR)/usr/include/libvolume_id.h \
119 $(STAGING_DIR)/usr/lib/libvolume_id.so* \
120 $(STAGING_DIR)/usr/lib/libvolume_id.la \
121 $(TARGET_DIR)/usr/lib/libvolume_id.so.0* \
122 $(TARGET_DIR)/lib/udev/vol_id
123 rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/lib/udev
125 udev-volume_id-dirclean:
126 -$(MAKE) EXTRAS="extras/volume_id" -C $(UDEV_DIR) clean
128 UDEV_CLEAN_DEPS+=udev-volume_id-clean
129 UDEV_DIRCLEAN_DEPS+=udev-volume_id-dirclean
130 endif
132 #####################################################################
133 ifeq ($(BR2_PACKAGE_UDEV_SCSI_ID),y)
135 $(TARGET_DIR)/lib/udev/scsi_id: $(STAGING_DIR)/usr/lib/libvolume_id.so.$(UDEV_VOLUME_ID_VERSION)
136 $(MAKE) CROSS_COMPILE=$(TARGET_CROSS) CC=$(TARGET_CC) LD=$(TARGET_CC)\
137 CFLAGS="$(BR2_UDEV_CFLAGS)" \
138 USE_LOG=false USE_SELINUX=$(UDEV_USE_SELINUX) \
139 udevdir=$(UDEV_ROOT) EXTRAS="extras/scsi_id" -C $(UDEV_DIR)
140 $(INSTALL) -D -m 0755 $(UDEV_DIR)/extras/scsi_id/scsi_id $(TARGET_DIR)/lib/udev/scsi_id
141 $(STRIPCMD) $(STRIP_STRIP_ALL) $(TARGET_DIR)/lib/udev/scsi_id
143 $(TARGET_DIR)/lib/udev/usb_id: $(STAGING_DIR)/usr/lib/libvolume_id.so.$(UDEV_VOLUME_ID_VERSION)
144 $(MAKE) CROSS_COMPILE=$(TARGET_CROSS) CC=$(TARGET_CC) LD=$(TARGET_CC)\
145 CFLAGS="$(BR2_UDEV_CFLAGS)" \
146 USE_LOG=false USE_SELINUX=$(UDEV_USE_SELINUX) \
147 udevdir=$(UDEV_ROOT) EXTRAS="extras/usb_id" -C $(UDEV_DIR)
148 $(INSTALL) -D -m 0755 $(UDEV_DIR)/extras/usb_id/usb_id $(TARGET_DIR)/lib/udev/usb_id
149 $(STRIPCMD) $(STRIP_STRIP_ALL) $(TARGET_DIR)/lib/udev/usb_id
151 udev-scsi_id: udev $(TARGET_DIR)/lib/udev/scsi_id $(TARGET_DIR)/lib/udev/usb_id
153 udev-scsi_id-clean:
154 rm -f $(TARGET_DIR)/lib/udev/scsi_id \
155 $(TARGET_DIR)/lib/udev/usb_id
156 rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/lib/udev
158 udev-scsi_id-dirclean:
159 -$(MAKE) EXTRAS="extras/scsi_id" -C $(UDEV_DIR) clean
161 UDEV_CLEAN_DEPS+=udev-scsi_id-clean
162 UDEV_DIRCLEAN_DEPS+=udev-scsi_id-dirclean
163 endif
165 #############################################################
167 # Toplevel Makefile options
169 #############################################################
170 ifeq ($(BR2_PACKAGE_UDEV),y)
171 TARGETS+=udev
172 endif
174 ifeq ($(BR2_PACKAGE_UDEV_VOLUME_ID),y)
175 TARGETS+=udev-volume_id
176 endif
178 ifeq ($(BR2_PACKAGE_UDEV_SCSI_ID),y)
179 TARGETS+=udev-scsi_id
180 endif