~ubuntu-branches/ubuntu/maverick/linux-backports-modules-2.6.32/maverick

« back to all changes in this revision

Viewing changes to updates/alsa-driver/Rules.make

  • Committer: Bazaar Package Importer
  • Author(s): Andy Whitcroft, Andy Whitcroft
  • Date: 2010-02-04 23:15:51 UTC
  • Revision ID: james.westby@ubuntu.com-20100204231551-vjz5pkvxclukjxm1
Tags: 2.6.32-12.1
[ Andy Whitcroft ]

* initial LBM for lucid
* drop generated files
* printchanges -- rebase tree does not have stable tags use changelog
* printenv -- add revisions to printenv output
* formally rename compat-wireless to linux-backports-modules-wireless
* Update to compat-wireless-2.6.33-rc5
* update nouveau to mainline 2.6.33-rc4
* add new LBM package for nouveau
* nouveau -- fix major numbers and proc entry names
* fix up firmware installs for -wireless
* clean up UPDATE-NOVEAU
* update Nouveau to v2.6.33-rc6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# This file contains rules which are shared between multiple Makefiles.
 
3
#
 
4
# It's a stripped and modified version of /usr/src/linux/Rules.make. [--jk]
 
5
#
 
6
 
 
7
MODCURDIR = $(subst $(MAINSRCDIR)/,,$(shell /bin/pwd))
 
8
 
 
9
ifdef NEW_KBUILD
 
10
 
 
11
ifdef KBUILD_MODULES
 
12
 
 
13
# clean obsolete definitions
 
14
export-objs :=
 
15
 
 
16
# apply patches beforehand
 
17
.PHONY: cleanup
 
18
cleanup:
 
19
        rm -f *.[oas] *.ko .*.cmd .*.d .*.tmp *.mod.c $(clean-files)
 
20
        @for d in $(patsubst %/,%,$(filter %/, $(obj-y))) \
 
21
                  $(patsubst %/,%,$(filter %/, $(obj-m))) DUMMY; do \
 
22
         if [ $$d != DUMMY ]; then $(MAKE) -C $$d cleanup || exit 1; fi; \
 
23
        done
 
24
 
 
25
else # ! KBUILD_MODULES
 
26
 
 
27
first_rule: modules
 
28
 
 
29
include $(MAINSRCDIR)/Rules.make1
 
30
 
 
31
%.c: %.patch
 
32
        @SND_TOPDIR="$(MAINSRCDIR)" $(SND_TOPDIR)/utils/patch-alsa $@
 
33
 
 
34
# apply patches beforehand
 
35
.PHONY: prepare
 
36
prepare: $(clean-files)
 
37
        @for d in $(ALL_SUB_DIRS) DUMMY; do \
 
38
         if [ $$d != DUMMY ]; then $(MAKE) -C $$d prepare || exit 1; fi; \
 
39
        done
 
40
 
 
41
modules:
 
42
        $(MAKE) prepare
 
43
        $(MAKE) -C $(CONFIG_SND_KERNELDIR) SUBDIRS=$(MAINSRCDIR) $(MAKE_ADDS) SND_TOPDIR=$(MAINSRCDIR) modules
 
44
        $(SND_TOPDIR)/utils/link-modules $(MODCURDIR)
 
45
 
 
46
ALL_MOBJS := $(filter-out $(obj-y), $(obj-m))
 
47
ALL_MOBJS := $(filter-out %/, $(ALL_MOBJS))
 
48
modules_install:
 
49
ifneq "$(strip $(ALL_MOBJS))" ""
 
50
        mkdir -p $(DESTDIR)$(moddir)/$(MODCURDIR)
 
51
        cp $(sort $(ALL_MOBJS:.o=.ko)) $(DESTDIR)$(moddir)/$(MODCURDIR)
 
52
endif
 
53
        @for d in $(ALL_SUB_DIRS) DUMMY; do \
 
54
         if [ $$d != DUMMY ]; then $(MAKE) -C $$d modules_install || exit 1; fi; \
 
55
        done
 
56
 
 
57
endif # KBUILD_MODULES
 
58
 
 
59
else # ! NEW_KBUILD
 
60
 
 
61
TOPDIR = $(MAINSRCDIR)
 
62
 
 
63
comma = ,
 
64
 
 
65
#
 
66
# False targets.
 
67
#
 
68
.PHONY: dummy
 
69
 
 
70
#
 
71
# Get things started.
 
72
#
 
73
first_rule: modules
 
74
 
 
75
include $(TOPDIR)/Rules.make1
 
76
 
 
77
ifndef O_TARGET
 
