| # For test target. |
| TESTS = size_test |
| noinst_SCRIPTS = $(TESTS) |
| |
| # For dist target. |
| noinst_HEADERS = apic.h defs.h dir.h disk_inode.h disk_inode_ffs.h \ |
| fat.h filesys.h freebsd.h fs.h i386-elf.h imgact_aout.h \ |
| mb_header.h mb_info.h pc_slice.h shared.h smp-imps.h |
| EXTRA_DIST = $(noinst_SCRIPTS) |
| |
| # For <stage1.h>. |
| INCLUDES = -I$(top_srcdir)/stage1 |
| |
| # The library for /sbin/grub. |
| noinst_LIBRARIES = libgrub.a |
| libgrub_a_SOURCES = boot.c builtins.c common.c char_io.c cmdline.c \ |
| disk_io.c gunzip.c fsys_ffs.c fsys_ext2fs.c fsys_fat.c \ |
| fsys_minix.c fsys_reiserfs.c stage2.c |
| libgrub_a_CFLAGS = $(GRUB_CFLAGS) -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 \ |
| -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \ |
| -fwritable-strings |
| |
| # Stage 2 and Stage 1.5's. |
| pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) |
| pkgdata_DATA = stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \ |
| minix_stage1_5 reiserfs_stage1_5 |
| noinst_DATA = pre_stage2 start |
| noinst_PROGRAMS = pre_stage2.exec start.exec e2fs_stage1_5.exec \ |
| fat_stage1_5.exec ffs_stage1_5.exec minix_stage1_5.exec \ |
| reiserfs_stage1_5.exec |
| MOSTLYCLEANFILES = $(noinst_PROGRAMS) |
| |
| PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200 |
| START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000 |
| if NETBOOT_SUPPORT |
| STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ |
| -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1 |
| else |
| STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc |
| endif |
| |
| STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 |
| STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 |
| |
| # For stage2 target. |
| pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c common.c \ |
| char_io.c cmdline.c disk_io.c gunzip.c fsys_ext2fs.c \ |
| fsys_fat.c fsys_ffs.c fsys_minix.c fsys_reiserfs.c smp-imps.c \ |
| stage2.c |
| pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) |
| pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK) |
| |
| if NETBOOT_SUPPORT |
| pre_stage2_exec_LDADD = ../netboot/libdrivers.a |
| endif |
| |
| BUILT_SOURCES = stage2_size.h |
| CLEANFILES = $(pkgdata_DATA) $(noinst_DATA) $(BUILT_SOURCES) |
| |
| stage2_size.h: pre_stage2 |
| -rm -f stage2_size.h |
| set dummy `ls -l pre_stage2`; \ |
| echo "#define STAGE2_SIZE $$6" > stage2_size.h |
| |
| start_exec_SOURCES = start.S |
| start_exec_CFLAGS = $(STAGE2_COMPILE) |
| start_exec_LDFLAGS = $(START_LINK) |
| |
| # XXX: automake doesn't provide a way to specify dependencies for object |
| # files explicitly, so we must write this by a general Makefile scheme. |
| # If automake change the naming scheme for per-executable objects, this |
| # will be broken. |
| start_exec-start.o: stage2_size.h |
| |
| stage2: pre_stage2 start |
| -rm -f stage2 |
| cat start pre_stage2 > stage2 |
| |
| # For e2fs_stage1_5 target. |
| e2fs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ |
| stage1_5.c fsys_ext2fs.c bios.c |
| e2fs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \ |
| -DNO_BLOCK_FILES=1 |
| e2fs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) |
| |
| # For fat_stage1_5 target. |
| fat_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ |
| stage1_5.c fsys_fat.c bios.c |
| fat_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 \ |
| -DNO_BLOCK_FILES=1 |
| fat_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) |
| |
| # For ffs_stage1_5 target. |
| ffs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ |
| stage1_5.c fsys_ffs.c bios.c |
| |
| ffs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \ |
| -DNO_BLOCK_FILES=1 |
| ffs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) |
| |
| # For minix_stage1_5 target. |
| minix_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \ |
| stage1_5.c fsys_minix.c bios.c |
| minix_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \ |
| -DNO_BLOCK_FILES=1 |
| minix_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) |
| |
| # For reiserfs_stage1_5 target. |
| reiserfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \ |
| disk_io.c stage1_5.c fsys_reiserfs.c bios.c |
| reiserfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \ |
| -DNO_BLOCK_FILES=1 |
| reiserfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) |
| |
| # General rule for making a raw binary. |
| %: %.exec |
| $(OBJCOPY) -O binary $< $@ |