Makefile 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. #
  2. # aboot/Makefile
  3. #
  4. # This file is subject to the terms and conditions of the GNU General Public
  5. # License. See the file "COPYING" in the main directory of this archive
  6. # for more details.
  7. #
  8. # Copyright (c) 1995, 1996 by David Mosberger (davidm@cs.arizona.edu)
  9. #
  10. # location of linux kernel sources (must be absolute path):
  11. KSRC = /usr/src/linux
  12. VMLINUX = $(KSRC)/vmlinux
  13. VMLINUXGZ = $(KSRC)/arch/alpha/boot/vmlinux.gz
  14. # for userspace testing
  15. #TESTING = yes
  16. # for boot testing
  17. #CFGDEFS = -DDEBUG_ISO -DDEBUG_ROCK -DDEBUG_EXT2 -DDEBUG
  18. bindir = $(DESTDIR)/sbin
  19. bootdir = $(DESTDIR)/boot
  20. export
  21. #
  22. # There shouldn't be any need to change anything below this line.
  23. #
  24. TOP = $(shell pwd)
  25. LOADADDR = 20000000
  26. ifndef $($(CC))
  27. CC ?= gcc
  28. endif
  29. ifeq ($(TESTING),)
  30. override CPPFLAGS += $(CFGDEFS) -I$(TOP)/include
  31. override CFLAGS += $(CPPFLAGS) -D__KERNEL__ -mcpu=ev4 -Os -Wall -fno-builtin -Wcast-align -mno-fp-regs -ffixed-8 -fno-builtin-printf
  32. else
  33. override CPPFLAGS += -DTESTING $(CFGDEFS) -I$(TOP)/include
  34. override CFLAGS += $(CPPFLAGS) -O -g3 -Wall -D__KERNEL__ -ffixed-8
  35. endif
  36. ABOOT_LDFLAGS = -static -N -Taboot.lds
  37. override ASFLAGS += $(CPPFLAGS)
  38. .c.s:
  39. $(CC) $(CFLAGS) -S -o $*.s $<
  40. .s.o:
  41. $(AS) -o $*.o $<
  42. .c.o:
  43. $(CC) $(CFLAGS) -c -o $*.o $<
  44. .S.s:
  45. $(CC) $(ASFLAGS) -D__ASSEMBLY__ -traditional -E -o $*.o $<
  46. .S.o:
  47. $(CC) $(ASFLAGS) -D__ASSEMBLY__ -traditional -c -o $*.o $<
  48. NET_OBJS = net.o
  49. DISK_OBJS = disk.o fs/ext2.o fs/ufs.o fs/dummy.o fs/iso.o
  50. ifeq ($(TESTING),)
  51. ABOOT_OBJS = \
  52. head.o aboot.o cons.o utils.o \
  53. zip/misc.o zip/unzip.o zip/inflate.o
  54. else
  55. ABOOT_OBJS = aboot.o zip/misc.o zip/unzip.o zip/inflate.o
  56. endif
  57. LIBS = lib/libaboot.a
  58. all: diskboot net_aboot.nh
  59. diskboot: bootlx sdisklabel/sdisklabel sdisklabel/swriteboot \
  60. tools/e2writeboot tools/abootconf \
  61. tools/elfencap
  62. netboot: vmlinux.bootp
  63. bootloader.h: net_aboot.nh b2c
  64. ./b2c net_aboot.nh bootloader.h bootloader
  65. netabootwrap: netabootwrap.c bootloader.h
  66. $(CC) $@.c $(CFLAGS) -o $@
  67. bootlx: aboot tools/objstrip
  68. tools/objstrip -vb aboot bootlx
  69. install-man:
  70. make -C doc/man install
  71. install-man-gz:
  72. make -C doc/man install-gz
  73. install: tools/abootconf tools/e2writeboot \
  74. sdisklabel/swriteboot
  75. install -d $(bindir) $(bootdir)
  76. install -c tools/abootconf $(bindir)
  77. install -c tools/e2writeboot $(bindir)
  78. install -c sdisklabel/swriteboot $(bindir)
  79. install -c bootlx $(bootdir)
  80. installondisk: bootlx sdisklabel/swriteboot
  81. sdisklabel/swriteboot -vf0 /dev/sda bootlx vmlinux.gz
  82. ifeq ($(TESTING),)
  83. aboot: $(ABOOT_OBJS) $(DISK_OBJS) $(LIBS)
  84. $(LD) $(ABOOT_LDFLAGS) $(ABOOT_OBJS) $(DISK_OBJS) -o $@ $(LIBS)
  85. else
  86. aboot: $(ABOOT_OBJS) $(DISK_OBJS) $(LIBS)
  87. $(CC) $(ABOOT_OBJS) $(DISK_OBJS) -o $@ $(LIBS)
  88. endif
  89. vmlinux.bootp: net_aboot.nh $(VMLINUXGZ) net_pad
  90. cat net_aboot.nh $(VMLINUXGZ) net_pad > $@
  91. net_aboot.nh: net_aboot tools/objstrip
  92. $(CROSS)strip net_aboot
  93. tools/objstrip -vb net_aboot $@
  94. net_aboot: $(ABOOT_OBJS) $(ABOOT_OBJS) $(NET_OBJS) $(LIBS)
  95. $(LD) $(ABOOT_LDFLAGS) $(ABOOT_OBJS) $(NET_OBJS) -o $@ $(LIBS)
  96. net_pad:
  97. dd if=/dev/zero of=$@ bs=512 count=1
  98. clean: sdisklabel/clean tools/clean lib/clean
  99. rm -f aboot abootconf net_aboot net_aboot.nh net_pad vmlinux.bootp \
  100. $(ABOOT_OBJS) $(DISK_OBJS) $(NET_OBJS) bootlx \
  101. include/ksize.h vmlinux.nh b2c bootloader.h netabootwrap
  102. distclean: clean
  103. find . -name \*~ | xargs rm -f
  104. lib/%:
  105. make -C lib $* CPPFLAGS="$(CPPFLAGS)" TESTING="$(TESTING)"
  106. tools/%:
  107. make -C tools $* CPPFLAGS="$(CPPFLAGS)"
  108. sdisklabel/%:
  109. make -C sdisklabel $* CPPFLAGS="$(CPPFLAGS)"
  110. vmlinux.nh: $(VMLINUX) tools/objstrip
  111. tools/objstrip -vb $(VMLINUX) vmlinux.nh
  112. include/ksize.h: vmlinux.nh
  113. echo "#define KERNEL_SIZE `ls -l vmlinux.nh | awk '{print $$5}'` > $@
  114. dep: