1# For test target. 2TESTS = size_test 3noinst_SCRIPTS = $(TESTS) 4 5# For dist target. 6noinst_HEADERS = apic.h defs.h dir.h disk_inode.h disk_inode_ffs.h \ 7 fat.h filesys.h freebsd.h fs.h hercules.h i386-elf.h \ 8 imgact_aout.h iso9660.h jfs.h mb_header.h mb_info.h md5.h \ 9 nbi.h pc_slice.h serial.h shared.h smp-imps.h term.h \ 10 terminfo.h tparm.h nbi.h ufs2.h vstafs.h xfs.h 11EXTRA_DIST = setjmp.S apm.S $(noinst_SCRIPTS) 12 13# For <stage1.h>. 14INCLUDES = -I$(top_srcdir)/stage1 15 16# The library for /sbin/grub. 17noinst_LIBRARIES = libgrub.a 18libgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \ 19 disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_iso9660.c \ 20 fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_ufs2.c \ 21 fsys_vstafs.c fsys_xfs.c gunzip.c md5.c serial.c stage2.c \ 22 terminfo.c tparm.c 23libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \ 24 -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \ 25 -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \ 26 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \ 27 -DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1 28 29# Stage 2 and Stage 1.5's. 30pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) 31 32EXTRA_PROGRAMS = nbloader.exec pxeloader.exec diskless.exec 33 34if DISKLESS_SUPPORT 35pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \ 36 ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \ 37 reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5 \ 38 nbgrub pxegrub 39noinst_DATA = pre_stage2 start start_eltorito nbloader pxeloader diskless 40noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \ 41 e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \ 42 iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \ 43 reiserfs_stage1_5.exec ufs2_stage1_5.exec vstafs_stage1_5.exec \ 44 xfs_stage1_5.exec nbloader.exec pxeloader.exec diskless.exec 45else 46pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \ 47 ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \ 48 reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5 49noinst_DATA = pre_stage2 start start_eltorito 50noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \ 51 e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \ 52 iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \ 53 reiserfs_stage1_5.exec ufs2_stage1_5.exec vstafs_stage1_5.exec \ 54 xfs_stage1_5.exec 55endif 56MOSTLYCLEANFILES = $(noinst_PROGRAMS) 57 58PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200 59START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000 60NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0 61PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 62START_ELTORITO_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 63 64if NETBOOT_SUPPORT 65NETBOOT_FLAGS = -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1 66else 67NETBOOT_FLAGS = 68endif 69 70if SERIAL_SUPPORT 71SERIAL_FLAGS = -DSUPPORT_SERIAL=1 72else 73SERIAL_FLAGS = 74endif 75 76if HERCULES_SUPPORT 77HERCULES_FLAGS = -DSUPPORT_HERCULES=1 78else 79HERCULES_FLAGS = 80endif 81 82STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ 83 $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS) 84 85STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 86STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 87 88# For stage2 target. 89pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c char_io.c \ 90 cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \ 91 fsys_fat.c fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \ 92 fsys_reiserfs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c gunzip.c \ 93 hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c tparm.c 94pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) 95pre_stage2_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) 96pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK) 97 98if NETBOOT_SUPPORT 99pre_stage2_exec_LDADD = ../netboot/libdrivers.a 100endif 101 102if DISKLESS_SUPPORT 103BUILT_SOURCES = stage2_size.h diskless_size.h 104else 105BUILT_SOURCES = stage2_size.h 106endif 107 108CLEANFILES = $(pkglib_DATA) $(noinst_DATA) $(BUILT_SOURCES) 109 110stage2_size.h: pre_stage2 111 -rm -f stage2_size.h 112 set dummy `ls -l pre_stage2`; \ 113 echo "#define STAGE2_SIZE $$6" > stage2_size.h 114 115start_exec_SOURCES = start.S 116start_exec_CCASFLAGS = $(STAGE2_COMPILE) 117start_exec_LDFLAGS = $(START_LINK) 118 119# XXX: automake doesn't provide a way to specify dependencies for object 120# files explicitly, so we must write this by a general Makefile scheme. 121# If automake change the naming scheme for per-executable objects, this 122# will be broken. 123start_exec-start.$(OBJEXT): stage2_size.h 124 125stage2: pre_stage2 start 126 -rm -f stage2 127 cat start pre_stage2 > stage2 128 129start_eltorito_exec_SOURCES = start_eltorito.S 130start_eltorito_exec_CCASFLAGS = $(STAGE2_COMPILE) 131start_eltorito_exec_LDFLAGS = $(START_ELTORITO_LINK) 132 133start_eltorito_exec-start.$(OBJEXT): stage2_size.h 134 135stage2_eltorito: pre_stage2 start_eltorito 136 -rm -f stage2_eltorito 137 cat start_eltorito pre_stage2 > stage2_eltorito 138 139# For e2fs_stage1_5 target. 140e2fs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ 141 stage1_5.c fsys_ext2fs.c bios.c 142e2fs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \ 143 -DNO_BLOCK_FILES=1 144e2fs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \ 145 -DNO_BLOCK_FILES=1 146e2fs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 147 148# For fat_stage1_5 target. 149fat_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ 150 stage1_5.c fsys_fat.c bios.c 151fat_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 \ 152 -DNO_BLOCK_FILES=1 153fat_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 \ 154 -DNO_BLOCK_FILES=1 155fat_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 156 157# For ffs_stage1_5 target. 158ffs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ 159 stage1_5.c fsys_ffs.c bios.c 160ffs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \ 161 -DNO_BLOCK_FILES=1 162ffs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \ 163 -DNO_BLOCK_FILES=1 164ffs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 165 166# For ufs2_stage1_5 target. 167ufs2_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ 168 stage1_5.c fsys_ufs2.c bios.c 169ufs2_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS2=1 \ 170 -DNO_BLOCK_FILES=1 171ufs2_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS2=1 \ 172 -DNO_BLOCK_FILES=1 173ufs2_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 174 175# For minix_stage1_5 target. 176minix_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ 177 stage1_5.c fsys_minix.c bios.c 178minix_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \ 179 -DNO_BLOCK_FILES=1 180minix_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \ 181 -DNO_BLOCK_FILES=1 182minix_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 183 184# For reiserfs_stage1_5 target. 185reiserfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ 186 disk_io.c stage1_5.c fsys_reiserfs.c bios.c 187reiserfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \ 188 -DNO_BLOCK_FILES=1 189reiserfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \ 190 -DNO_BLOCK_FILES=1 191reiserfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 192 193# For vstafs_stage1_5 target. 194vstafs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ 195 disk_io.c stage1_5.c fsys_vstafs.c bios.c 196vstafs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_VSTAFS=1 \ 197 -DNO_BLOCK_FILES=1 198vstafs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_VSTAFS=1 \ 199 -DNO_BLOCK_FILES=1 200vstafs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 201 202# For jfs_stage1_5 target. 203jfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ 204 disk_io.c stage1_5.c fsys_jfs.c bios.c 205jfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_JFS=1 \ 206 -DNO_BLOCK_FILES=1 207jfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_JFS=1 \ 208 -DNO_BLOCK_FILES=1 209jfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 210 211# For xfs_stage1_5 target. 212xfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ 213 disk_io.c stage1_5.c fsys_xfs.c bios.c 214xfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_XFS=1 \ 215 -DNO_BLOCK_FILES=1 216xfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_XFS=1 \ 217 -DNO_BLOCK_FILES=1 218xfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 219 220# For iso9660_stage1_5 target. 221iso9660_stage1_5_exec_SOURCES = start_eltorito.S asm.S common.c char_io.c \ 222 disk_io.c stage1_5.c fsys_iso9660.c bios.c 223iso9660_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ISO9660=1 \ 224 -DNO_BLOCK_FILES=1 225iso9660_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ISO9660=1 \ 226 -DNO_BLOCK_FILES=1 227iso9660_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 228 229# For diskless target. 230diskless_exec_SOURCES = $(pre_stage2_exec_SOURCES) 231diskless_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \ 232 -DSUPPORT_DISKLESS=1 233diskless_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \ 234 -DSUPPORT_DISKLESS=1 235diskless_exec_LDFLAGS = $(PRE_STAGE2_LINK) 236diskless_exec_LDADD = ../netboot/libdrivers.a 237 238diskless_size.h: diskless 239 -rm -f $@ 240 set dummy `ls -l $^`; \ 241 echo "#define DISKLESS_SIZE $$6" > $@ 242 243# For nbloader target. 244nbloader_exec_SOURCES = nbloader.S 245nbloader_exec_CCASFLAGS = $(STAGE2_COMPILE) 246nbloader_exec_LDFLAGS = $(NBLOADER_LINK) 247 248# XXX: See the comment for start_exec-start.o. 249nbloader_exec-nbloader.$(OBJEXT): diskless_size.h 250 251# For nbgrub target. 252nbgrub: nbloader diskless 253 -rm -f $@ 254 cat $^ > $@ 255 256# For pxeloader target. 257pxeloader_exec_SOURCES = pxeloader.S 258pxeloader_exec_CCASFLAGS = $(STAGE2_COMPILE) 259pxeloader_exec_LDFLAGS = $(PXELOADER_LINK) 260 261# XXX: See the comment for start_exec-start.o. 262pxeloader_exec-pxeloader.$(OBJEXT): diskless_size.h 263 264# For pxegrub target. 265pxegrub: pxeloader diskless 266 -rm -f $@ 267 cat $^ > $@ 268 269# General rule for making a raw binary. 270SUFFIXES = .exec 271.exec: 272 $(OBJCOPY) -O binary $< $@ 273