summaryrefslogtreecommitdiffstats
path: root/rules/udev.make
blob: 85d6689e5dab0d973e5007acbc4726adab07a56f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# -*-makefile-*-
# $Id: udev.make,v 1.15 2007/03/07 14:34:52 michl Exp $
#
# Copyright (C) 2005-2006 by Robert Schwebel
#
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

#
# We provide this package
#
PACKAGES-$(PTXCONF_UDEV) += udev

#
# Paths and names
#
UDEV_VERSION	:= 106
UDEV		:= udev-$(UDEV_VERSION)
UDEV_SUFFIX	:= tar.bz2
UDEV_URL	:= http://www.kernel.org/pub/linux/utils/kernel/hotplug/$(UDEV).$(UDEV_SUFFIX)
UDEV_SOURCE	:= $(SRCDIR)/$(UDEV).$(UDEV_SUFFIX)
UDEV_DIR	:= $(BUILDDIR)/$(UDEV)


# ----------------------------------------------------------------------------
# Get
# ----------------------------------------------------------------------------

udev_get: $(STATEDIR)/udev.get

$(STATEDIR)/udev.get:
	@$(call targetinfo, $@)
	@$(call touch, $@)

$(UDEV_SOURCE):
	@$(call targetinfo, $@)
	@$(call get, UDEV)

# ----------------------------------------------------------------------------
# Extract
# ----------------------------------------------------------------------------

udev_extract: $(STATEDIR)/udev.extract

$(STATEDIR)/udev.extract:
	@$(call targetinfo, $@)
	@$(call clean, $(UDEV_DIR))
	@$(call extract, UDEV)
	@$(call patchin, UDEV)
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Prepare
# ----------------------------------------------------------------------------

udev_prepare: $(STATEDIR)/udev.prepare

UDEV_TOOLVAR	:=

ifdef PTXCONF_UDEV_FW_HELPER
UDEV_TOOLVAR	+=  extras/firmware
endif
ifdef PTXCONF_UDEV_USB_ID
UDEV_TOOLVAR	+=  extras/usb_id
endif

ifdef PTXCONF_UDEV_ENABLE_SYSLOG
UDEV_SYSLOGVAR	= USE_LOG=true
else
UDEV_SYSLOGVAR	= USE_LOG=false
endif

ifdef PTXCONF_UDEV_ENABLE_DEBUG
UDEV_DEBUGMSG	= DEBUG=true
else
UDEV_DEBUGMSG	= DEBUG=false
endif

UDEV_PATH	:=  PATH=$(CROSS_PATH)
UDEV_ENV 	:=  $(CROSS_ENV)
UDEV_MAKEVARS	:= \
	CROSS_COMPILE=$(COMPILER_PREFIX) \
	EXTRAS="$(UDEV_TOOLVAR)" \
	$(UDEV_SYSLOGVAR) \
	$(UDEV_DEBUGMSG) 


$(STATEDIR)/udev.prepare:
	@$(call targetinfo, $@)
	@$(call clean, $(UDEV_DIR)/config.cache)
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Compile
# ----------------------------------------------------------------------------

udev_compile: $(STATEDIR)/udev.compile

$(STATEDIR)/udev.compile:
	@$(call targetinfo, $@)
	cd $(UDEV_DIR) && $(UDEV_ENV) $(UDEV_PATH) $(MAKE) $(PARALLELMFLAGS) $(UDEV_MAKEVARS)
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Install
# ----------------------------------------------------------------------------

udev_install: $(STATEDIR)/udev.install

$(STATEDIR)/udev.install:
	@$(call targetinfo, $@)
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Target-Install
# ----------------------------------------------------------------------------

udev_targetinstall: $(STATEDIR)/udev.targetinstall

$(STATEDIR)/udev.targetinstall:
	@$(call targetinfo, $@)

	@$(call install_init, udev)
	@$(call install_fixup, udev,PACKAGE,udev)
	@$(call install_fixup, udev,PRIORITY,optional)
	@$(call install_fixup, udev,VERSION,$(UDEV_VERSION))
	@$(call install_fixup, udev,SECTION,base)
	@$(call install_fixup, udev,AUTHOR,"Robert Schwebel <r.schwebel\@pengutronix.de>")
	@$(call install_fixup, udev,DEPENDS,)
	@$(call install_fixup, udev,DESCRIPTION,missing)

#
# Install a configuration on demand only
#
ifdef PTXCONF_ROOTFS_ETC_UDEV_CONF
ifdef PTXCONF_ROOTFS_ETC_UDEV_CONF_DEFAULT
# use generic
	@$(call install_copy, udev, 0, 0, 0644, \
		$(PTXDIST_TOPDIR)/generic/etc/udev/udev.conf, \
		/etc/udev/udev.conf, n)
	@$(call install_copy, udev, 0, 0, 0644, \
		$(PTXDIST_TOPDIR)/generic/etc/udev/permissions.rules, \
		/etc/udev/permissions.rules, n)
