1 # For test target. 2 TESTS = size_test 3 noinst_SCRIPTS = $(TESTS) 4 5 # For dist target. 6 noinst_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 11 EXTRA_DIST = setjmp.S apm.S $(noinst_SCRIPTS) 12 13 # For <stage1.h>. 14 INCLUDES = -I$(top_srcdir)/stage1 15 16 # The library for /sbin/grub. 17 noinst_LIBRARIES = libgrub.a 18 libgrub_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 23 libgrub_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. 30 pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) 31 32 EXTRA_PROGRAMS = nbloader.exec pxeloader.exec diskless.exec 33 34 if DISKLESS_SUPPORT 35 pkglib_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 39 noinst_DATA = pre_stage2 start start_eltorito nbloader pxeloader diskless 40 noinst_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 45 else 46 pkglib_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 49 noinst_DATA = pre_stage2 start start_eltorito 50 noinst_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 55 endif 56 MOSTLYCLEANFILES = $(noinst_PROGRAMS) 57 58 PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200 59 START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000 60 NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0 61 PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 62 START_ELTORITO_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 63 64 if NETBOOT_SUPPORT 65 NETBOOT_FLAGS = -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1 66 else 67 NETBOOT_FLAGS = 68 endif 69 70 if SERIAL_SUPPORT 71 SERIAL_FLAGS = -DSUPPORT_SERIAL=1 72 else 73 SERIAL_FLAGS = 74 endif 75 76 if HERCULES_SUPPORT 77 HERCULES_FLAGS = -DSUPPORT_HERCULES=1 78 else 79 HERCULES_FLAGS = 80 endif 81 82 STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ 83 $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS) 84 85 STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 86 STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 87 88 # For stage2 target. 89 pre_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 94 pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) 95 pre_stage2_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) 96 pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK) 97 98 if NETBOOT_SUPPORT 99 pre_stage2_exec_LDADD = ../netboot/libdrivers.a 100 endif 101 102 if DISKLESS_SUPPORT 103 BUILT_SOURCES = stage2_size.h diskless_size.h 104 else 105 BUILT_SOURCES = stage2_size.h 106 endif 107 108 CLEANFILES = $(pkglib_DATA) $(noinst_DATA) $(BUILT_SOURCES) 109 110 stage2_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 115 start_exec_SOURCES = start.S 116 start_exec_CCASFLAGS = $(STAGE2_COMPILE) 117 start_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. 123 start_exec-start.$(OBJEXT): stage2_size.h 124 125 stage2: pre_stage2 start 126 -rm -f stage2 127 cat start pre_stage2 > stage2 128 129 start_eltorito_exec_SOURCES = start_eltorito.S 130 start_eltorito_exec_CCASFLAGS = $(STAGE2_COMPILE) 131 start_eltorito_exec_LDFLAGS = $(START_ELTORITO_LINK) 132 133 start_eltorito_exec-start.$(OBJEXT): stage2_size.h 134 135 stage2_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. 140 e2fs_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 142 e2fs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \ 143 -DNO_BLOCK_FILES=1 144 e2fs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \ 145 -DNO_BLOCK_FILES=1 146 e2fs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 147 148 # For fat_stage1_5 target. 149 fat_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 151 fat_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 \ 152 -DNO_BLOCK_FILES=1 153 fat_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 \ 154 -DNO_BLOCK_FILES=1 155 fat_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 156 157 # For ffs_stage1_5 target. 158 ffs_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 160 ffs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \ 161 -DNO_BLOCK_FILES=1 162 ffs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \ 163 -DNO_BLOCK_FILES=1 164 ffs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 165 166 # For ufs2_stage1_5 target. 167 ufs2_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 169 ufs2_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS2=1 \ 170 -DNO_BLOCK_FILES=1 171 ufs2_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS2=1 \ 172 -DNO_BLOCK_FILES=1 173 ufs2_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 174 175 # For minix_stage1_5 target. 176 minix_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 178 minix_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \ 179 -DNO_BLOCK_FILES=1 180 minix_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \ 181 -DNO_BLOCK_FILES=1 182 minix_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 183 184 # For reiserfs_stage1_5 target. 185 reiserfs_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 187 reiserfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \ 188 -DNO_BLOCK_FILES=1 189 reiserfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \ 190 -DNO_BLOCK_FILES=1 191 reiserfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 192 193 # For vstafs_stage1_5 target. 194 vstafs_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 196 vstafs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_VSTAFS=1 \ 197 -DNO_BLOCK_FILES=1 198 vstafs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_VSTAFS=1 \ 199 -DNO_BLOCK_FILES=1 200 vstafs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 201 202 # For jfs_stage1_5 target. 203 jfs_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 205 jfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_JFS=1 \ 206 -DNO_BLOCK_FILES=1 207 jfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_JFS=1 \ 208 -DNO_BLOCK_FILES=1 209 jfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 210 211 # For xfs_stage1_5 target. 212 xfs_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 214 xfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_XFS=1 \ 215 -DNO_BLOCK_FILES=1 216 xfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_XFS=1 \ 217 -DNO_BLOCK_FILES=1 218 xfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 219 220 # For iso9660_stage1_5 target. 221 iso9660_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 223 iso9660_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ISO9660=1 \ 224 -DNO_BLOCK_FILES=1 225 iso9660_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ISO9660=1 \ 226 -DNO_BLOCK_FILES=1 227 iso9660_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) 228 229 # For diskless target. 230 diskless_exec_SOURCES = $(pre_stage2_exec_SOURCES) 231 diskless_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \ 232 -DSUPPORT_DISKLESS=1 233 diskless_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \ 234 -DSUPPORT_DISKLESS=1 235 diskless_exec_LDFLAGS = $(PRE_STAGE2_LINK) 236 diskless_exec_LDADD = ../netboot/libdrivers.a 237 238 diskless_size.h: diskless 239 -rm -f $@ 240 set dummy `ls -l $^`; \ 241 echo "#define DISKLESS_SIZE $$6" > $@ 242 243 # For nbloader target. 244 nbloader_exec_SOURCES = nbloader.S 245 nbloader_exec_CCASFLAGS = $(STAGE2_COMPILE) 246 nbloader_exec_LDFLAGS = $(NBLOADER_LINK) 247 248 # XXX: See the comment for start_exec-start.o. 249 nbloader_exec-nbloader.$(OBJEXT): diskless_size.h 250 251 # For nbgrub target. 252 nbgrub: nbloader diskless 253 -rm -f $@ 254 cat $^ > $@ 255 256 # For pxeloader target. 257 pxeloader_exec_SOURCES = pxeloader.S 258 pxeloader_exec_CCASFLAGS = $(STAGE2_COMPILE) 259 pxeloader_exec_LDFLAGS = $(PXELOADER_LINK) 260 261 # XXX: See the comment for start_exec-start.o. 262 pxeloader_exec-pxeloader.$(OBJEXT): diskless_size.h 263 264 # For pxegrub target. 265 pxegrub: pxeloader diskless 266 -rm -f $@ 267 cat $^ > $@ 268 269 # General rule for making a raw binary. 270 SUFFIXES = .exec 271 .exec: 272 $(OBJCOPY) -O binary $< $@ 273