home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Alpha / Whiteline Alpha.iso / linux / atari / source / source.lzh / atari-linux-0.01pl3 / Makefile < prev    next >
Encoding:
Makefile  |  1994-06-09  |  6.6 KB  |  264 lines

  1. # Makefile for Amiga Linux main source directory
  2. #
  3. # Copyright 1993 by Hamish Macdonald
  4. #
  5. # This file is subject to the terms and conditions of the GNU General Public
  6. # License.  See the file "README.legal" in the main directory of this archive
  7. # for more details.
  8.  
  9. VERSION = 0.08
  10. PATCHLEVEL = 3
  11. ALPHA =
  12.  
  13. all:    Version vmlinux
  14.  
  15. .EXPORT_ALL_VARIABLES:
  16.  
  17. #CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
  18. #       else if [ -x /bin/bash ]; then echo /bin/bash; \
  19. #       else echo sh; fi ; fi)
  20. CONFIG_SHELL := sh
  21.  
  22. #
  23. # Make "config" the default target if there is no configuration file or
  24. # "depend" the target if there is no top-level dependency information.
  25. #
  26. ifeq (.config,$(wildcard .config))
  27. include .config
  28. ifeq (.depend,$(wildcard .depend))
  29. include .depend
  30. else
  31. CONFIGURATION = depend
  32. endif
  33. else
  34. CONFIGURATION = config
  35. endif
  36.  
  37. ifdef CONFIGURATION
  38. CONFIGURE = .config
  39. endif
  40.  
  41. #
  42. # ROOT_DEV specifies the default root-device when making the image.
  43. # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
  44. # the default of FLOPPY is used by 'build'.
  45. #
  46.  
  47. ROOT_DEV = CURRENT
  48.  
  49. # Special options.
  50. #OPTS    = -pro
  51.  
  52. # Include the make variables (CC, etc...)
  53. #
  54. include MakeVars
  55.  
  56.  
  57. ARCHIVES     =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o m68k/arch.o net/net.o
  58. FILESYSTEMS     =fs/filesystems.a
  59. DRIVERS      =drivers/block/block.a \
  60.           drivers/char/char.a
  61. #          drivers/net/net.a \
  62. #          ibcs/ibcs.o
  63. LIBS         =lib/lib.a
  64. SUBDIRS      =kernel drivers mm fs ipc m68k lib net
  65.  
  66. ifdef CONFIG_SCSI
  67. DRIVERS := $(DRIVERS) drivers/scsi/scsi.a
  68. endif
  69.  
  70. ifdef CONFIG_SOUND
  71. DRIVERS := $(DRIVERS) drivers/sound/sound.a
  72. endif
  73.  
  74. ifdef CONFIG_MATH_EMULATION
  75. DRIVERS := $(DRIVERS) drivers/FPU-emu/math.a
  76. endif
  77.  
  78. ifdef CONFIG_AMIGA
  79. BOOTOBJS := tools/amiga/bootstrap.o tools/amiga/get_nlist.o
  80. ARCHIVES := $(ARCHIVES) amiga/amiga.o
  81. SUBDIRS := $(SUBDIRS) amiga
  82. endif
  83.  
  84. ifdef CONFIG_ATARI
  85. ARCHIVES := $(ARCHIVES) atari/atari.o
  86. SUBDIRS := $(SUBDIRS) atari
  87. endif
  88.  
  89. ifdef CONFIG_MAC
  90. ARCHIVES := $(ARCHIVES) mac/mac.o
  91. SUBDIRS := $(SUBDIRS) mac
  92. endif
  93.  
  94. ifdef CONFIG_FPSP_040
  95. ARCHIVES := $(ARCHIVES) fpsp040/fpsp.o
  96. SUBDIRS := $(SUBDIRS) fpsp040
  97. endif
  98.  
  99. Version: dummy
  100.     $(RM) $(RMFLAGS) tools/version.h
  101.  
  102. config:
  103.     $(CONFIG_SHELL) Configure $(OPTS) < config.in
  104.     @if grep -s '^CONFIG_SOUND' .config~ ; then \
  105.         $(MAKE) -C drivers/sound config; \
  106.         else : ; fi
  107.     mv .config~ .config
  108.  
  109.  
  110. linuxsubdirs: dummy
  111.     set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done
  112.  
  113. bootstrap: $(BOOTOBJS)
  114.     $(HOSTCC) $(HOSTFLAGS) -o $@ $(BOOTOBJS)
  115.  
  116. tools/./version.h: tools/version.h
  117.  
  118. tools/version.h: $(CONFIGURE) Makefile
  119.     @/bin/sh makever.sh
  120.     @echo \#define UTS_RELEASE \"$(VERSION).$(PATCHLEVEL)$(ALPHA)\" > tools/version.h
  121.     @echo \#define UTS_VERSION \"\#`cat .version` `date +%D`\" >> tools/version.h
  122.     @echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> tools/version.h
  123.     @echo \#define LINUX_COMPILE_BY \"`whoami`\" >> tools/version.h
  124.     @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> tools/version.h
  125.     @echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\" >> tools/version.h
  126.  
  127. tools/version.o: tools/version.c tools/version.h
  128.  
  129. ifdef CONFIG_ATARI
  130.  
  131. # The "-fwritable-strings" is needed for a strange reason on the
  132. # Atari: The first 2 KByte of physical memory (0x0 .. 0x7ff) are made
  133. # supervisor-only by hardware. In most cases this doesn't matter,
  134. # because at this location is the kernel that runs in super mode.
  135. # But...: When executing the execve()s in init(), the argv and envp
  136. # fields are accessed from user space (with get_fs_byte()) to be
  137. # copied to the new process. And since main.o is linked as second
  138. # file, its code lies within the magic first 2 KByte. And here it
  139. # happens... a spurious bus error the memory manager can't handle. The
  140. # solution is to move the offending strings into the kernel data, far
  141. # behind 0x7ff. -fwritable-strings does exactly this.
  142.  
  143. init/main.o: $(CONFIGURE) init/main.c
  144.     $(CC) $(CFLAGS) $(PROFILING) -fwritable-strings -c -o $*.o $<
  145.  
  146. else
  147.  
  148. init/main.o: $(CONFIGURE) init/main.c
  149.     $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
  150.  
  151. endif
  152.  
  153. init/config.o: $(CONFIGURE) init/config.c
  154.     $(CC) $(CFLAGS) -c -o $*.o $<
  155.  
  156.  
  157. vmlinux: m68k/head.o init/config.o init/main.o tools/version.o linuxsubdirs 
  158.     $(LD) $(LDFLAGS) -T 0xC0000008 -M m68k/head.o init/main.o init/config.o \
  159.         tools/version.o \
  160.         $(ARCHIVES) \
  161.         $(FILESYSTEMS) \
  162.         $(DRIVERS) \
  163.         $(LIBS) \
  164.         -o vmlinux > System.map
  165.  
  166. # this target just creates an atari format executable of
  167. # the kernel so that you can run an amigados disassembler on it.
  168. vmlinux.atari : m68k/head.o init/main.o init/config.o tools/version.o linuxsubdirs
  169.     $(HOSTCC) -nostdlib m68k/head.o init/main.o init/config.o \
  170.         tools/version.o \
  171.         $(ARCHIVES) \
  172.         $(FILESYSTEMS) \
  173.         $(DRIVERS) \
  174.         $(LIBS) \
  175.         -o vmlinux.atari
  176.  
  177. # This target makes vmlinux and then transfers it from the PC to the Atari. This
  178. # is just for my personal cross-development environment.
  179. remote-vmlinux: all
  180.     rh_put -f -q /home/roman/src/linux.atari/vmlinux 'd:\linux\vmlinux'
  181.  
  182. m68k/head.o: m68k/head.S #m68k/assyms.h
  183.  
  184. m68k/assyms.h: dummy
  185.     make -C m68k assyms.h
  186.  
  187. $(BOOTOBJS): $(BOOTOBJS:.o=.c)
  188.     $(HOSTCC) $(HOSTFLAGS) -c $*.c -o $@
  189.  
  190. fs: dummy
  191.     $(MAKE) $(MFLAGS) linuxsubdirs SUBDIRS=fs
  192.  
  193. mm: dummy
  194.     $(MAKE) $(MFLAGS) linuxsubdirs SUBDIRS=mm
  195.  
  196. kernel: dummy
  197.     $(MAKE) $(MFLAGS) linuxsubdirs SUBDIRS=kernel
  198.  
  199. drivers: dummy
  200.     $(MAKE) linuxsubdirs SUBDIRS=drivers
  201.  
  202. net: dummy
  203.     $(MAKE) linuxsubdirs SUBDIRS=net
  204.  
  205. atari: dummy
  206.     $(MAKE) $(MFLAGS) linuxsubdirs SUBDIRS=atari
  207.  
  208. m68k: dummy
  209.     $(MAKE) $(MFLAGS) linuxsubdirs SUBDIRS=m68k
  210.  
  211. lib: dummy
  212.     $(MAKE) $(MFLAGS) linuxsubdirs SUBDIRS=lib
  213.  
  214.  
  215. clean:
  216.     $(RM) $(RMFLAGS) core `find . -name '*.[oa]' -print`
  217.     $(RM) $(RMFLAGS) core `find . -name 'core' -print`
  218.     $(RM) $(RMFLAGS) System.map
  219.     $(RM) $(RMFLAGS) drivers/sound/configure
  220.  
  221. clobber: clean
  222.     $(RM) $(RMFLAGS) vmlinux bootstrap m68k/gensyms
  223.     $(RM) $(RMFLAGS) drivers/sound/local.h
  224.  
  225. mrproper: clobber
  226.     $(RM) $(RMFLAGS) include/linux/autoconf.h tools/version.h
  227.     $(RM) $(RMFLAGS) .version .config* config.old
  228.     $(RM) $(RMFLAGS) .depend `find . -name '.depend' -print`
  229.  
  230. distclean: mrproper
  231.  
  232. backup: mrproper
  233.     cd .. && tar cf - linux | gzip -9 > backup.gz
  234.     sync
  235.  
  236. depend dep:
  237.     -touch tools/version.h
  238.     for i in init/*.c;do (echo -n init/;$(CPP) -M $(INCFLAGS) $$i); \
  239.         done > .depend~
  240.     for i in $(BOOTOBJS:.o=.c); do (echo -n tools/atari/;$(HOSTCC) \
  241.         $(HOSTINCFLAGS) -M $$i); done >> .depend~
  242.     set -e ; for i in $(SUBDIRS); do $(MAKE) $(MFLAGS) -C $$i dep; done
  243.     $(RM) $(RMFLAGS) tools/version.h
  244.     mv .depend~ .depend
  245.  
  246. ifdef CONFIGURATION
  247. ..$(CONFIGURATION):
  248.     @echo ""
  249.     @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
  250.     @echo ""
  251.     $(MAKE) $(MFLAGS) $(CONFIGURATION)
  252.     @echo ""
  253.     @echo "Successful. Try re-making (ignore the error that follows)"
  254.     @echo ""
  255.     exit 1
  256.  
  257. dummy: ..$(CONFIGURATION)
  258.  
  259. else
  260.  
  261. dummy:
  262.  
  263. endif
  264.