78
ifndef L_TARGET
 
79
O_TARGET        := built-in.o
 
80
endif
 
81
endif
 
82
 
 
83
#
 
84
# Common rules
 
85
#
 
86
 
 
87
%.s: %.c
 
88
        $(CC) -D__KERNEL__ $(CFLAGS) $(EXTRA_CFLAGS)  -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(CFLAGS_$@) -S $< -o $@
 
89
 
 
90
%.i: %.c
 
91
        $(CPP) -D__KERNEL__ $(CFLAGS) $(EXTRA_CFLAGS) -D"KBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(CFLAGS_$@) $(CFLAGS_$@) $< > $@
 
92
 
 
93
%.o: %.c
 
94
        $(CC) -D__KERNEL__ $(CFLAGS) $(EXTRA_CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(CFLAGS_$@) $(CFLAGS_$@) -c -o $@ $<
 
95
 
 
96
%.o: %.s
 
97
        $(AS) -D__KERNEL__ $(AFLAGS) $(EXTRA_CFLAGS) -o $@ $<
 
98
 
 
99
# Old makefiles define their own rules for compiling .S files,
 
100
# but these standard rules are available for any Makefile that
 
101
# wants to use them.  Our plan is to incrementally convert all
 
102
# the Makefiles to these standard rules.  -- rmk, mec
 
103
ifdef USE_STANDARD_AS_RULE
 
104
 
 
105
%.s: %.S
 
106
        $(CPP) -D__KERNEL__ $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$@) $< > $@
 
107
 
 
108
%.o: %.S
 
109
        $(CC) -D__KERNEL__ $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$@) -c -o $@ $<
 
110
 
 
111
endif
 
112
 
 
113
%.c: %.patch
 
114
        @xtmp=`echo $(MODCURDIR) | sed -e 's/^acore/core/'`/$@;\
 
115
        echo "copying file alsa-kernel/$$xtmp";\
 
116
        cp "$(TOPDIR)/alsa-kernel/$$xtmp" $@;\
 
117
        patch -p0 -i $< || { rm $@; exit 1; }
 
118
 
 
119
%.isapnp: %.c
 
120
ifeq (y,$(CONFIG_ISAPNP))
 
121
        $(CPP) -C -D__KERNEL__ $(CFLAGS) $(EXTRA_CFLAGS) -D__isapnp_now__ -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(CFLAGS_$@) $(CFLAGS_$@) $< | awk -f $(TOPDIR)/utils/convert_isapnp_ids > $@
 
122
else
 
123
        rm -f $@
 
124
        touch $@
 
125
endif
 
126
 
 
127
#
 
128
#
 
129
#
 
130
all_targets: $(isapnp-files) $(O_TARGET) $(L_TARGET)
 
131
 
 
132
#
 
133
# Rule to compile a set of .o files into one .o file
 
134
#
 
135
ifdef O_TARGET
 
136
$(O_TARGET): $(obj-y)
 
137
        touch $@
 
138
endif # O_TARGET
 
139
 
 
140
#
 
141
# Rule to compile a set of .o files into one .a file
 
142
#
 
143
ifdef L_TARGET
 
144
$(L_TARGET): $(obj-y)
 
145
        touch $@
 
146
endif
 
147
 
 
148
#
 
149
# Rule to link composite objects
 
150
#
 
151
 
 
152
__obj-m = $(filter-out export.o,$(obj-m))
 
153
ld-multi-used-m := $(sort $(foreach m,$(__obj-m),$(patsubst %,$(m),$($(basename $(m))-objs) $($(basename $(m))-y))))
 
154
ld-multi-objs-m := $(foreach m, $(ld-multi-used-m), $($(basename $(m))-objs) $($(basename $(m))-y) $(extra-$(basename $(m))-objs))
 
155
 
 
156
depend-objs     := $(foreach m,$(__obj-m),$($(basename $(m))-objs) $($(basename $(m))-y))
 
157
depend-files    := $(patsubst %.o,%.c,$(depend-objs))
 
158
 
 
159
$(ld-multi-used-m) : %.o: $(ld-multi-objs-m)
 
160
        rm -f $@
 
161
        $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs) $($(basename $@)-y) $(extra-$(basename $@)-objs), $^)
 
162
 
 
163
#
 
164
# This make dependencies quickly
 
165
#
 
166
fastdep: $(patsubst %,_sfdep_%,$(ALL_SUB_DIRS)) update-sndversions $(depend-files)
 
167
ifneq "$(strip $(depend-files))" ""
 
