Version:  2.0.40 2.2.26 2.4.37 3.13 3.14 3.15 3.16 3.17 3.18 3.19 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 4.10

Linux/Makefile

  1 VERSION = 2
  2 PATCHLEVEL = 2
  3 SUBLEVEL = 26
  4 EXTRAVERSION = 
  5 
  6 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
  7 
  8 .EXPORT_ALL_VARIABLES:
  9 
 10 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
 11           else if [ -x /bin/bash ]; then echo /bin/bash; \
 12           else echo sh; fi ; fi)
 13 TOPDIR  := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
 14 
 15 HPATH           = $(TOPDIR)/include
 16 FINDHPATH       = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net
 17 
 18 HOSTCC          =gcc
 19 HOSTCFLAGS      =-Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
 20 
 21 CROSS_COMPILE   =
 22 
 23 AS      =$(CROSS_COMPILE)as
 24 LD      =$(CROSS_COMPILE)ld
 25 #
 26 #       foo-bar-gcc for cross builds
 27 #       gcc272 for Debian's old compiler for kernels
 28 #       kgcc for Conectiva, Mandrake and Red Hat 7
 29 #       otherwise 'cc'
 30 #
 31 CC      =$(shell if [ -n "$(CROSS_COMPILE)" ]; then echo $(CROSS_COMPILE)gcc; else \
 32         $(CONFIG_SHELL) scripts/kwhich gcc272 2>/dev/null || $(CONFIG_SHELL) scripts/kwhich kgcc 2>/dev/null || echo cc; fi) \
 33         -D__KERNEL__ -I$(HPATH)
 34 CPP     =$(CC) -E
 35 AR      =$(CROSS_COMPILE)ar
 36 NM      =$(CROSS_COMPILE)nm
 37 STRIP   =$(CROSS_COMPILE)strip
 38 OBJCOPY =$(CROSS_COMPILE)objcopy
 39 OBJDUMP =$(CROSS_COMPILE)objdump
 40 MAKE    =make
 41 GENKSYMS=/sbin/genksyms
 42 
 43 all:    do-it-all
 44 
 45 #
 46 # Make "config" the default target if there is no configuration file or
 47 # "depend" the target if there is no top-level dependency information.
 48 #
 49 ifeq (.config,$(wildcard .config))
 50 include .config
 51 ifeq (.depend,$(wildcard .depend))
 52 include .depend
 53 do-it-all:      Version vmlinux
 54 else
 55 CONFIGURATION = depend
 56 do-it-all:      depend
 57 endif
 58 else
 59 CONFIGURATION = config
 60 do-it-all:      config
 61 endif
 62 
 63 #
 64 # ROOT_DEV specifies the default root-device when making the image.
 65 # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
 66 # the default of FLOPPY is used by 'build'.
 67 #
 68 
 69 ROOT_DEV = CURRENT
 70 
 71 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 72 
 73 #
 74 # INSTALL_PATH specifies where to place the updated kernel and system map
 75 # images.  Uncomment if you want to place them anywhere other than root.
 76 
 77 #INSTALL_PATH=/boot
 78 
 79 #
 80 # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory 
 81 # relocations required by build roots.  This is not defined in the
 82 # makefile but the argument can be passed to make if needed.
 83 #
 84 
 85 #
 86 # If you want to preset the SVGA mode, uncomment the next line and
 87 # set SVGA_MODE to whatever number you want.
 88 # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
 89 # The number is the same as you would ordinarily press at bootup.
 90 #
 91 
 92 SVGA_MODE=      -DSVGA_MODE=NORMAL_VGA
 93 
 94 #
 95 # standard CFLAGS
 96 #
 97 
 98 CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
 99 
