2 # This file contains rules which are shared between multiple Makefiles.
11 # Special variables which should not be exported
13 unexport EXTRA_ASFLAGS
15 unexport EXTRA_LDFLAGS
16 unexport EXTRA_ARFLAGS
26 # objects that export symbol tables
32 unexport MOD_LIST_NAME
45 $(CC
) $(CFLAGS
) $(EXTRA_CFLAGS
) -S
$< -o
$@
48 $(CC
) $(CFLAGS
) $(EXTRA_CFLAGS
) -c
-o
$@
$<
51 $(AS
) $(ASFLAGS
) $(EXTRA_CFLAGS
) -o
$@
$<
56 all_targets
: $(O_TARGET
) $(L_TARGET
)
59 # Rule to compile a set of .o files into one .o file
62 ALL_O
= $(OX_OBJS
) $(O_OBJS
)
63 $(O_TARGET
): $(ALL_O
) $(TOPDIR
)/include/linux
/config.h
65 ifneq "$(strip $(ALL_O))" ""
66 $(LD
) $(EXTRA_LDFLAGS
) -r
-o
$@
$(ALL_O
)
73 # Rule to compile a set of .o files into one .a file
76 $(L_TARGET
): $(LX_OBJS
) $(L_OBJS
) $(TOPDIR
)/include/linux
/config.h
78 $(AR
) $(EXTRA_ARFLAGS
) rcs
$@
$(LX_OBJS
) $(L_OBJS
)
82 # This make dependencies quickly
85 if
[ -n
"$(wildcard *.[chS])" ]; then \
86 $(TOPDIR
)/scripts
/mkdep
*.
[chS
] > .depend
; fi
88 set
-e
; for i in
$(ALL_SUB_DIRS
); do
$(MAKE
) -C
$$i fastdep
; done
92 # A rule to make subdirectories
96 set
-e
; for i in
$(SUB_DIRS
); do
$(MAKE
) -C
$$i; done
100 # A rule to make modules
102 ALL_MOBJS
= $(MX_OBJS
) $(M_OBJS
)
103 ifneq "$(strip $(ALL_MOBJS))" ""
104 PDWN
=$(shell $(CONFIG_SHELL
) $(TOPDIR
)/scripts
/pathdown.sh
)
106 modules
: $(ALL_MOBJS
) dummy
108 set
-e
; for i in
$(MOD_SUB_DIRS
); do
$(MAKE
) -C
$$i modules
; done
110 ifdef MOD_IN_SUB_DIRS
111 set
-e
; for i in
$(MOD_IN_SUB_DIRS
); do
$(MAKE
) -C
$$i modules
; done
113 ifneq "$(strip $(MOD_LIST_NAME))" ""
114 rm -f
$$TOPDIR/modules
/$(MOD_LIST_NAME
)
116 for i in
$(MOD_SUB_DIRS
); do \
117 echo
`basename $$i`.o
>> $$TOPDIR/modules
/$(MOD_LIST_NAME
); done
119 ifneq "$(strip $(ALL_MOBJS))" ""
120 echo
$(ALL_MOBJS
) >> $$TOPDIR/modules
/$(MOD_LIST_NAME
)
122 ifneq "$(strip $(MOD_TO_LIST))" ""
123 echo
$(MOD_TO_LIST
) >> $$TOPDIR/modules
/$(MOD_LIST_NAME
)
126 ifneq "$(strip $(ALL_MOBJS))" ""
128 cd
$$TOPDIR/modules
; for i in
$(ALL_MOBJS
); do \
129 ln
-sf ..
/$(PDWN
)/$$i .
; done
133 # A rule to do nothing
138 # This is useful for testing
144 # This sets version suffixes on exported symbols
146 # Separate the object into "normal" objects and "exporting" objects
147 # Exporting objects are: all objects that define symbol tables
151 SYMTAB_OBJS
= $(LX_OBJS
) $(OX_OBJS
) $(MX_OBJS
)
153 ifdef CONFIG_MODVERSIONS
154 ifneq "$(strip $(SYMTAB_OBJS))" ""
156 MODINCL
= $(TOPDIR
)/include/linux
/modules
158 # The -w option (enable warnings) for genksyms will return here in 2.1
159 $(MODINCL
)/%.ver
: %.c
160 $(CC
) $(CFLAGS
) -E
-D__GENKSYMS__
$<\
161 |
$(GENKSYMS
) -k
$(VERSION
).
$(PATCHLEVEL
).
$(SUBLEVEL
) > $@.tmp
164 $(addprefix $(MODINCL
)/,$(SYMTAB_OBJS
:.o
=.ver
)): $(TOPDIR
)/include/linux
/autoconf.h
166 $(TOPDIR
)/include/linux
/modversions.h
: $(addprefix $(MODINCL
)/,$(SYMTAB_OBJS
:.o
=.ver
))
167 @echo updating
$(TOPDIR
)/include/linux
/modversions.h
168 @
(echo
"#ifndef _LINUX_MODVERSIONS_H";\
169 echo
"#define _LINUX_MODVERSIONS_H"; \
170 echo
"#include <linux/modsetver.h>"; \
171 cd
$(TOPDIR
)/include/linux
/modules
; \
173 if
[ -f
$$f ]; then echo
"#include <linux/modules/$${f}>"; fi
; \
178 dep fastdep
: $(TOPDIR
)/include/linux
/modversions.h
182 $(M_OBJS
): $(TOPDIR
)/include/linux
/modversions.h
184 $(O_OBJS
) $(L_OBJS
): $(TOPDIR
)/include/linux
/modversions.h
189 $(TOPDIR
)/include/linux
/modversions.h
:
190 @echo
"#include <linux/modsetver.h>" > $@
192 endif # CONFIG_MODVERSIONS
194 ifneq "$(strip $(SYMTAB_OBJS))" ""
195 $(SYMTAB_OBJS
): $(TOPDIR
)/include/linux
/modversions.h
196 $(CC
) $(CFLAGS
) -DEXPORT_SYMTAB
-c
$(@
:.o
=.c
)
199 endif # CONFIG_MODULES
203 # include dependency files they exist
205 ifeq (.depend
,$(wildcard .depend
))
209 ifeq ($(TOPDIR
)/.hdepend
,$(wildcard $(TOPDIR
)/.hdepend
))
210 include $(TOPDIR
)/.hdepend