168
                $(CC) -M -D__KERNEL__ -D__isapnp_now__ $(CPPFLAGS) $(EXTRA_CFLAGS) $(depend-files) > .depend
 
169
endif
 
170
 
 
171
ifneq "$(strip $(ALL_SUB_DIRS))" ""
 
172
$(patsubst %,_sfdep_%,$(ALL_SUB_DIRS)):
 
173
        $(MAKE) -C $(patsubst _sfdep_%,%,$@) fastdep
 
174
endif
 
175
 
 
176
#
 
177
# A rule to make subdirectories
 
178
#
 
179
subdir-list = $(sort $(patsubst %,_subdir_%,$(SUB_DIRS)))
 
180
sub_dirs: dummy $(subdir-list)
 
181
 
 
182
ifdef SUB_DIRS
 
183
$(subdir-list) : dummy
 
184
        $(MAKE) -C $(patsubst _subdir_%,%,$@)
 
185
endif
 
186
 
 
187
#
 
188
# A rule to make modules
 
189
#
 
190
ALL_MOBJS = $(filter-out $(obj-y), $(obj-m))
 
191
 
 
192
MOD_DIRS := $(MOD_SUB_DIRS) $(MOD_IN_SUB_DIRS)
 
193
ifneq "$(strip $(MOD_DIRS))" ""
 
194
.PHONY: $(patsubst %,_modsubdir_%,$(MOD_DIRS))
 
195
$(patsubst %,_modsubdir_%,$(MOD_DIRS)) : dummy
 
196
        $(MAKE) -C $(patsubst _modsubdir_%,%,$@) modules
 
197
 
 
198
.PHONY: $(patsubst %,_modinst_%,$(MOD_DIRS))
 
199
$(patsubst %,_modinst_%,$(MOD_DIRS)) : dummy
 
200
        $(MAKE) -C $(patsubst _modinst_%,%,$@) modules_install
 
201
endif
 
202
 
 
203
.PHONY: modules
 
204
modules: $(isapnp-files) $(ALL_MOBJS) dummy \
 
205
         $(patsubst %,_modsubdir_%,$(MOD_DIRS))
 
206
 
 
207
.PHONY: _modinst__
 
208
_modinst__: dummy
 
209
ifneq "$(strip $(ALL_MOBJS))" ""
 
210
ifeq ($(moddir_tree),y)
 
211
        mkdir -p $(DESTDIR)$(moddir)/$(MODCURDIR)
 
212
        cp $(sort $(ALL_MOBJS)) $(DESTDIR)$(moddir)/$(MODCURDIR)
 
213
else
 
214
        mkdir -p $(DESTDIR)$(moddir)
 
215
        cp $(sort $(ALL_MOBJS)) $(DESTDIR)$(moddir)
 
216
endif
 
217
endif
 
218
 
 
219
.PHONY: modules_install
 
220
modules_install: _modinst__ \
 
221
         $(patsubst %,_modinst_%,$(MOD_DIRS))
 
222
 
 
223
#
 
224
# This sets version suffixes on exported symbols
 
225
# Separate the object into "normal" objects and "exporting" objects
 
226
# Exporting objects are: all objects that define symbol tables
 
227
#
 
228
ifdef CONFIG_MODULES
 
229
 
 
230
ifeq (y,$(CONFIG_SND_MVERSION))
 
231
ifneq "$(strip $(export-objs))" ""
 
232
 
 
233
MODINCL = $(TOPDIR)/include/modules
 
234
MODPREFIX = $(subst /,-,$(MODCURDIR))__
 
235
 
 
236
# The -w option (enable warnings) for genksyms will return here in 2.1
 
237
# So where has it gone?
 
238
#
 
239
# Added the SMP separator to stop module accidents between uniprocessor
 
240
# and SMP Intel boxes - AC - from bits by Michael Chastain
 
241
#
 
242
 
 
243
ifdef $(msmp)
 
244
        genksyms_smp_prefix := -p smp_
 
245
else
 
246
        genksyms_smp_prefix := 
 
247
endif
 
248
 
 
249
$(MODINCL)/$(MODPREFIX)%.ver: %.c update-sndvers
 
250
        @if [ ! -r $(MODINCL)/$(MODPREFIX)$*.stamp -o $(MODINCL)/$(MODPREFIX)$*.stamp -ot $< ]; then \
 
251
                if [ ! -f $(CONFIG_SND_KERNELDIR)/include/linux/modules/$*.stamp ]; then \
 
252
                echo '$(CC) -D__KERNEL__ $(CPPFLAGS) $(EXTRA_CFLAGS) -E -D__GENKSYMS__ $<'; \
 