endif
ifdef PTXCONF_ROOTFS_ETC_UDEV_CONF_USER
# user defined
	@$(call install_copy, udev, 0, 0, 0644, \
		$(PTXDIST_WORKSPACE)/projectroot/etc/udev/udev.conf, \
		/etc/udev/udev.conf, n)
	@$(call install_copy, udev, 0, 0, 0644, \
		$(PTXDIST_WORKSPACE)/projectroot/etc/udev/permissions.rules, \
		/etc/udev/permissions.rules, n)
endif
endif
#
# install all user defined rule files
#
ifdef PTXCONF_ROOTFS_ETC_UDEV_USER_RULES
# create the rules directory as currently stated in the generic config
# FIXME: if the user defines a different directory in his own udev.conf
#        this will fail!
#
	@$(call install_copy, udev, 0, 0, 0755, \
		/etc/udev/rules.d)
# copy *all* *.rules files into targets rule directory
#
	@cd $(PTXDIST_WORKSPACE)/projectroot/etc/udev/rules.d; \
	for i in *.rules; do \
		$(call install_copy, udev, 0, 0, 0644, $$i, \
			/etc/udev/rules.d/$$i,n); \
	done;
endif
ifdef PTXCONF_ROOTFS_ETC_UDEV_DEFAULT_RULES
	@$(call install_copy, udev, 0, 0, 0755, \
		$(PTXDIST_TOPDIR)/generic/etc/udev/rules.d/udev.rules, \
		/etc/udev/rules.d/udev.rules, n)
endif
#
# Install the startup script on request only
#
ifdef PTXCONF_ROOTFS_ETC_INITD_UDEV
ifdef PTXCONF_ROOTFS_ETC_INITD_UDEV_DEFAULT
# install the generic one
	@$(call install_copy, udev, 0, 0, 0755, \
		$(PTXDIST_TOPDIR)/generic/etc/init.d/udev, \
		/etc/init.d/udev, n)
endif

ifdef PTXCONF_ROOTFS_ETC_INITD_UDEV_USER
# install users one
	@$(call install_copy, udev, 0, 0, 0755, \
		${PTXDIST_WORKSPACE}/projectroot/etc/init.d/udev, \
		/etc/init.d/udev, n)
endif
#
# FIXME: Is this packet the right location for the link?
#
ifneq ($(PTXCONF_ROOTFS_ETC_INITD_UDEV_LINK),"")
	@$(call install_copy, udev, 0, 0, 0755, /etc/rc.d)
	@$(call install_link, udev, ../init.d/udev, \
		/etc/rc.d/$(PTXCONF_ROOTFS_ETC_INITD_UDEV_LINK))
endif
endif

ifdef PTXCONF_UDEV_TEST_UDEV
	@$(call install_copy, udev, 0, 0, 0755, $(UDEV_DIR)/test-udev, \
		/sbin/test-udev)
endif
ifdef PTXCONF_UDEV_UDEVD
	@$(call install_copy, udev, 0, 0, 0755, $(UDEV_DIR)/udevd, \
		/sbin/udevd)
endif
ifdef PTXCONF_UDEV_INFO
	@$(call install_copy, udev, 0, 0, 0755, $(UDEV_DIR)/udevinfo, \
		/sbin/udevinfo)
endif
ifdef PTXCONF_UDEV_START
	@$(call install_copy, udev, 0, 0, 0755, $(UDEV_DIR)/udevstart, \
		/sbin/udevstart)
endif
ifdef PTXCONF_UDEV_TEST
	@$(call install_copy, udev, 0, 0, 0755, $(UDEV_DIR)/udevtest, \
		/sbin/udevtest)
endif
ifdef PTXCONF_UDEV_TRIGGER
	@$(call install_copy, udev, 0, 0, 0755, $(UDEV_DIR)/udevtrigger, \
		/sbin/udevtrigger)
endif
ifdef PTXCONF_UDEV_SETTLE
	@$(call install_copy, udev, 0, 0, 0755, $(UDEV_DIR)/udevsettle, \
		/sbin/udevsettle)
endif
ifdef PTXCONF_UDEV_CONTROL
	@$(call install_copy, udev, 0, 0, 0755, $(UDEV_DIR)/udevcontrol, \
		/sbin/udevcontrol)
endif
ifdef PTXCONF_UDEV_MONITOR
	@$(call install_copy, udev, 0, 0, 0755, $(UDEV_DIR)/udevmonitor, \
		/sbin/udevmonitor)
endif
ifdef PTXCONF_UDEV_USB_ID
	@$(call install_copy, udev, 0, 0, 0755, \
		$(UDEV_DIR)/extras/usb_id/usb_id, \
		/sbin/usbid)
endif
ifdef PTXCONF_UDEV_FW_HELPER
	@$(call install_copy, udev, 0, 0, 0755, \
		$(UDEV_DIR)/extras/firmware/firmware.sh, \
		/sbin/firmware.sh,n)
endif

	@$(call install_finish, udev)

	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Clean
# ----------------------------------------------------------------------------

udev_clean:
	rm -rf $(STATEDIR)/udev.*
	rm -rf $(IMAGEDIR)/udev_*
	rm -rf $(UDEV_DIR)

# vim: syntax=make