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 = 0
  3 SUBLEVEL = 40
  4 EXTRAVERSION =
  5 
  6 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
  7 
  8 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
  9 
 10 #
 11 # For SMP kernels, set this. We don't want to have this in the config file
 12 # because it makes re-config very ugly and too many fundamental files depend
 13 # on "CONFIG_SMP"
 14 #
 15 # NOTE! SMP is experimental. See the file Documentation/SMP.txt
 16 #
 17 # SMP = 1
 18 #
 19 # SMP profiling options
 20 # SMP_PROF = 1
 21 
 22 .EXPORT_ALL_VARIABLES:
 23 
 24 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
 25           else if [ -x /bin/bash ]; then echo /bin/bash; \
 26           else echo sh; fi ; fi)
 27 TOPDIR  := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
 28 
 29 HPATH           = $(TOPDIR)/include
 30 FINDHPATH       = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net
 31 
 32 HOSTCC          =gcc -I$(HPATH)
 33 HOSTCFLAGS      =-O2 -fomit-frame-pointer
 34 
 35 CROSS_COMPILE   =
 36 
 37 AS      = $(CROSS_COMPILE)as
 38 LD      = $(CROSS_COMPILE)ld
 39 CC      = $(CROSS_COMPILE)gcc -D__KERNEL__ -I$(HPATH)
 40 CPP     = $(CC) -E
 41 AR      = $(CROSS_COMPILE)ar
 42 NM      = $(CROSS_COMPILE)nm
 43 STRIP   = $(CROSS_COMPILE)strip
 44 MAKE    = make
 45 PERL    = perl
 46 
 47 all:    do-it-all
 48 
 49 #
 50 # Make "config" the default target if there is no configuration file or
 51 # "depend" the target if there is no top-level dependency information.
 52 #
 53 ifeq (.config,$(wildcard .config))
 54 include .config
 55 ifeq (.depend,$(wildcard .depend))
 56 include .depend
 57 do-it-all:      Version vmlinux
 58 else
 59 CONFIGURATION = depend
 60 do-it-all:      depend
 61 endif
 62 else
 63 CONFIGURATION = config
 64 do-it-all:      config
 65 endif
 66 
 67 #
 68 # ROOT_DEV specifies the default root-device when making the image.
 69 # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
 70 # the default of FLOPPY is used by 'build'.
 71 #
 72 
 73 ROOT_DEV = CURRENT
 74 
 75 #
 76 # INSTALL_PATH specifies where to place the updated kernel and system map
 77 # images.  Uncomment if you want to place them anywhere other than root.
 78 
 79 #INSTALL_PATH=/boot
 80 
 81 #
 82 # If you want to preset the SVGA mode, uncomment the next line and
 83 # set SVGA_MODE to whatever number you want.
 84 # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
 85 # The number is the same as you would ordinarily press at bootup.
 86 #
 87 
 88 SVGA_MODE=      -DSVGA_MODE=NORMAL_VGA
 89 
 90 #
 91 # standard CFLAGS
 92 #
 93 
 94 CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strength-reduce
 95 
 96 ifdef CONFIG_CPP
 97 CFLAGS := $(CFLAGS) -x c++
 98 endif
 99 