253
                echo '| $(GENKSYMS) $(genksyms_smp_prefix) > $@.tmp'; \
 
254
                $(CC) -D__KERNEL__ $(CPPFLAGS) $(EXTRA_CFLAGS) -E -D__GENKSYMS__ $< \
 
255
                | $(GENKSYMS) $(genksyms_smp_prefix) > $@.tmp; \
 
256
                if [ -r $@ ] && cmp -s $@ $@.tmp; then echo $@ is unchanged; rm -f $@.tmp; \
 
257
                else echo mv $@.tmp $@; mv -f $@.tmp $@; fi; \
 
258
                elif [ ! -r $@ ]; then touch $@; \
 
259
                fi; \
 
260
        fi; touch $(MODINCL)/$(MODPREFIX)$*.stamp
 
261
 
 
262
$(addprefix $(MODINCL)/$(MODPREFIX),$(export-objs:.o=.ver)): $(TOPDIR)/include/config.h $(TOPDIR)/include/config1.h
 
263
 
 
264
# updates .ver files but not modversions.h
 
265
fastdep: $(addprefix $(MODINCL)/$(MODPREFIX),$(export-objs:.o=.ver))
 
266
 
 
267
endif # export-objs 
 
268
 
 
269
define update-sndvers
 
270
        (tmpfile=`echo $(SNDVERSIONS).tmp`; \
 
271
        (echo "#ifndef _LINUX_SNDVERSIONS_H"; \
 
272
          echo "#define _LINUX_SNDVERSIONS_H"; \
 
273
          echo "#include <linux/modsetver.h>"; \
 
274
          cd $(TOPDIR)/include/modules; \
 
275
          for f in *.ver; do \
 
276
            if [ -f $$f ]; then echo "#include \"modules/$${f}\""; fi; \
 
277
          done; \
 
278
          echo "#endif"; \
 
279
        ) > $${tmpfile}; \
 
280
        if [ -r $(SNDVERSIONS) ] && cmp -s $(SNDVERSIONS) $${tmpfile}; then \
 
281
                echo $(SNDVERSIONS) was not updated; \
 
282
                rm -f $${tmpfile}; \
 
283
        else \
 
284
                echo $(SNDVERSIONS) was updated; \
 
285
                mv -f $${tmpfile} $(SNDVERSIONS); \
 
286
        fi)
 
287
endef
 
288
 
 
289
$(SNDVERSIONS):
 
290
        $(update-sndvers)
 
291
 
 
292
$(active-objs): $(SNDVERSIONS)
 
293
 
 
294
else # !CONFIG_SND_MVERSION
 
295
 
 
296
define update-sndvers
 
297
        @echo "" > $(SNDVERSIONS)
 
298
endef
 
299
 
 
300
$(SNDVERSIONS):
 
301
        $(update-sndvers)
 
302
 
 
303
endif # CONFIG_SND_MVERSION
 
304
 
 
305
$(ld-multi-used-m): $(addprefix $(TOPDIR)/modules/,$(ld-multi-used-m))
 
306
 
 
307
$(TOPDIR)/modules/%.o: dummy
 
308
        @if ! test -L $@; then \
 
309
            echo "ln -sf ../$(MODCURDIR)/$(notdir $@) $(TOPDIR)/modules/$(notdir $@)" ; \
 
310
            ln -sf ../$(MODCURDIR)/$(notdir $@) $(TOPDIR)/modules/$(notdir $@) ; \
 
311
        fi
 
312
 
 
313
.PHONY: update-sndversions
 
314
update-sndversions: dummy
 
315
        $(update-sndvers)
 
316
 
 
317
ifneq "$(strip $(export-objs))" ""
 
318
ifeq (y,$(CONFIG_SND_MVERSION))
 
319
$(export-objs): $(addprefix $(MODINCL)/$(MODPREFIX),$(export-objs:.o=.ver)) $(export-objs:.o=.c)
 
320
else
 
321
$(export-objs): $(export-objs:.o=.c)
 
322
endif
 
323
        $(CC) -D__KERNEL__ $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB -c $(@:.o=.c)
 
324
endif
 
325
 
 
326
endif # CONFIG_MODULES
 
327
 
 
328
#
 
329
# include dependency files if they exist
 
330
#
 
331
ifneq ($(wildcard .depend),)
 
332
include .depend
 
333
endif
 
334
 
 
335
ifneq ($(wildcard $(TOPDIR)/.hdepend),)
 
336
include $(TOPDIR)/.hdepend
 
337
endif
 
338
 
 
339
endif   # NEW_KBUILD