PageRenderTime 49ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/archive/2.2/Makefile

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