#
|
#
|
# This file contains rules which are shared between multiple Makefiles.
|
# This file contains rules which are shared between multiple Makefiles.
|
#
|
#
|
|
|
#
|
#
|
# False targets.
|
# False targets.
|
#
|
#
|
.PHONY: dummy
|
.PHONY: dummy
|
|
|
#
|
#
|
# Special variables which should not be exported
|
# Special variables which should not be exported
|
#
|
#
|
unexport EXTRA_ASFLAGS
|
unexport EXTRA_ASFLAGS
|
unexport EXTRA_CFLAGS
|
unexport EXTRA_CFLAGS
|
unexport EXTRA_LDFLAGS
|
unexport EXTRA_LDFLAGS
|
unexport EXTRA_ARFLAGS
|
unexport EXTRA_ARFLAGS
|
unexport SUBDIRS
|
unexport SUBDIRS
|
unexport SUB_DIRS
|
unexport SUB_DIRS
|
unexport ALL_SUB_DIRS
|
unexport ALL_SUB_DIRS
|
unexport MOD_SUB_DIRS
|
unexport MOD_SUB_DIRS
|
unexport O_TARGET
|
unexport O_TARGET
|
unexport O_OBJS
|
unexport O_OBJS
|
unexport L_OBJS
|
unexport L_OBJS
|
unexport M_OBJS
|
unexport M_OBJS
|
unexport MI_OBJS
|
unexport MI_OBJS
|
unexport ALL_MOBJS
|
unexport ALL_MOBJS
|
# objects that export symbol tables
|
# objects that export symbol tables
|
unexport OX_OBJS
|
unexport OX_OBJS
|
unexport LX_OBJS
|
unexport LX_OBJS
|
unexport MX_OBJS
|
unexport MX_OBJS
|
unexport MIX_OBJS
|
unexport MIX_OBJS
|
unexport SYMTAB_OBJS
|
unexport SYMTAB_OBJS
|
|
|
unexport MOD_LIST_NAME
|
unexport MOD_LIST_NAME
|
|
|
#
|
#
|
# Get things started.
|
# Get things started.
|
#
|
#
|
first_rule: sub_dirs
|
first_rule: sub_dirs
|
$(MAKE) all_targets
|
$(MAKE) all_targets
|
|
|
#
|
#
|
# Common rules
|
# Common rules
|
#
|
#
|
|
|
%.s: %.c
|
%.s: %.c
|
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -S $< -o $@
|
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -S $< -o $@
|
|
|
%.o: %.c
|
%.o: %.c
|
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
|
|
|
%.o: %.s
|
%.o: %.s
|
$(AS) $(ASFLAGS) $(EXTRA_CFLAGS) -o $@ $<
|
$(AS) $(ASFLAGS) $(EXTRA_CFLAGS) -o $@ $<
|
|
|
#
|
#
|
#
|
#
|
#
|
#
|
all_targets: $(O_TARGET) $(L_TARGET)
|
all_targets: $(O_TARGET) $(L_TARGET)
|
|
|
#
|
#
|
# Rule to compile a set of .o files into one .o file
|
# Rule to compile a set of .o files into one .o file
|
#
|
#
|
ifdef O_TARGET
|
ifdef O_TARGET
|
ALL_O = $(OX_OBJS) $(O_OBJS)
|
ALL_O = $(OX_OBJS) $(O_OBJS)
|
$(O_TARGET): $(ALL_O) $(TOPDIR)/include/linux/config.h
|
$(O_TARGET): $(ALL_O) $(TOPDIR)/include/linux/config.h
|
rm -f $@
|
rm -f $@
|
ifneq "$(strip $(ALL_O))" ""
|
ifneq "$(strip $(ALL_O))" ""
|
$(LD) $(EXTRA_LDFLAGS) -r -o $@ $(ALL_O)
|
$(LD) $(EXTRA_LDFLAGS) -r -o $@ $(ALL_O)
|
else
|
else
|
$(AR) rcs $@
|
$(AR) rcs $@
|
endif
|
endif
|
endif
|
endif
|
|
|
#
|
#
|
# Rule to compile a set of .o files into one .a file
|
# Rule to compile a set of .o files into one .a file
|
#
|
#
|
ifdef L_TARGET
|
ifdef L_TARGET
|
$(L_TARGET): $(LX_OBJS) $(L_OBJS) $(TOPDIR)/include/linux/config.h
|
$(L_TARGET): $(LX_OBJS) $(L_OBJS) $(TOPDIR)/include/linux/config.h
|
rm -f $@
|
rm -f $@
|
$(AR) $(EXTRA_ARFLAGS) rcs $@ $(LX_OBJS) $(L_OBJS)
|
$(AR) $(EXTRA_ARFLAGS) rcs $@ $(LX_OBJS) $(L_OBJS)
|
endif
|
endif
|
|
|
#
|
#
|
# This make dependencies quickly
|
# This make dependencies quickly
|
#
|
#
|
fastdep: dummy
|
fastdep: dummy
|
if [ -n "$(wildcard *.[chS])" ]; then \
|
if [ -n "$(wildcard *.[chS])" ]; then \
|
$(TOPDIR)/scripts/mkdep *.[chS] > .depend; fi
|
$(TOPDIR)/scripts/mkdep *.[chS] > .depend; fi
|
ifdef ALL_SUB_DIRS
|
ifdef ALL_SUB_DIRS
|
set -e; for i in $(ALL_SUB_DIRS); do $(MAKE) -C $$i fastdep; done
|
set -e; for i in $(ALL_SUB_DIRS); do $(MAKE) -C $$i fastdep; done
|
endif
|
endif
|
|
|
#
|
#
|
# A rule to make subdirectories
|
# A rule to make subdirectories
|
#
|
#
|
sub_dirs: dummy
|
sub_dirs: dummy
|
ifdef SUB_DIRS
|
ifdef SUB_DIRS
|
set -e; for i in $(SUB_DIRS); do $(MAKE) -C $$i; done
|
set -e; for i in $(SUB_DIRS); do $(MAKE) -C $$i; done
|
endif
|
endif
|
|
|
#
|
#
|
# A rule to make modules
|
# A rule to make modules
|
#
|
#
|
ALL_MOBJS = $(MX_OBJS) $(M_OBJS)
|
ALL_MOBJS = $(MX_OBJS) $(M_OBJS)
|
ifneq "$(strip $(ALL_MOBJS))" ""
|
ifneq "$(strip $(ALL_MOBJS))" ""
|
PDWN=$(shell $(CONFIG_SHELL) $(TOPDIR)/scripts/pathdown.sh)
|
PDWN=$(shell $(CONFIG_SHELL) $(TOPDIR)/scripts/pathdown.sh)
|
endif
|
endif
|
modules: $(ALL_MOBJS) $(MIX_OBJS) $(MI_OBJS) dummy
|
modules: $(ALL_MOBJS) $(MIX_OBJS) $(MI_OBJS) dummy
|
ifdef MOD_SUB_DIRS
|
ifdef MOD_SUB_DIRS
|
set -e; for i in $(MOD_SUB_DIRS); do $(MAKE) -C $$i modules; done
|
set -e; for i in $(MOD_SUB_DIRS); do $(MAKE) -C $$i modules; done
|
endif
|
endif
|
ifneq "$(strip $(MOD_LIST_NAME))" ""
|
ifneq "$(strip $(MOD_LIST_NAME))" ""
|
rm -f $$TOPDIR/modules/$(MOD_LIST_NAME)
|
rm -f $$TOPDIR/modules/$(MOD_LIST_NAME)
|
ifdef MOD_SUB_DIRS
|
ifdef MOD_SUB_DIRS
|
for i in $(MOD_SUB_DIRS); do \
|
for i in $(MOD_SUB_DIRS); do \
|
echo `basename $$i`.o >> $$TOPDIR/modules/$(MOD_LIST_NAME); done
|
echo `basename $$i`.o >> $$TOPDIR/modules/$(MOD_LIST_NAME); done
|
endif
|
endif
|
ifneq "$(strip $(ALL_MOBJS))" ""
|
ifneq "$(strip $(ALL_MOBJS))" ""
|
echo $(ALL_MOBJS) >> $$TOPDIR/modules/$(MOD_LIST_NAME)
|
echo $(ALL_MOBJS) >> $$TOPDIR/modules/$(MOD_LIST_NAME)
|
endif
|
endif
|
endif
|
endif
|
ifneq "$(strip $(ALL_MOBJS))" ""
|
ifneq "$(strip $(ALL_MOBJS))" ""
|
echo $(PDWN)
|
echo $(PDWN)
|
cd $$TOPDIR/modules; for i in $(ALL_MOBJS); do \
|
cd $$TOPDIR/modules; for i in $(ALL_MOBJS); do \
|
ln -sf ../$(PDWN)/$$i .; done
|
ln -sf ../$(PDWN)/$$i .; done
|
endif
|
endif
|
|
|
#
|
#
|
# A rule to do nothing
|
# A rule to do nothing
|
#
|
#
|
dummy:
|
dummy:
|
|
|
#
|
#
|
# This is useful for testing
|
# This is useful for testing
|
#
|
#
|
script:
|
script:
|
$(SCRIPT)
|
$(SCRIPT)
|
|
|
#
|
#
|
# This sets version suffixes on exported symbols
|
# This sets version suffixes on exported symbols
|
# Uses SYMTAB_OBJS
|
# Uses SYMTAB_OBJS
|
# Separate the object into "normal" objects and "exporting" objects
|
# Separate the object into "normal" objects and "exporting" objects
|
# Exporting objects are: all objects that define symbol tables
|
# Exporting objects are: all objects that define symbol tables
|
#
|
#
|
ifdef CONFIG_MODVERSIONS
|
ifdef CONFIG_MODVERSIONS
|
SYMTAB_OBJS = $(LX_OBJS) $(OX_OBJS) $(MX_OBJS) $(MIX_OBJS)
|
SYMTAB_OBJS = $(LX_OBJS) $(OX_OBJS) $(MX_OBJS) $(MIX_OBJS)
|
ifneq "$(strip $(SYMTAB_OBJS))" ""
|
ifneq "$(strip $(SYMTAB_OBJS))" ""
|
|
|
MODINCL = $(TOPDIR)/include/linux/modules
|
MODINCL = $(TOPDIR)/include/linux/modules
|
|
|
# The -w option (enable warnings) for /bin/genksyms will return here in 2.1
|
# The -w option (enable warnings) for /bin/genksyms will return here in 2.1
|
$(MODINCL)/%.ver: %.c
|
$(MODINCL)/%.ver: %.c
|
@if [ ! -x /sbin/genksyms ]; then echo "Please read: Documentation/modules.txt"; fi
|
@if [ ! -x /sbin/genksyms ]; then echo "Please read: Documentation/modules.txt"; fi
|
$(CC) $(CFLAGS) -E -D__GENKSYMS__ $< | /sbin/genksyms $(MODINCL)
|
$(CC) $(CFLAGS) -E -D__GENKSYMS__ $< | /sbin/genksyms $(MODINCL)
|
|
|
$(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver)): $(TOPDIR)/include/linux/autoconf.h
|
$(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver)): $(TOPDIR)/include/linux/autoconf.h
|
|
|
.PHONY: $(TOPDIR)/include/linux/modversions.h
|
.PHONY: $(TOPDIR)/include/linux/modversions.h
|
|
|
$(TOPDIR)/include/linux/modversions.h: $(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver))
|
$(TOPDIR)/include/linux/modversions.h: $(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver))
|
@echo updating $(TOPDIR)/include/linux/modversions.h
|
@echo updating $(TOPDIR)/include/linux/modversions.h
|
@(echo "#ifdef MODVERSIONS";\
|
@(echo "#ifdef MODVERSIONS";\
|
echo "#undef CONFIG_MODVERSIONS";\
|
echo "#undef CONFIG_MODVERSIONS";\
|
echo "#define CONFIG_MODVERSIONS";\
|
echo "#define CONFIG_MODVERSIONS";\
|
echo "#ifndef _set_ver";\
|
echo "#ifndef _set_ver";\
|
echo "#define _set_ver(sym,vers) sym ## _R ## vers";\
|
echo "#define _set_ver(sym,vers) sym ## _R ## vers";\
|
echo "#endif";\
|
echo "#endif";\
|
cd $(TOPDIR)/include/linux/modules; for f in *.ver;\
|
cd $(TOPDIR)/include/linux/modules; for f in *.ver;\
|
do echo "#include "; done; \
|
do echo "#include "; done; \
|
echo "#undef CONFIG_MODVERSIONS";\
|
echo "#undef CONFIG_MODVERSIONS";\
|
echo "#endif") \
|
echo "#endif") \
|
> $(TOPDIR)/include/linux/modversions.h
|
> $(TOPDIR)/include/linux/modversions.h
|
|
|
$(MX_OBJS): $(TOPDIR)/include/linux/modversions.h
|
$(MX_OBJS): $(TOPDIR)/include/linux/modversions.h
|
$(CC) $(CFLAGS) -DEXPORT_SYMTAB -c $(@:.o=.c)
|
$(CC) $(CFLAGS) -DEXPORT_SYMTAB -c $(@:.o=.c)
|
|
|
$(LX_OBJS) $(OX_OBJS): $(TOPDIR)/include/linux/modversions.h
|
$(LX_OBJS) $(OX_OBJS): $(TOPDIR)/include/linux/modversions.h
|
$(CC) $(CFLAGS) -DMODVERSIONS -DEXPORT_SYMTAB -c $(@:.o=.c)
|
$(CC) $(CFLAGS) -DMODVERSIONS -DEXPORT_SYMTAB -c $(@:.o=.c)
|
|
|
dep fastdep: $(TOPDIR)/include/linux/modversions.h
|
dep fastdep: $(TOPDIR)/include/linux/modversions.h
|
|
|
endif
|
endif
|
$(M_OBJS): $(TOPDIR)/include/linux/modversions.h
|
$(M_OBJS): $(TOPDIR)/include/linux/modversions.h
|
ifdef MAKING_MODULES
|
ifdef MAKING_MODULES
|
$(O_OBJS) $(L_OBJS): $(TOPDIR)/include/linux/modversions.h
|
$(O_OBJS) $(L_OBJS): $(TOPDIR)/include/linux/modversions.h
|
endif
|
endif
|
# This is needed to ensure proper dependency for multipart modules such as
|
# This is needed to ensure proper dependency for multipart modules such as
|
# fs/ext.o. (Otherwise, not all subobjects will be recompiled when
|
# fs/ext.o. (Otherwise, not all subobjects will be recompiled when
|
# version information changes.)
|
# version information changes.)
|
|
|
endif
|
endif
|
|
|
#
|
#
|
# include dependency files they exist
|
# include dependency files they exist
|
#
|
#
|
ifeq (.depend,$(wildcard .depend))
|
ifeq (.depend,$(wildcard .depend))
|
include .depend
|
include .depend
|
endif
|
endif
|
|
|
ifeq ($(TOPDIR)/.hdepend,$(wildcard $(TOPDIR)/.hdepend))
|
ifeq ($(TOPDIR)/.hdepend,$(wildcard $(TOPDIR)/.hdepend))
|
include $(TOPDIR)/.hdepend
|
include $(TOPDIR)/.hdepend
|
endif
|
endif
|
|
|