100 ifdef SMP
101 CFLAGS += -D__SMP__
102 AFLAGS += -D__SMP__
103 
104 ifdef SMP_PROF
105 CFLAGS += -D__SMP_PROF__
106 AFLAGS += -D__SMP_PROF__
107 endif
108 endif
109 
110 #
111 # if you want the ram-disk device, define this to be the
112 # size in blocks.
113 #
114 
115 #RAMDISK = -DRAMDISK=512
116 
117 # Include the make variables (CC, etc...)
118 #
119 
120 ARCHIVES        =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o net/network.a
121 FILESYSTEMS     =fs/filesystems.a
122 DRIVERS         =drivers/block/block.a \
123                  drivers/char/char.a
124 LIBS            =$(TOPDIR)/lib/lib.a
125 SUBDIRS         =kernel drivers mm fs net ipc lib
126 
127 ifeq ($(CONFIG_ISDN),y)
128 DRIVERS := $(DRIVERS) drivers/isdn/isdn.a
129 endif
130 
131 DRIVERS := $(DRIVERS) drivers/net/net.a
132 
133 ifdef CONFIG_CD_NO_IDESCSI
134 DRIVERS := $(DRIVERS) drivers/cdrom/cdrom.a
135 endif
136 
137 ifeq ($(CONFIG_SCSI),y)
138 DRIVERS := $(DRIVERS) drivers/scsi/scsi.a
139 endif
140 
141 ifeq ($(CONFIG_SOUND),y)
142 DRIVERS := $(DRIVERS) drivers/sound/sound.a
143 endif
144 
145 ifdef CONFIG_PCI
146 DRIVERS := $(DRIVERS) drivers/pci/pci.a
147 endif
148 
149 ifdef CONFIG_SBUS
150 DRIVERS := $(DRIVERS) drivers/sbus/sbus.a
151 endif
152 
153 ifeq ($(CONFIG_PARIDE),y)
154 DRIVERS := $(DRIVERS) drivers/block/paride/paride.a
155 endif
156 
157 include arch/$(ARCH)/Makefile
158 
159 ifdef SMP
160 
161 .S.s:
162         $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -E -o $*.s $<
163 .S.o:
164         $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c -o $*.o $<
165 
166 else
167 
168 .S.s:
169         $(CC) -D__ASSEMBLY__ -traditional -E -o $*.s $<
170 .S.o:
171         $(CC) -D__ASSEMBLY__ -traditional -c -o $*.o $<
172 
173 endif
174 
175 Version: dummy
176         @rm -f include/linux/compile.h
177 
178 boot: vmlinux
179         @$(MAKE) -C arch/$(ARCH)/boot
180 
181 vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
182         $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
183                 $(ARCHIVES) \
184                 $(FILESYSTEMS) \
185                 $(DRIVERS) \
186                 $(LIBS) -o vmlinux
187         $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | sort > System.map
188 
189 symlinks:
190         rm -f include/asm
191         ( cd include ; ln -sf asm-$(ARCH) asm)
192         @if [ ! -d include/linux/modules ]; then \
193                 mkdir include/linux/modules; \
194         fi
195 
196 oldconfig: symlinks
197         $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
198 
199 xconfig: symlinks
200         $(MAKE) -C scripts kconfig.tk
201         wish -f scripts/kconfig.tk
202 
203 menuconfig: include/linux/version.h symlinks 
204         $(MAKE) -C scripts/lxdialog all
205         $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
206 
207 config: symlinks
208         $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
209 
210 linuxsubdirs: dummy
211         set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done
212 
213 $(TOPDIR)/include/linux/version.h: include/linux/version.h
214 $(TOPDIR)/include/linux/compile.h: include/linux/compile.h
215 
216 ksymoops: 
217         $(MAKE) -C scripts ksymoops
218 
219 newversion:
220         @if [ ! -f .version ]; then \
221                 echo 1 > .version; \
222         else \
223                 expr 0`cat .version` + 1 > .version; \
224         fi
225 
226 include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
227         @if [ -f .name ]; then \
228            echo \#define UTS_VERSION \"\#`cat .version`-`cat .name` `date`\"; \
229          else \
230            echo \#define UTS_VERSION \"\#`cat .version` `date`\";  \
231          fi >> .ver
232         @echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
233         @echo \#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
234         @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
235         @if [ -x /bin/dnsdomainname ]; then \
236            echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
237          elif [ -x /bin/domainname ]; then \
238            echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
239          else \
240            echo \#define LINUX_COMPILE_DOMAIN ; \
241          fi >> .ver
242         @echo \#define LINUX_COMPILER \"`$(CC) -v 2>&1 | tail -1`\" >> .ver
243         @mv -f .ver $@
244 
245 include/linux/version.h: ./Makefile
246         @echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver
247         @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
248         @echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
249         @mv -f .ver $@
250 
251 init/version.o: init/version.c include/linux/compile.h
252         $(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
253 
254 init/main.o: init/main.c
255         $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
256 
257 fs: dummy
258         $(MAKE) linuxsubdirs SUBDIRS=fs
259 
260 lib: dummy
261         $(MAKE) linuxsubdirs SUBDIRS=lib
262 
263 mm: dummy
264         $(MAKE) linuxsubdirs SUBDIRS=mm
265 
266 ipc: dummy
267         $(MAKE) linuxsubdirs SUBDIRS=ipc
268 
269 kernel: dummy
270         $(MAKE) linuxsubdirs SUBDIRS=kernel
271 
272 drivers: dummy
273         $(MAKE) linuxsubdirs SUBDIRS=drivers
274 
275 net: dummy
276         $(MAKE) linuxsubdirs SUBDIRS=net
277 
278 TAGS: dummy
279         etags `find include/asm-$(ARCH) -name '*.h'`
280         find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print | xargs etags -a
281         find $(SUBDIRS) init -name '*.c' | xargs etags -a
282 
283 # Exuberant ctags works better with -I
284 tags: dummy
285         CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
286         ctags $$CTAGSF `find include/asm-$(ARCH) -name '*.h'` && \
287         find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print | xargs ctags $$CTAGSF -a && \
288         find $(SUBDIRS) init -name '*.c' | xargs ctags $$CTAGSF -a
289 
290 MODFLAGS = -DMODULE
291 ifdef CONFIG_MODULES
292 ifdef CONFIG_MODVERSIONS
293 MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
294 endif
295 
296 modules: include/linux/version.h
297         @set -e; \
298         for i in $(SUBDIRS); \
299         do $(MAKE) -C $$i CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules; \
300         done
301 
302 modules_install:
303         @( \
304         MODLIB=/lib/modules/$(KERNELRELEASE); \
305         cd modules; \
306         MODULES=""; \
307         inst_mod() { These="`cat $$1`"; MODULES="$$MODULES $$These"; \
308                 mkdir -p $$MODLIB/$$2; cp -p $$These $$MODLIB/$$2; \
309                 echo Installing modules under $$MODLIB/$$2; \
310         }; \
311         \
312         if [ -f BLOCK_MODULES ]; then inst_mod BLOCK_MODULES block; fi; \
313         if [ -f NET_MODULES   ]; then inst_mod NET_MODULES   net;   fi; \
314         if [ -f IPV4_MODULES  ]; then inst_mod IPV4_MODULES  ipv4;  fi; \
315         if [ -f SCSI_MODULES  ]; then inst_mod SCSI_MODULES  scsi;  fi; \
316         if [ -f FS_MODULES    ]; then inst_mod FS_MODULES    fs;    fi; \
317         if [ -f CDROM_MODULES ]; then inst_mod CDROM_MODULES cdrom; fi; \
318         \
319         ls *.o > .allmods; \
320         echo $$MODULES | tr ' ' '\n' | sort | comm -23 .allmods - > .misc; \
321         if [ -s .misc ]; then inst_mod .misc misc; fi; \
322         rm -f .misc .allmods; \
323         )
324 
325 # modules disabled....
326 
327 else
328 modules modules_install: dummy
329         @echo
330         @echo "The present kernel configuration has modules disabled."
331         @echo "Type 'make config' and enable loadable module support."
332         @echo "Then build a kernel with module support enabled."
333         @echo
334         @exit 1
335 endif
336 
337 clean:  archclean
338         rm -f kernel/ksyms.lst include/linux/compile.h
339         rm -f core `find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print`
340         rm -f core `find . -type f -name 'core' -print`
341         rm -f vmlinux System.map
342         rm -f .tmp* drivers/sound/configure
343         rm -fr modules/*
344         rm -f submenu*
345 
346 mrproper: clean
347         rm -f include/linux/autoconf.h include/linux/version.h
348         rm -f drivers/sound/local.h drivers/sound/.defines
349         rm -f drivers/char/uni_hash.tbl drivers/char/conmakehash
350         rm -f drivers/net/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h
351         rm -f drivers/net/soundmodem/sm_tbl_{hapn4800,psk4800}.h
352         rm -f drivers/net/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h
353         rm -f drivers/net/soundmodem/gentbl
354         rm -f .version .config* config.in config.old
355         rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp
356         rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog
357         rm -f .menuconfig .menuconfig.log
358         rm -f include/asm
359         rm -f .depend `find . -name .depend -print`
360         rm -f .hdepend scripts/mkdep
361         rm -f $(TOPDIR)/include/linux/modversions.h
362         rm -f $(TOPDIR)/include/linux/modules/*
363 
364 
365 distclean: mrproper
366         rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
367                 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
368                 -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS tags
369 
370 backup: mrproper
371         cd .. && tar cf - linux/ | gzip -9 > backup.gz
372         sync
373 
374 sums:
375         find . -type f -print | sort | xargs sum > .SUMS
376 
377 dep-files: scripts/mkdep archdep include/linux/version.h
378         scripts/mkdep init/*.c > .tmpdepend
379         scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend
380         set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep; done
381         mv .tmpdepend .depend
382 
383 # Prepare source tree for RCS version control using Emacs VC;
384 # make all needed RCS directories and write-lock nearly everything.
385 vc:
386         chmod a-w COPYING CREDITS MAINTAINERS Makefile README Rules.make  
387         find . -type d ! -name "*RCS" -exec mkdir {}/RCS \;
388         find . -type f \( -name *.[chS] -o -name "*Makefile" -o -name "*README*" -o -name "*Config.in" -o -name "*.txt" \) -exec chmod a-w {} \;
389         find Documentation scripts -type f -exec chmod a-w {} \;
390 
391 MODVERFILE :=
392 
393 ifdef CONFIG_MODVERSIONS
394 MODVERFILE := $(TOPDIR)/include/linux/modversions.h
395 endif
396 
397 depend dep: dep-files $(MODVERFILE)
398 
399 checkconfig:
400         find * -name '*.[hcS]' -type f -print | sort | xargs $(PERL) -w scripts/checkconfig.pl
401 
402 checkhelp:
403         find * -name [cC]onfig.in -print | sort | xargs $(PERL) -w scripts/checkhelp.pl
404 
405 checkincludes:
406         find * -name '*.[hcS]' -type f -print | sort | xargs $(PERL) -w scripts/checkincludes.pl
407 
408 ifdef CONFIGURATION
409 ..$(CONFIGURATION):
410         @echo
411         @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
412         @echo
413         $(MAKE) $(CONFIGURATION)
414         @echo
415         @echo "Successful. Try re-making (ignore the error that follows)"
416         @echo
417         exit 1
418 
419 #dummy: ..$(CONFIGURATION)
420 dummy:
421 
422 else
423 
424 dummy:
425 
426 endif
427 
428 include Rules.make
429 
430 #
431 # This generates dependencies for the .h files.
432 #
433 
434 scripts/mkdep: scripts/mkdep.c
435         $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c

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