100 # use '-fno-strict-aliasing', but only if the compiler can take it
101 CFLAGS += $(shell if $(CC) -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-fno-strict-aliasing"; fi)
102 
103 ifdef CONFIG_SMP
104 CFLAGS += -D__SMP__
105 AFLAGS += -D__SMP__
106 endif
107 
108 #
109 # if you want the RAM disk device, define this to be the
110 # size in blocks.
111 #
112 
113 #RAMDISK = -DRAMDISK=512
114 
115 # Include the make variables (CC, etc...)
116 #
117 
118 CORE_FILES      =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o
119 FILESYSTEMS     =fs/filesystems.a
120 NETWORKS        =net/network.a
121 DRIVERS         =drivers/block/block.a \
122                  drivers/char/char.o \
123                  drivers/misc/misc.a
124 LIBS            =$(TOPDIR)/lib/lib.a
125 SUBDIRS         =kernel drivers mm fs net ipc lib
126 
127 ifdef CONFIG_NUBUS
128 DRIVERS := $(DRIVERS) drivers/nubus/nubus.a
129 endif
130 
131 ifeq ($(CONFIG_ISDN),y)
132 DRIVERS := $(DRIVERS) drivers/isdn/isdn.a
133 endif
134 
135 DRIVERS := $(DRIVERS) drivers/net/net.a
136 
137 ifeq ($(CONFIG_SCSI),y)
138 DRIVERS := $(DRIVERS) drivers/scsi/scsi.a
139 endif
140 
141 ifneq ($(CONFIG_CD_NO_IDESCSI)$(CONFIG_BLK_DEV_IDECD)$(CONFIG_BLK_DEV_SR)$(CONFIG_PARIDE_PCD),)
142 DRIVERS := $(DRIVERS) drivers/cdrom/cdrom.a
143 endif
144 
145 ifeq ($(CONFIG_SOUND),y)
146 DRIVERS := $(DRIVERS) drivers/sound/sounddrivers.o
147 endif
148 
149 ifdef CONFIG_PCI
150 DRIVERS := $(DRIVERS) drivers/pci/pci.a
151 endif
152 
153 ifdef CONFIG_DIO
154 DRIVERS := $(DRIVERS) drivers/dio/dio.a
155 endif
156 
157 ifdef CONFIG_SBUS
158 DRIVERS := $(DRIVERS) drivers/sbus/sbus.a
159 endif
160 
161 ifdef CONFIG_ZORRO
162 DRIVERS := $(DRIVERS) drivers/zorro/zorro.a
163 endif
164 
165 ifeq ($(CONFIG_FC4),y)
166 DRIVERS := $(DRIVERS) drivers/fc4/fc4.a
167 endif
168 
169 ifeq ($(CONFIG_NET_FC),y)
170 DRIVERS := $(DRIVERS) drivers/net/fc/fc.a
171 endif
172 
173 ifdef CONFIG_PPC
174 DRIVERS := $(DRIVERS) drivers/macintosh/macintosh.o
175 endif
176 
177 ifdef CONFIG_PNP
178 DRIVERS := $(DRIVERS) drivers/pnp/pnp.a
179 endif
180 
181 ifdef CONFIG_SGI
182 DRIVERS := $(DRIVERS) drivers/sgi/sgi.a
183 endif
184 
185 ifdef CONFIG_VT
186 DRIVERS := $(DRIVERS) drivers/video/video.a
187 endif
188 
189 ifeq ($(CONFIG_PARIDE),y)
190 DRIVERS := $(DRIVERS) drivers/block/paride/paride.a
191 endif
192 
193 ifdef CONFIG_HAMRADIO
194 DRIVERS := $(DRIVERS) drivers/net/hamradio/hamradio.a
195 endif
196 
197 ifeq ($(CONFIG_TC),y)
198 DRIVERS := $(DRIVERS) drivers/tc/tc.a
199 endif
200 
201 ifeq ($(CONFIG_USB),y)
202 DRIVERS := $(DRIVERS) drivers/usb/usbdrv.o
203 else
204   ifdef CONFIG_INPUT_ADBHID
205   DRIVERS := $(DRIVERS) drivers/usb/usbdrv.o
206   endif
207 endif
208 
209 ifeq ($(CONFIG_I2O),y)
210 DRIVERS := $(DRIVERS) drivers/i2o/i2o.a
211 endif
212 
213 ifeq ($(CONFIG_IRDA),y)
214 DRIVERS := $(DRIVERS) drivers/net/irda/irda_drivers.a
215 endif
216 
217 ifeq ($(CONFIG_I2O),y)
218 DRIVERS := $(DRIVERS) drivers/i2o/i2o.a
219 endif
220 
221 ifeq ($(CONFIG_PHONE),y)
222 DRIVERS := $(DRIVERS) drivers/telephony/telephony.a
223 endif
224 
225 include arch/$(ARCH)/Makefile
226 
227 .S.s:
228         $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -E -o $*.s $<
229 .S.o:
230         $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c -o $*.o $<
231 
232 Version: dummy
233         @rm -f include/linux/compile.h
234 
235 boot: vmlinux
236         @$(MAKE) -C arch/$(ARCH)/boot
237 
238 vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
239         $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
240                 --start-group \
241                 $(CORE_FILES) \
242                 $(FILESYSTEMS) \
243                 $(NETWORKS) \
244                 $(DRIVERS) \
245                 $(LIBS) \
246                 --end-group \
247                 -o vmlinux
248         $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
249 
250 symlinks:
251         rm -f include/asm
252         ( cd include ; ln -sf asm-$(ARCH) asm)
253         @if [ ! -d modules ]; then \
254                 mkdir modules; \
255         fi
256         @if [ ! -d include/linux/modules ]; then \
257                 mkdir include/linux/modules; \
258         fi
259 
260 oldconfig: symlinks
261         $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
262 
263 xconfig: symlinks
264         $(MAKE) -C scripts kconfig.tk
265         wish -f scripts/kconfig.tk
266 
267 menuconfig: include/linux/version.h symlinks
268         $(MAKE) -C scripts/lxdialog all
269         $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
270 
271 config: symlinks
272         $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
273 
274 include/config/MARKER: scripts/split-include include/linux/autoconf.h
275         scripts/split-include include/linux/autoconf.h include/config
276         @ touch include/config/MARKER
277 
278 linuxsubdirs: $(patsubst %, _dir_%, $(SUBDIRS))
279 
280 $(patsubst %, _dir_%, $(SUBDIRS)) : dummy include/config/MARKER
281         $(MAKE) -C $(patsubst _dir_%, %, $@)
282 
283 $(TOPDIR)/include/linux/version.h: include/linux/version.h
284 $(TOPDIR)/include/linux/compile.h: include/linux/compile.h
285 
286 newversion:
287         @if [ ! -f .version ]; then \
288                 echo 1 > .version; \
289         else \
290                 expr 0`cat .version` + 1 > .version; \
291         fi
292 
293 include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
294         @echo -n \#define UTS_VERSION \"\#`cat .version` > .ver
295         @if [ -n "$(CONFIG_SMP)" ] ; then echo -n " SMP" >> .ver; fi
296         @if [ -f .name ]; then  echo -n \-`cat .name` >> .ver; fi
297         @echo ' '`LANG=C date`'"' >> .ver
298         @echo \#define LINUX_COMPILE_TIME \"`LANG=C date +%T`\" >> .ver
299         @echo \#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
300         @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
301         @if [ -x /bin/dnsdomainname ]; then \
302            echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
303          elif [ -x /bin/domainname ]; then \
304            echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
305          else \
306            echo \#define LINUX_COMPILE_DOMAIN ; \
307          fi >> .ver
308         @echo \#define LINUX_COMPILER \"`$(CC) $(CFLAGS) -v 2>&1 | tail -1`\" >> .ver
309         @mv -f .ver $@
310 
311 include/linux/version.h: ./Makefile
312         @echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver
313         @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
314         @echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
315         @mv -f .ver $@
316 
317 init/version.o: init/version.c include/linux/compile.h include/config/MARKER
318         $(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
319 
320 init/main.o: init/main.c include/config/MARKER
321         $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
322 
323 fs lib mm ipc kernel drivers net: dummy
324         $(MAKE) $(subst $@, _dir_$@, $@)
325 
326 MODFLAGS += -DMODULE
327 ifdef CONFIG_MODULES
328 ifdef CONFIG_MODVERSIONS
329 MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
330 endif
331 
332 modules: include/config/MARKER $(patsubst %, _mod_%, $(SUBDIRS))  
333 
334 $(patsubst %, _mod_%, $(SUBDIRS)) : include/linux/version.h
335         $(MAKE) -C $(patsubst _mod_%, %, $@) CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules
336 
337 modules_install:
338         @( \
339         MODLIB=$(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE); \
340         mkdir -p $$MODLIB; \
341         rm -f $$MODLIB/build; \
342         [ `/sbin/insmod -V 2>&1 | head -1 | awk '/^insmod version /{split($$3, a, /\./); printf "%d%03d%03d\n", a[1], a[2], a[3];}'`0 -ge 20030140 ] && \
343         ln -s `pwd` $$MODLIB/build; \
344         cd modules; \
345         MODULES=""; \
346         inst_mod() { These="`cat $$1`"; MODULES="$$MODULES $$These"; \
347                 mkdir -p $$MODLIB/$$2; cp $$These $$MODLIB/$$2; \
348                 echo Installing modules under $$MODLIB/$$2; \
349         }; \
350         \
351         if [ -f BLOCK_MODULES ]; then inst_mod BLOCK_MODULES block; fi; \
352         if [ -f NET_MODULES   ]; then inst_mod NET_MODULES   net;   fi; \
353         if [ -f IPV4_MODULES  ]; then inst_mod IPV4_MODULES  ipv4;  fi; \
354         if [ -f IPV6_MODULES  ]; then inst_mod IPV6_MODULES  ipv6;  fi; \
355         if [ -f SCSI_MODULES  ]; then inst_mod SCSI_MODULES  scsi;  fi; \
356         if [ -f FS_MODULES    ]; then inst_mod FS_MODULES    fs;    fi; \
357         if [ -f NLS_MODULES   ]; then inst_mod NLS_MODULES   fs;    fi; \
358         if [ -f CDROM_MODULES ]; then inst_mod CDROM_MODULES cdrom; fi; \
359         if [ -f HAM_MODULES   ]; then inst_mod HAM_MODULES   net;   fi; \
360         if [ -f SOUND_MODULES ]; then inst_mod SOUND_MODULES sound; fi; \
361         if [ -f VIDEO_MODULES ]; then inst_mod VIDEO_MODULES video; fi; \
362         if [ -f FC4_MODULES   ]; then inst_mod FC4_MODULES   fc4;   fi; \
363         if [ -f IRDA_MODULES  ]; then inst_mod IRDA_MODULES  net;   fi; \
364         if [ -f USB_MODULES   ]; then inst_mod USB_MODULES   usb;   fi; \
365         if [ -f USB_SERIAL_MODULES ]; then inst_mod USB_SERIAL_MODULES usb; fi; \
366         if [ -f SK98LIN_MODULES ]; then inst_mod SK98LIN_MODULES  net;   fi; \
367         if [ -f SKFP_MODULES ]; then inst_mod SKFP_MODULES   net;   fi; \
368         \
369         for f in *.o; do [ -r $$f ] && echo $$f; done | sort > $$MODLIB/.allmods; \
370         echo $$MODULES | tr ' ' '\n' | sort | comm -23 $$MODLIB/.allmods - > $$MODLIB/.misc; \
371         if [ -s $$MODLIB/.misc ]; then inst_mod $$MODLIB/.misc misc; fi; \
372         rm -f $$MODLIB/.misc $$MODLIB/.allmods; \
373         )
374 
375 # modules disabled....
376 
377 else
378 modules modules_install: dummy
379         @echo
380         @echo "The present kernel configuration has modules disabled."
381         @echo "Type 'make config' and enable loadable module support."
382         @echo "Then build a kernel with module support enabled."
383         @echo
384         @exit 1
385 endif
386 
387 clean:  archclean
388         rm -f kernel/ksyms.lst include/linux/compile.h
389         rm -f core `find . -name '*.[oas]' ! \( -regex '.*lxdialog/.*' \
390                 -o -regex '.*ksymoops/.*' \) -print`
391         rm -f core `find . -type f -name 'core' -print`
392         rm -f core `find . -name '.*.flags' -print`
393         rm -f vmlinux System.map
394         rm -f .tmp*
395         rm -f drivers/char/consolemap_deftbl.c drivers/video/promcon_tbl.c
396         rm -f drivers/char/conmakehash
397         rm -f drivers/sound/bin2hex drivers/sound/hex2hex
398         if [ -d modules ]; then \
399                 rm -f core `find modules/ -type f -print`; \
400         fi
401         rm -f submenu*
402 
403 mrproper: clean archmrproper
404         rm -f include/linux/autoconf.h include/linux/version.h
405         rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h
406         rm -f drivers/net/hamradio/soundmodem/sm_tbl_{hapn4800,psk4800}.h
407         rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h
408         rm -f drivers/net/hamradio/soundmodem/gentbl
409         rm -f drivers/char/hfmodem/gentbl drivers/char/hfmodem/tables.h
410         rm -f drivers/sound/*_boot.h drivers/sound/.*.boot
411         rm -f drivers/sound/msndinit.c
412         rm -f drivers/sound/msndperm.c
413         rm -f drivers/sound/pndsperm.c
414         rm -f drivers/sound/pndspini.c
415         rm -f .version .config* config.in config.old
416         rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp
417         rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog
418         rm -f scripts/ksymoops/*.o scripts/ksymoops/ksymoops
419         rm -f .menuconfig.log
420         rm -f include/asm
421         rm -rf include/config
422         rm -f .depend `find . -name .depend -print`
423         rm -f core `find . -size 0 -print`
424         rm -f .hdepend scripts/mkdep scripts/split-include
425         rm -f $(TOPDIR)/include/linux/modversions.h
426         rm -rf $(TOPDIR)/include/linux/modules
427         rm -rf modules
428 
429 distclean: mrproper
430         rm -f core `find . \( -not -type d \) -and \
431                 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
432                 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
433                 -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS
434 
435 backup: mrproper
436         cd .. && tar cf - linux/ | gzip -9 > backup.gz
437         sync
438 
439 sums:
440         find . -type f -print | sort | xargs sum > .SUMS
441 
442 dep-files: scripts/mkdep archdep include/linux/version.h new-genksyms
443         scripts/mkdep init/*.c > .depend
444         scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend
445 #       set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep ;done
446 # let this be made through the fastdep rule in Rules.make
447         $(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)"
448 ifdef CONFIG_MODVERSIONS
449         $(MAKE) update-modverfile
450 endif
451 
452 MODVERFILE :=
453 
454 ifdef CONFIG_MODVERSIONS
455 
456 MODVERFILE := $(TOPDIR)/include/linux/modversions.h
457 
458 new-genksyms:
459         @$(GENKSYMS) -k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) </dev/null \
460         2>/dev/null || ( echo -e "\nYou need a new version of the genksyms\
461         program, which is part of\nthe modutils package. Please read the file\
462         Documentation/Changes\nfor more information.\n"; exit 1 )
463 
464 else
465 
466 new-genksyms:
467 
468 endif
469 
470 depend dep: dep-files $(MODVERFILE)
471 
472 # make checkconfig: Prune 'scripts' directory to avoid "false positives".
473 checkconfig:
474         perl -w scripts/checkconfig.pl `find * -path 'scripts' -prune -o -name '*.[hcS]' -print | sort`
475 
476 checkhelp:
477         perl -w scripts/checkhelp.pl `find * -name [cC]onfig.in -print`
478 
479 ifdef CONFIGURATION
480 ..$(CONFIGURATION):
481         @echo
482         @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
483         @echo
484         $(MAKE) $(CONFIGURATION)
485         @echo
486         @echo "Successful. Try re-making (ignore the error that follows)"
487         @echo
488         exit 1
489 
490 #dummy: ..$(CONFIGURATION)
491 dummy:
492 
493 else
494 
495 dummy:
496 
497 endif
498 
499 include Rules.make
500 
501 #
502 # This generates dependencies for the .h files.
503 #
504 
505 scripts/mkdep: scripts/mkdep.c
506         $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
507 
508 scripts/split-include: scripts/split-include.c
509         $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c

This page was automatically generated by LXR 0.3.1 (source).  •  Linux is a registered trademark of Linus Torvalds  •  Contact us