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
25 # intermediate objects that form part of a module
28 # objects that export symbol tables
35 unexport MOD_LIST_NAME
48 $(CC
) $(CFLAGS
) $(EXTRA_CFLAGS
) -S
$< -o
$@
51 $(CC
) $(CFLAGS
) $(EXTRA_CFLAGS
) -E
$< > $@
54 $(CC
) $(CFLAGS
) $(EXTRA_CFLAGS
) -c
-o
$@
$<
57 $(AS
) $(ASFLAGS
) $(EXTRA_CFLAGS
) -o
$@
$<
62 all_targets
: $(O_TARGET
) $(L_TARGET
)
65 # Rule to compile a set of .o files into one .o file
68 ALL_O
= $(OX_OBJS
) $(O_OBJS
)
69 $(O_TARGET
): $(ALL_O
) $(TOPDIR
)/include/linux
/config.h
71 ifneq "$(strip $(ALL_O))" ""
72 $(LD
) $(EXTRA_LDFLAGS
) -r
-o
$@
$(ALL_O
)
79 # Rule to compile a set of .o files into one .a file
82 $(L_TARGET
): $(LX_OBJS
) $(L_OBJS
) $(TOPDIR
)/include/linux
/config.h
84 $(AR
) $(EXTRA_ARFLAGS
) rcs
$@
$(LX_OBJS
) $(L_OBJS
)
88 # This make dependencies quickly
91 $(TOPDIR
)/scripts
/mkdep
*.
[chS
] > .depend
93 set
-e
; for i in
$(ALL_SUB_DIRS
); do
$(MAKE
) -C
$$i fastdep
; done
97 # A rule to make subdirectories
101 set
-e
; for i in
$(SUB_DIRS
); do
$(MAKE
) -C
$$i; done
105 # A rule to make modules
107 ALL_MOBJS
= $(MX_OBJS
) $(M_OBJS
)
108 ifneq "$(strip $(ALL_MOBJS))" ""
109 PDWN
=$(shell $(CONFIG_SHELL
) $(TOPDIR
)/scripts
/pathdown.sh
)
111 modules
: $(ALL_MOBJS
) $(MIX_OBJS
) $(MI_OBJS
) dummy
113 set
-e
; for i in
$(MOD_SUB_DIRS
); do
$(MAKE
) -C
$$i modules
; done
115 ifdef MOD_IN_SUB_DIRS
116 set
-e
; for i in
$(MOD_IN_SUB_DIRS
); do
$(MAKE
) -C
$$i modules
; done
118 ifneq "$(strip $(MOD_LIST_NAME))" ""
119 rm -f
$$TOPDIR/modules
/$(MOD_LIST_NAME
)
121 for i in
$(MOD_SUB_DIRS
); do \
122 echo
`basename $$i`.o
>> $$TOPDIR/modules
/$(MOD_LIST_NAME
); done
124 ifneq "$(strip $(ALL_MOBJS))" ""
125 echo
$(ALL_MOBJS
) >> $$TOPDIR/modules
/$(MOD_LIST_NAME
)
127 ifneq "$(strip $(MOD_TO_LIST))" ""
128 echo
$(MOD_TO_LIST
) >> $$TOPDIR/modules
/$(MOD_LIST_NAME
)
131 ifneq "$(strip $(ALL_MOBJS))" ""
133 cd
$$TOPDIR/modules
; for i in
$(ALL_MOBJS
); do \
134 ln
-sf ..
/$(PDWN
)/$$i .
; done
138 # A rule to do nothing
143 # This is useful for testing
149 # This sets version suffixes on exported symbols
151 # Separate the object into "normal" objects and "exporting" objects
152 # Exporting objects are: all objects that define symbol tables
156 SYMTAB_OBJS
= $(LX_OBJS
) $(OX_OBJS
) $(MX_OBJS
) $(MIX_OBJS
)
158 ifdef CONFIG_MODVERSIONS
159 ifneq "$(strip $(SYMTAB_OBJS))" ""
161 MODINCL
= $(TOPDIR
)/include/linux
/modules
163 # The -w option (enable warnings) for genksyms will return here in 2.1
164 $(MODINCL
)/%.ver
: %.c
165 $(CC
) $(CFLAGS
) -E
-D__GENKSYMS__
$<\
166 |
$(GENKSYMS
) -k
$(VERSION
).
$(PATCHLEVEL
).
$(SUBLEVEL
) > $@.tmp
169 $(addprefix $(MODINCL
)/,$(SYMTAB_OBJS
:.o
=.ver
)): $(TOPDIR
)/include/linux
/autoconf.h
171 $(TOPDIR
)/include/linux
/modversions.h
: $(addprefix $(MODINCL
)/,$(SYMTAB_OBJS
:.o
=.ver
))
172 @echo updating
$(TOPDIR
)/include/linux
/modversions.h
173 @
(echo
"#ifndef _LINUX_MODVERSIONS_H";\
174 echo
"#define _LINUX_MODVERSIONS_H"; \
175 echo
"#include <linux/modsetver.h>"; \
176 cd
$(TOPDIR
)/include/linux
/modules
; \
178 if
[ -f
$$f ]; then echo
"#include <linux/modules/$${f}>"; fi
; \
183 dep fastdep
: $(TOPDIR
)/include/linux
/modversions.h
187 $(M_OBJS
): $(TOPDIR
)/include/linux
/modversions.h
189 $(O_OBJS
) $(L_OBJS
): $(TOPDIR
)/include/linux
/modversions.h
194 $(TOPDIR
)/include/linux
/modversions.h
:
195 @echo
"#include <linux/modsetver.h>" > $@
197 endif # CONFIG_MODVERSIONS
199 ifneq "$(strip $(SYMTAB_OBJS))" ""
200 $(SYMTAB_OBJS
): $(TOPDIR
)/include/linux
/modversions.h
$(SYMTAB_OBJS
:.o
=.c
)
201 $(CC
) $(CFLAGS
) -DEXPORT_SYMTAB
-c
$(@
:.o
=.c
)
204 endif # CONFIG_MODULES
208 # include dependency files they exist
210 ifeq (.depend
,$(wildcard .depend
))
214 ifeq ($(TOPDIR
)/.hdepend
,$(wildcard $(TOPDIR
)/.hdepend
))
215 include $(TOPDIR
)/.hdepend