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