home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / KERNEL-S / V1.0 / LINUX-1.0 / LINUX-1 / linux / Makefile < prev    next >
Encoding:
Makefile  |  1994-03-13  |  6.7 KB  |  299 lines

  1. VERSION = 1
  2. PATCHLEVEL = 0
  3. ALPHA =
  4.  
  5. all:    Version zImage
  6.  
  7. .EXPORT_ALL_VARIABLES:
  8.  
  9. CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
  10.       else if [ -x /bin/bash ]; then echo /bin/bash; \
  11.       else echo sh; fi ; fi)
  12.  
  13. #
  14. # Make "config" the default target if there is no configuration file or
  15. # "depend" the target if there is no top-level dependency information.
  16. #
  17. ifeq (.config,$(wildcard .config))
  18. include .config
  19. ifeq (.depend,$(wildcard .depend))
  20. include .depend
  21. else
  22. CONFIGURATION = depend
  23. endif
  24. else
  25. CONFIGURATION = config
  26. endif
  27.  
  28. ifdef CONFIGURATION
  29. CONFIGURE = dummy
  30. endif
  31.  
  32. #
  33. # ROOT_DEV specifies the default root-device when making the image.
  34. # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
  35. # the default of FLOPPY is used by 'build'.
  36. #
  37.  
  38. ROOT_DEV = CURRENT
  39.  
  40. #
  41. # If you want to preset the SVGA mode, uncomment the next line and
  42. # set SVGA_MODE to whatever number you want.
  43. # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
  44. # The number is the same as you would ordinarily press at bootup.
  45. #
  46.  
  47. SVGA_MODE=    -DSVGA_MODE=NORMAL_VGA
  48.  
  49. #
  50. # standard CFLAGS
  51. #
  52.  
  53. CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe
  54.  
  55. ifdef CONFIG_CPP
  56. CFLAGS := $(CFLAGS) -x c++
  57. endif
  58.  
  59. ifdef CONFIG_M486
  60. CFLAGS := $(CFLAGS) -m486
  61. else
  62. CFLAGS := $(CFLAGS) -m386
  63. endif
  64.  
  65. #
  66. # if you want the ram-disk device, define this to be the
  67. # size in blocks.
  68. #
  69.  
  70. #RAMDISK = -DRAMDISK=512
  71.  
  72. AS86    =as86 -0 -a
  73. LD86    =ld86 -0
  74.  
  75. AS    =as
  76. LD    =ld
  77. HOSTCC    =gcc
  78. CC    =gcc -D__KERNEL__
  79. MAKE    =make
  80. CPP    =$(CC) -E
  81. AR    =ar
  82. STRIP    =strip
  83.  
  84. ARCHIVES    =kernel/kernel.o mm/mm.o fs/fs.o net/net.o ipc/ipc.o
  85. FILESYSTEMS    =fs/filesystems.a
  86. DRIVERS        =drivers/block/block.a \
  87.          drivers/char/char.a \
  88.          drivers/net/net.a \
  89.          ibcs/ibcs.o
  90. LIBS        =lib/lib.a
  91. SUBDIRS        =kernel drivers mm fs net ipc ibcs lib
  92.  
  93. KERNELHDRS    =/usr/src/linux/include
  94.  
  95. ifdef CONFIG_SCSI
  96. DRIVERS := $(DRIVERS) drivers/scsi/scsi.a
  97. endif
  98.  
  99. ifdef CONFIG_SOUND
  100. DRIVERS := $(DRIVERS) drivers/sound/sound.a
  101. endif
  102.  
  103. ifdef CONFIG_MATH_EMULATION
  104. DRIVERS := $(DRIVERS) drivers/FPU-emu/math.a
  105. endif
  106.  
  107. .c.s:
  108.     $(CC) $(CFLAGS) -S -o $*.s $<
  109. .s.o:
  110.     $(AS) -c -o $*.o $<
  111. .c.o:
  112.     $(CC) $(CFLAGS) -c -o $*.o $<
  113.  
  114. Version: dummy
  115.     rm -f tools/version.h
  116.  
  117. config:
  118.     $(CONFIG_SHELL) Configure $(OPTS) < config.in
  119.     @if grep -s '^CONFIG_SOUND' .tmpconfig ; then \
  120.         $(MAKE) -C drivers/sound config; \
  121.         else : ; fi
  122.     mv .tmpconfig .config
  123.  
  124. linuxsubdirs: dummy
  125.     set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done
  126.  
  127. tools/./version.h: tools/version.h
  128.  
  129. tools/version.h: $(CONFIGURE) Makefile
  130.     @./makever.sh
  131.     @echo \#define UTS_RELEASE \"$(VERSION).$(PATCHLEVEL)$(ALPHA)\" > tools/version.h
  132.     @echo \#define UTS_VERSION \"\#`cat .version` `date`\" >> tools/version.h
  133.     @echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> tools/version.h
  134.     @echo \#define LINUX_COMPILE_BY \"`whoami`\" >> tools/version.h
  135.     @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> tools/version.h
  136.     @echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\" >> tools/version.h
  137.  
  138. tools/build: tools/build.c $(CONFIGURE)
  139.     $(HOSTCC) $(CFLAGS) -o $@ $<
  140.  
  141. boot/head.o: $(CONFIGURE) boot/head.s
  142.  
  143. boot/head.s: boot/head.S $(CONFIGURE) include/linux/tasks.h
  144.     $(CPP) -traditional $< -o $@
  145.  
  146. tools/version.o: tools/version.c tools/version.h
  147.  
  148. init/main.o: $(CONFIGURE) init/main.c
  149.     $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
  150.  
  151. tools/system:    boot/head.o init/main.o tools/version.o linuxsubdirs
  152.     $(LD) $(LDFLAGS) -Ttext 1000 boot/head.o init/main.o tools/version.o \
  153.         $(ARCHIVES) \
  154.         $(FILESYSTEMS) \
  155.         $(DRIVERS) \
  156.         $(LIBS) \
  157.         -o tools/system
  158.     nm tools/zSystem | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | \
  159.         sort > System.map
  160.  
  161. boot/setup: boot/setup.o
  162.     $(LD86) -s -o $@ $<
  163.  
  164. boot/setup.o: boot/setup.s
  165.     $(AS86) -o $@ $<
  166.  
  167. boot/setup.s: boot/setup.S $(CONFIGURE) include/linux/config.h Makefile
  168.     $(CPP) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@
  169.  
  170. boot/bootsect: boot/bootsect.o
  171.     $(LD86) -s -o $@ $<
  172.  
  173. boot/bootsect.o: boot/bootsect.s
  174.     $(AS86) -o $@ $<
  175.  
  176. boot/bootsect.s: boot/bootsect.S $(CONFIGURE) include/linux/config.h Makefile
  177.     $(CPP) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@
  178.  
  179. zBoot/zSystem: zBoot/*.c zBoot/*.S tools/zSystem
  180.     $(MAKE) -C zBoot
  181.  
  182. zImage: $(CONFIGURE) boot/bootsect boot/setup zBoot/zSystem tools/build
  183.     tools/build boot/bootsect boot/setup zBoot/zSystem $(ROOT_DEV) > zImage
  184.     sync
  185.  
  186. zdisk: zImage
  187.     dd bs=8192 if=zImage of=/dev/fd0
  188.  
  189. zlilo: $(CONFIGURE) zImage
  190.     if [ -f /vmlinuz ]; then mv /vmlinuz /vmlinuz.old; fi
  191.     if [ -f /zSystem.map ]; then mv /zSystem.map /zSystem.old; fi
  192.     cat zImage > /vmlinuz
  193.     cp zSystem.map /
  194.     if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
  195.  
  196. tools/zSystem:    boot/head.o init/main.o tools/version.o linuxsubdirs
  197.     $(LD) $(LDFLAGS) -Ttext 100000 boot/head.o init/main.o tools/version.o \
  198.         $(ARCHIVES) \
  199.         $(FILESYSTEMS) \
  200.         $(DRIVERS) \
  201.         $(LIBS) \
  202.         -o tools/zSystem
  203.     nm tools/zSystem | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | \
  204.         sort > zSystem.map
  205.  
  206. fs: dummy
  207.     $(MAKE) linuxsubdirs SUBDIRS=fs
  208.  
  209. lib: dummy
  210.     $(MAKE) linuxsubdirs SUBDIRS=lib
  211.  
  212. mm: dummy
  213.     $(MAKE) linuxsubdirs SUBDIRS=mm
  214.  
  215. ipc: dummy
  216.     $(MAKE) linuxsubdirs SUBDIRS=ipc
  217.  
  218. kernel: dummy
  219.     $(MAKE) linuxsubdirs SUBDIRS=kernel
  220.  
  221. drivers: dummy
  222.     $(MAKE) linuxsubdirs SUBDIRS=drivers
  223.  
  224. net: dummy
  225.     $(MAKE) linuxsubdirs SUBDIRS=net
  226.  
  227. clean:
  228.     rm -f kernel/ksyms.lst
  229.     rm -f core `find . -name '*.[oas]' -print`
  230.     rm -f core `find . -name 'core' -print`
  231.     rm -f zImage zSystem.map tools/zSystem tools/system
  232.     rm -f Image System.map boot/bootsect boot/setup
  233.     rm -f zBoot/zSystem zBoot/xtract zBoot/piggyback
  234.     rm -f .tmp* drivers/sound/configure
  235.     rm -f init/*.o tools/build boot/*.o tools/*.o
  236.  
  237. mrproper: clean
  238.     rm -f include/linux/autoconf.h tools/version.h
  239.     rm -f drivers/sound/local.h
  240.     rm -f .version .config* config.old
  241.     rm -f .depend `find . -name .depend -print`
  242.  
  243. distclean: mrproper
  244.  
  245. backup: mrproper
  246.     cd .. && tar cf - linux | gzip -9 > backup.gz
  247.     sync
  248.  
  249. depend dep:
  250.     touch tools/version.h
  251.     for i in init/*.c;do echo -n "init/";$(CPP) -M $$i;done > .tmpdepend
  252.     for i in tools/*.c;do echo -n "tools/";$(CPP) -M $$i;done >> .tmpdepend
  253.     set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i dep; done
  254.     rm -f tools/version.h
  255.     mv .tmpdepend .depend
  256.  
  257. ifdef CONFIGURATION
  258. ..$(CONFIGURATION):
  259.     @echo
  260.     @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
  261.     @echo
  262.     $(MAKE) $(CONFIGURATION)
  263.     @echo
  264.     @echo "Successful. Try re-making (ignore the error that follows)"
  265.     @echo
  266.     exit 1
  267.  
  268. dummy: ..$(CONFIGURATION)
  269.  
  270. else
  271.  
  272. dummy:
  273.  
  274. endif
  275.  
  276. #
  277. # Leave these dummy entries for now to tell people that they are going away..
  278. #
  279. lilo:
  280.     @echo
  281.     @echo Uncompressed kernel images no longer supported. Use
  282.     @echo \"make zlilo\" instead.
  283.     @echo
  284.     @exit 1
  285.  
  286. Image:
  287.     @echo
  288.     @echo Uncompressed kernel images no longer supported. Use
  289.     @echo \"make zImage\" instead.
  290.     @echo
  291.     @exit 1
  292.  
  293. disk:
  294.     @echo
  295.     @echo Uncompressed kernel images no longer supported. Use
  296.     @echo \"make zdisk\" instead.
  297.     @echo
  298.     @exit 1
  299.