Loading...
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 | # # This file contains rules which are shared between multiple Makefiles. # # # False targets. # .PHONY: dummy # # Special variables which should not be exported # unexport EXTRA_ASFLAGS unexport EXTRA_CFLAGS unexport EXTRA_LDFLAGS unexport EXTRA_ARFLAGS unexport SUBDIRS unexport SUB_DIRS unexport ALL_SUB_DIRS unexport MOD_SUB_DIRS unexport O_TARGET unexport O_OBJS unexport L_OBJS unexport M_OBJS # intermediate objects that form part of a module unexport MI_OBJS unexport ALL_MOBJS # objects that export symbol tables unexport OX_OBJS unexport LX_OBJS unexport MX_OBJS unexport MIX_OBJS unexport SYMTAB_OBJS unexport MOD_LIST_NAME # # Get things started. # first_rule: sub_dirs $(MAKE) all_targets # # Common rules # %.s: %.c $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -S $< -o $@ %.i: %.c $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -E $< > $@ %.o: %.c $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< %.o: %.s $(AS) $(ASFLAGS) $(EXTRA_CFLAGS) -o $@ $< # # # all_targets: $(O_TARGET) $(L_TARGET) # # Rule to compile a set of .o files into one .o file # ifdef O_TARGET ALL_O = $(OX_OBJS) $(O_OBJS) $(O_TARGET): $(ALL_O) $(TOPDIR)/include/linux/config.h rm -f $@ ifneq "$(strip $(ALL_O))" "" $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(ALL_O) else $(AR) rcs $@ endif endif # O_TARGET # # Rule to compile a set of .o files into one .a file # ifdef L_TARGET $(L_TARGET): $(LX_OBJS) $(L_OBJS) $(TOPDIR)/include/linux/config.h rm -f $@ $(AR) $(EXTRA_ARFLAGS) rcs $@ $(LX_OBJS) $(L_OBJS) endif # # This make dependencies quickly # fastdep: dummy $(TOPDIR)/scripts/mkdep *.[chS] > .depend ifdef ALL_SUB_DIRS set -e; for i in $(ALL_SUB_DIRS); do $(MAKE) -C $$i fastdep; done endif # # A rule to make subdirectories # sub_dirs: dummy ifdef SUB_DIRS set -e; for i in $(SUB_DIRS); do $(MAKE) -C $$i; done endif # # A rule to make modules # ALL_MOBJS = $(MX_OBJS) $(M_OBJS) ifneq "$(strip $(ALL_MOBJS))" "" PDWN=$(shell $(CONFIG_SHELL) $(TOPDIR)/scripts/pathdown.sh) endif modules: $(ALL_MOBJS) $(MIX_OBJS) $(MI_OBJS) dummy ifdef MOD_SUB_DIRS set -e; for i in $(MOD_SUB_DIRS); do $(MAKE) -C $$i modules; done endif ifdef MOD_IN_SUB_DIRS set -e; for i in $(MOD_IN_SUB_DIRS); do $(MAKE) -C $$i modules; done endif ifneq "$(strip $(MOD_LIST_NAME))" "" rm -f $$TOPDIR/modules/$(MOD_LIST_NAME) ifdef MOD_SUB_DIRS for i in $(MOD_SUB_DIRS); do \ echo `basename $$i`.o >> $$TOPDIR/modules/$(MOD_LIST_NAME); done endif ifneq "$(strip $(ALL_MOBJS))" "" echo $(ALL_MOBJS) >> $$TOPDIR/modules/$(MOD_LIST_NAME) endif ifneq "$(strip $(MOD_TO_LIST))" "" echo $(MOD_TO_LIST) >> $$TOPDIR/modules/$(MOD_LIST_NAME) endif endif ifneq "$(strip $(ALL_MOBJS))" "" echo $(PDWN) cd $$TOPDIR/modules; for i in $(ALL_MOBJS); do \ ln -sf ../$(PDWN)/$$i .; done endif # # A rule to do nothing # dummy: # # This is useful for testing # script: $(SCRIPT) # # This sets version suffixes on exported symbols # Uses SYMTAB_OBJS # Separate the object into "normal" objects and "exporting" objects # Exporting objects are: all objects that define symbol tables # ifdef CONFIG_MODULES SYMTAB_OBJS = $(LX_OBJS) $(OX_OBJS) $(MX_OBJS) $(MIX_OBJS) ifdef CONFIG_MODVERSIONS ifneq "$(strip $(SYMTAB_OBJS))" "" MODINCL = $(TOPDIR)/include/linux/modules # The -w option (enable warnings) for genksyms will return here in 2.1 $(MODINCL)/%.ver: %.c $(CC) $(CFLAGS) -E -D__GENKSYMS__ $<\ | $(GENKSYMS) -k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp mv $@.tmp $@ $(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver)): $(TOPDIR)/include/linux/autoconf.h $(TOPDIR)/include/linux/modversions.h: $(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver)) @echo updating $(TOPDIR)/include/linux/modversions.h @(echo "#ifndef _LINUX_MODVERSIONS_H";\ echo "#define _LINUX_MODVERSIONS_H"; \ echo "#include <linux/modsetver.h>"; \ cd $(TOPDIR)/include/linux/modules; \ for f in *.ver; do \ if [ -f $$f ]; then echo "#include <linux/modules/$${f}>"; fi; \ done; \ echo "#endif"; \ ) > $@ dep fastdep: $(TOPDIR)/include/linux/modversions.h endif # SYMTAB_OBJS $(M_OBJS): $(TOPDIR)/include/linux/modversions.h ifdef MAKING_MODULES $(O_OBJS) $(L_OBJS): $(TOPDIR)/include/linux/modversions.h endif else $(TOPDIR)/include/linux/modversions.h: @echo "#include <linux/modsetver.h>" > $@ endif # CONFIG_MODVERSIONS ifneq "$(strip $(SYMTAB_OBJS))" "" $(SYMTAB_OBJS): $(TOPDIR)/include/linux/modversions.h $(CC) $(CFLAGS) -DEXPORT_SYMTAB -c $(@:.o=.c) endif endif # CONFIG_MODULES # # include dependency files they exist # ifeq (.depend,$(wildcard .depend)) include .depend endif ifeq ($(TOPDIR)/.hdepend,$(wildcard $(TOPDIR)/.hdepend)) include $(TOPDIR)/.hdepend endif |