linux-old/Makefile
<<
>>
Prefs
   1VERSION = 2
   2PATCHLEVEL = 0
   3SUBLEVEL = 30
   4
   5ARCH = i386
   6
   7#
   8# For SMP kernels, set this. We don't want to have this in the config file
   9# because it makes re-config very ugly and too many fundamental files depend
  10# on "CONFIG_SMP"
  11#
  12# NOTE! SMP is experimental. See the file Documentation/SMP.txt
  13#
  14# SMP = 1
  15#
  16# SMP profiling options
  17# SMP_PROF = 1
  18
  19.EXPORT_ALL_VARIABLES:
  20
  21CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
  22          else if [ -x /bin/bash ]; then echo /bin/bash; \
  23          else echo sh; fi ; fi)
  24TOPDIR  := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
  25
  26HPATH           = $(TOPDIR)/include
  27FINDHPATH       = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net
  28
  29HOSTCC          =gcc -I$(HPATH)
  30HOSTCFLAGS      =-O2 -fomit-frame-pointer
  31
  32CROSS_COMPILE   =
  33
  34AS      =$(CROSS_COMPILE)as
  35LD      =$(CROSS_COMPILE)ld
  36CC      =$(CROSS_COMPILE)gcc -D__KERNEL__ -I$(HPATH)
  37CPP     =$(CC) -E
  38AR      =$(CROSS_COMPILE)ar
  39NM      =$(CROSS_COMPILE)nm
  40STRIP   =$(CROSS_COMPILE)strip
  41MAKE    =make
  42
  43all:    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#
  49ifeq (.config,$(wildcard .config))
  50include .config
  51ifeq (.depend,$(wildcard .depend))
  52include .depend
  53do-it-all:      Version vmlinux
  54else
  55CONFIGURATION = depend
  56do-it-all:      depend
  57endif
  58else
  59CONFIGURATION = config
  60do-it-all:      config
  61endif
  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
  69ROOT_DEV = CURRENT
  70
  71#
  72# INSTALL_PATH specifies where to place the updated kernel and system map
  73# images.  Uncomment if you want to place them anywhere other than root.
  74
  75#INSTALL_PATH=/boot
  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 -fno-strength-reduce
  91
  92ifdef CONFIG_CPP
  93CFLAGS := $(CFLAGS) -x c++
  94endif
  95
  96ifdef SMP
  97CFLAGS += -D__SMP__
  98AFLAGS += -D__SMP__
  99
 100ifdef SMP_PROF
 101CFLAGS += -D__SMP_PROF__
 102AFLAGS += -D__SMP_PROF__
 103endif
 104endif
 105
 106#
 107# if you want the ram-disk device, define this to be the
 108# size in blocks.
 109#
 110
 111#RAMDISK = -DRAMDISK=512
 112
 113# Include the make variables (CC, etc...)
 114#
 115
 116ARCHIVES        =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o net/network.a
 117FILESYSTEMS     =fs/filesystems.a
 118DRIVERS         =drivers/block/block.a \
 119                 drivers/char/char.a
 120LIBS            =$(TOPDIR)/lib/lib.a
 121SUBDIRS         =kernel drivers mm fs net ipc lib
 122
 123ifeq ($(CONFIG_ISDN),y)
 124DRIVERS := $(DRIVERS) drivers/isdn/isdn.a
 125endif
 126
 127DRIVERS := $(DRIVERS) drivers/net/net.a
 128
 129ifdef CONFIG_CD_NO_IDESCSI
 130DRIVERS := $(DRIVERS) drivers/cdrom/cdrom.a
 131endif
 132
 133ifeq ($(CONFIG_SCSI),y)
 134DRIVERS := $(DRIVERS) drivers/scsi/scsi.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_SBUS
 146DRIVERS := $(DRIVERS) drivers/sbus/sbus.a
 147endif
 148
 149include arch/$(ARCH)/Makefile
 150
 151ifdef SMP
 152
 153.S.s:
 154        $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -E -o $*.s $<
 155.S.o:
 156        $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c -o $*.o $<
 157
 158else
 159
 160.S.s:
 161        $(CC) -D__ASSEMBLY__ -traditional -E -o $*.s $<
 162.S.o:
 163        $(CC) -D__ASSEMBLY__ -traditional -c -o $*.o $<
 164
 165endif
 166
 167Version: dummy
 168        @rm -f include/linux/compile.h
 169
 170boot: vmlinux
 171        @$(MAKE) -C arch/$(ARCH)/boot
 172
 173vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
 174        $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
 175                $(ARCHIVES) \
 176                $(FILESYSTEMS) \
 177                $(DRIVERS) \
 178                $(LIBS) -o vmlinux
 179        $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | sort > System.map
 180
 181symlinks:
 182        rm -f include/asm
 183        ( cd include ; ln -sf asm-$(ARCH) asm)
 184
 185oldconfig: symlinks
 186        $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
 187
 188xconfig: symlinks
 189        $(MAKE) -C scripts kconfig.tk
 190        wish -f scripts/kconfig.tk
 191
 192menuconfig: include/linux/version.h symlinks 
 193        $(MAKE) -C scripts/lxdialog all
 194        $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
 195
 196config: symlinks
 197        $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
 198
 199linuxsubdirs: dummy
 200        set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done
 201
 202$(TOPDIR)/include/linux/version.h: include/linux/version.h
 203$(TOPDIR)/include/linux/compile.h: include/linux/compile.h
 204
 205newversion:
 206        @if [ ! -f .version ]; then \
 207                echo 1 > .version; \
 208        else \
 209                expr 0`cat .version` + 1 > .version; \
 210        fi
 211
 212include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
 213        @if [ -f .name ]; then \
 214           echo \#define UTS_VERSION \"\#`cat .version`-`cat .name` `date`\"; \
 215         else \
 216           echo \#define UTS_VERSION \"\#`cat .version` `date`\";  \
 217         fi >> .ver
 218        @echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
 219        @echo \#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
 220        @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
 221        @if [ -x /bin/dnsdomainname ]; then \
 222           echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
 223         elif [ -x /bin/domainname ]; then \
 224           echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
 225         else \
 226           echo \#define LINUX_COMPILE_DOMAIN ; \
 227         fi >> .ver
 228        @echo \#define LINUX_COMPILER \"`$(CC) -v 2>&1 | tail -1`\" >> .ver
 229        @mv -f .ver $@
 230
 231include/linux/version.h: ./Makefile
 232        @echo \#define UTS_RELEASE \"$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)\" > .ver
 233        @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
 234        @mv -f .ver $@
 235
 236init/version.o: init/version.c include/linux/compile.h
 237        $(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
 238
 239init/main.o: init/main.c
 240        $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
 241
 242fs: dummy
 243        $(MAKE) linuxsubdirs SUBDIRS=fs
 244
 245lib: dummy
 246        $(MAKE) linuxsubdirs SUBDIRS=lib
 247
 248mm: dummy
 249        $(MAKE) linuxsubdirs SUBDIRS=mm
 250
 251ipc: dummy
 252        $(MAKE) linuxsubdirs SUBDIRS=ipc
 253
 254kernel: dummy
 255        $(MAKE) linuxsubdirs SUBDIRS=kernel
 256
 257drivers: dummy
 258        $(MAKE) linuxsubdirs SUBDIRS=drivers
 259
 260net: dummy
 261        $(MAKE) linuxsubdirs SUBDIRS=net
 262
 263MODFLAGS = -DMODULE
 264ifdef CONFIG_MODULES
 265ifdef CONFIG_MODVERSIONS
 266MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
 267endif
 268
 269modules: include/linux/version.h
 270        @set -e; \
 271        for i in $(SUBDIRS); \
 272        do $(MAKE) -C $$i CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules; \
 273        done
 274
 275modules_install:
 276        @( \
 277        MODLIB=/lib/modules/$(VERSION).$(PATCHLEVEL).$(SUBLEVEL); \
 278        cd modules; \
 279        MODULES=""; \
 280        inst_mod() { These="`cat $$1`"; MODULES="$$MODULES $$These"; \
 281                mkdir -p $$MODLIB/$$2; cp -p $$These $$MODLIB/$$2; \
 282                echo Installing modules under $$MODLIB/$$2; \
 283        }; \
 284        \
 285        if [ -f BLOCK_MODULES ]; then inst_mod BLOCK_MODULES block; fi; \
 286        if [ -f NET_MODULES   ]; then inst_mod NET_MODULES   net;   fi; \
 287        if [ -f IPV4_MODULES  ]; then inst_mod IPV4_MODULES  ipv4;  fi; \
 288        if [ -f SCSI_MODULES  ]; then inst_mod SCSI_MODULES  scsi;  fi; \
 289        if [ -f FS_MODULES    ]; then inst_mod FS_MODULES    fs;    fi; \
 290        if [ -f CDROM_MODULES ]; then inst_mod CDROM_MODULES cdrom; fi; \
 291        \
 292        ls *.o > .allmods; \
 293        echo $$MODULES | tr ' ' '\n' | sort | comm -23 .allmods - > .misc; \
 294        if [ -s .misc ]; then inst_mod .misc misc; fi; \
 295        rm -f .misc .allmods; \
 296        )
 297
 298# modules disabled....
 299
 300else
 301modules modules_install: dummy
 302        @echo
 303        @echo "The present kernel configuration has modules disabled."
 304        @echo "Type 'make config' and enable loadable module support."
 305        @echo "Then build a kernel with module support enabled."
 306        @echo
 307        @exit 1
 308endif
 309
 310clean:  archclean
 311        rm -f kernel/ksyms.lst include/linux/compile.h
 312        rm -f core `find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print`
 313        rm -f core `find . -type f -name 'core' -print`
 314        rm -f vmlinux System.map
 315        rm -f .tmp* drivers/sound/configure
 316        rm -fr modules/*
 317        rm -f submenu*
 318
 319mrproper: clean
 320        rm -f include/linux/autoconf.h include/linux/version.h
 321        rm -f drivers/sound/local.h drivers/sound/.defines
 322        rm -f drivers/scsi/aic7xxx_asm drivers/scsi/aic7xxx_seq.h
 323        rm -f drivers/char/uni_hash.tbl drivers/char/conmakehash
 324        rm -f .version .config* config.in config.old
 325        rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp
 326        rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog
 327        rm -f .menuconfig .menuconfig.log
 328        rm -f include/asm
 329        rm -f .depend `find . -name .depend -print`
 330        rm -f .hdepend scripts/mkdep
 331        rm -f $(TOPDIR)/include/linux/modversions.h
 332        rm -f $(TOPDIR)/include/linux/modules/*
 333
 334
 335distclean: mrproper
 336        rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
 337                -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
 338                -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS
 339
 340backup: mrproper
 341        cd .. && tar cf - linux/ | gzip -9 > backup.gz
 342        sync
 343
 344sums:
 345        find . -type f -print | sort | xargs sum > .SUMS
 346
 347dep-files: scripts/mkdep archdep include/linux/version.h
 348        scripts/mkdep init/*.c > .tmpdepend
 349        scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend
 350        set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep; done
 351        mv .tmpdepend .depend
 352
 353MODVERFILE :=
 354
 355ifdef CONFIG_MODVERSIONS
 356MODVERFILE := $(TOPDIR)/include/linux/modversions.h
 357endif
 358
 359depend dep: dep-files $(MODVERFILE)
 360
 361ifdef CONFIGURATION
 362..$(CONFIGURATION):
 363        @echo
 364        @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
 365        @echo
 366        $(MAKE) $(CONFIGURATION)
 367        @echo
 368        @echo "Successful. Try re-making (ignore the error that follows)"
 369        @echo
 370        exit 1
 371
 372#dummy: ..$(CONFIGURATION)
 373dummy:
 374
 375else
 376
 377dummy:
 378
 379endif
 380
 381include Rules.make
 382
 383#
 384# This generates dependencies for the .h files.
 385#
 386
 387scripts/mkdep: scripts/mkdep.c
 388        $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
 389
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.