17c478bd9Sstevel@tonic-gate# For test target.
27c478bd9Sstevel@tonic-gateTESTS = size_test
37c478bd9Sstevel@tonic-gatenoinst_SCRIPTS = $(TESTS)
47c478bd9Sstevel@tonic-gate
57c478bd9Sstevel@tonic-gate# For dist target.
67c478bd9Sstevel@tonic-gatenoinst_HEADERS = apic.h defs.h dir.h disk_inode.h disk_inode_ffs.h \
77c478bd9Sstevel@tonic-gate        fat.h filesys.h freebsd.h fs.h hercules.h i386-elf.h \
87c478bd9Sstevel@tonic-gate	imgact_aout.h iso9660.h jfs.h mb_header.h mb_info.h md5.h \
97c478bd9Sstevel@tonic-gate	nbi.h pc_slice.h serial.h shared.h smp-imps.h term.h \
10b1b8ab34Slling	terminfo.h tparm.h nbi.h ufs.h ufs2.h vstafs.h xfs.h graphics.h \
11b1b8ab34Slling	fsys_zfs.h
127c478bd9Sstevel@tonic-gateEXTRA_DIST = setjmp.S apm.S $(noinst_SCRIPTS)
137c478bd9Sstevel@tonic-gate
147c478bd9Sstevel@tonic-gate# For <stage1.h>.
157c478bd9Sstevel@tonic-gateINCLUDES = -I$(top_srcdir)/stage1
167c478bd9Sstevel@tonic-gate
177c478bd9Sstevel@tonic-gate# The library for /sbin/grub.
187c478bd9Sstevel@tonic-gatenoinst_LIBRARIES = libgrub.a
197c478bd9Sstevel@tonic-gatelibgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \
207c478bd9Sstevel@tonic-gate	disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_iso9660.c \
217c478bd9Sstevel@tonic-gate	fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_ufs.c fsys_ufs2.c \
22*a6f561b4SSašo Kiselkov	fsys_zfs.c zfs_fletcher.c zfs_lzjb.c zfs_lz4.c zfs_sha256.c \
237c478bd9Sstevel@tonic-gate	fsys_vstafs.c fsys_xfs.c gunzip.c md5.c serial.c stage2.c \
247c478bd9Sstevel@tonic-gate	terminfo.c tparm.c graphics.c
257c478bd9Sstevel@tonic-gatelibgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
267c478bd9Sstevel@tonic-gate	-DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
277c478bd9Sstevel@tonic-gate	-DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \
28b1b8ab34Slling	-DFSYS_UFS=1 -DFSYS_UFS2=1 -DFSYS_ZFS=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
297c478bd9Sstevel@tonic-gate	-DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1 \
307c478bd9Sstevel@tonic-gate
317c478bd9Sstevel@tonic-gate# Stage 2 and Stage 1.5's.
327c478bd9Sstevel@tonic-gatepkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
337c478bd9Sstevel@tonic-gate
347c478bd9Sstevel@tonic-gateEXTRA_PROGRAMS = nbloader.exec pxeloader.exec diskless.exec
357c478bd9Sstevel@tonic-gate
367c478bd9Sstevel@tonic-gateif DISKLESS_SUPPORT
377c478bd9Sstevel@tonic-gatepkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
387c478bd9Sstevel@tonic-gate	ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
39b1b8ab34Slling	reiserfs_stage1_5 ufs_stage1_5 ufs2_stage1_5 zfs_stage1_5 vstafs_stage1_5 \
407c478bd9Sstevel@tonic-gate	xfs_stage1_5 nbgrub pxegrub
417c478bd9Sstevel@tonic-gatenoinst_DATA = pre_stage2 start start_eltorito nbloader pxeloader diskless
427c478bd9Sstevel@tonic-gatenoinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
437c478bd9Sstevel@tonic-gate	e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \
447c478bd9Sstevel@tonic-gate	iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \
457c478bd9Sstevel@tonic-gate	reiserfs_stage1_5.exec ufs_stage1_5.exec ufs2_stage1_5.exec \
46b1b8ab34Slling	zfs_stage1_5.exec \
477c478bd9Sstevel@tonic-gate	vstafs_stage1_5.exec xfs_stage1_5.exec \
487c478bd9Sstevel@tonic-gate	nbloader.exec pxeloader.exec diskless.exec
497c478bd9Sstevel@tonic-gateelse
507c478bd9Sstevel@tonic-gatepkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
517c478bd9Sstevel@tonic-gate	ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
52b1b8ab34Slling	reiserfs_stage1_5 ufs_stage1_5 ufs2_stage1_5 zfs_stage1_5 vstafs_stage1_5 \
537c478bd9Sstevel@tonic-gate	xfs_stage1_5
547c478bd9Sstevel@tonic-gatenoinst_DATA = pre_stage2 start start_eltorito
557c478bd9Sstevel@tonic-gatenoinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
567c478bd9Sstevel@tonic-gate	e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \
577c478bd9Sstevel@tonic-gate	iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \
587c478bd9Sstevel@tonic-gate	reiserfs_stage1_5.exec ufs_stage1_5.exec ufs2_stage1_5.exec \
59b1b8ab34Slling	zfs_stage1_5.exec vstafs_stage1_5.exec xfs_stage1_5.exec
607c478bd9Sstevel@tonic-gateendif
617c478bd9Sstevel@tonic-gateMOSTLYCLEANFILES = $(noinst_PROGRAMS)
627c478bd9Sstevel@tonic-gate
637c478bd9Sstevel@tonic-gatePRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200
647c478bd9Sstevel@tonic-gateSTART_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
657c478bd9Sstevel@tonic-gateNBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0
667c478bd9Sstevel@tonic-gatePXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
677c478bd9Sstevel@tonic-gateSTART_ELTORITO_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
687c478bd9Sstevel@tonic-gate
697c478bd9Sstevel@tonic-gateif NETBOOT_SUPPORT
707c478bd9Sstevel@tonic-gateNETBOOT_FLAGS = -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1
717c478bd9Sstevel@tonic-gateelse
727c478bd9Sstevel@tonic-gateNETBOOT_FLAGS =
737c478bd9Sstevel@tonic-gateendif
747c478bd9Sstevel@tonic-gate
757c478bd9Sstevel@tonic-gateif SERIAL_SUPPORT
767c478bd9Sstevel@tonic-gateSERIAL_FLAGS = -DSUPPORT_SERIAL=1
777c478bd9Sstevel@tonic-gateelse
787c478bd9Sstevel@tonic-gateSERIAL_FLAGS =
797c478bd9Sstevel@tonic-gateendif
807c478bd9Sstevel@tonic-gate
817c478bd9Sstevel@tonic-gateif HERCULES_SUPPORT
827c478bd9Sstevel@tonic-gateHERCULES_FLAGS = -DSUPPORT_HERCULES=1
837c478bd9Sstevel@tonic-gateelse
847c478bd9Sstevel@tonic-gateHERCULES_FLAGS =
857c478bd9Sstevel@tonic-gateendif
867c478bd9Sstevel@tonic-gate
877c478bd9Sstevel@tonic-gateif GRAPHICS_SUPPORT
887c478bd9Sstevel@tonic-gateGRAPHICS_FLAGS = -DSUPPORT_GRAPHICS=1
897c478bd9Sstevel@tonic-gateelse
907c478bd9Sstevel@tonic-gateGRAPHICS_FLAGS =
917c478bd9Sstevel@tonic-gateendif
927c478bd9Sstevel@tonic-gate
937c478bd9Sstevel@tonic-gateSTAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
947c478bd9Sstevel@tonic-gate	$(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS) $(GRAPHICS_FLAGS)
957c478bd9Sstevel@tonic-gate
967c478bd9Sstevel@tonic-gateSTAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
977c478bd9Sstevel@tonic-gateSTAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1
987c478bd9Sstevel@tonic-gate
997c478bd9Sstevel@tonic-gate# For stage2 target.
1007c478bd9Sstevel@tonic-gatepre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c char_io.c \
1017c478bd9Sstevel@tonic-gate	cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \
1027c478bd9Sstevel@tonic-gate	fsys_fat.c fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \
1037c478bd9Sstevel@tonic-gate	fsys_reiserfs.c fsys_ufs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c \
104*a6f561b4SSašo Kiselkov	fsys_zfs.c zfs_fletcher.c zfs_lzjb.c zfs_lz4.c zfs_sha256.c \
1057c478bd9Sstevel@tonic-gate	gunzip.c hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c \
1067c478bd9Sstevel@tonic-gate	tparm.c graphics.c
1077c478bd9Sstevel@tonic-gatepre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
1087c478bd9Sstevel@tonic-gatepre_stage2_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
1097c478bd9Sstevel@tonic-gatepre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK)
1107c478bd9Sstevel@tonic-gate
1117c478bd9Sstevel@tonic-gateif NETBOOT_SUPPORT
1127c478bd9Sstevel@tonic-gatepre_stage2_exec_LDADD = ../netboot/libdrivers.a
1137c478bd9Sstevel@tonic-gateendif
1147c478bd9Sstevel@tonic-gate
1157c478bd9Sstevel@tonic-gateif DISKLESS_SUPPORT
1167c478bd9Sstevel@tonic-gateBUILT_SOURCES = stage2_size.h diskless_size.h
1177c478bd9Sstevel@tonic-gateelse
1187c478bd9Sstevel@tonic-gateBUILT_SOURCES = stage2_size.h
1197c478bd9Sstevel@tonic-gateendif
1207c478bd9Sstevel@tonic-gate
1217c478bd9Sstevel@tonic-gateCLEANFILES = $(pkglib_DATA) $(noinst_DATA) $(BUILT_SOURCES)
1227c478bd9Sstevel@tonic-gate
1237c478bd9Sstevel@tonic-gatestage2_size.h: pre_stage2
1247c478bd9Sstevel@tonic-gate	-rm -f stage2_size.h
1257c478bd9Sstevel@tonic-gate	set dummy `ls -l pre_stage2`; \
1267c478bd9Sstevel@tonic-gate	echo "#define STAGE2_SIZE $$6" > stage2_size.h
1277c478bd9Sstevel@tonic-gate
1287c478bd9Sstevel@tonic-gatestart_exec_SOURCES = start.S
1297c478bd9Sstevel@tonic-gatestart_exec_CCASFLAGS = $(STAGE2_COMPILE)
1307c478bd9Sstevel@tonic-gatestart_exec_LDFLAGS = $(START_LINK)
1317c478bd9Sstevel@tonic-gate
1327c478bd9Sstevel@tonic-gate# XXX: automake doesn't provide a way to specify dependencies for object
1337c478bd9Sstevel@tonic-gate# files explicitly, so we must write this by a general Makefile scheme.
1347c478bd9Sstevel@tonic-gate# If automake change the naming scheme for per-executable objects, this
1357c478bd9Sstevel@tonic-gate# will be broken.
1367c478bd9Sstevel@tonic-gatestart_exec-start.$(OBJEXT): stage2_size.h
1377c478bd9Sstevel@tonic-gate
1387c478bd9Sstevel@tonic-gatestage2: pre_stage2 start
1397c478bd9Sstevel@tonic-gate	-rm -f stage2
1407c478bd9Sstevel@tonic-gate	cat start pre_stage2 > stage2
1417c478bd9Sstevel@tonic-gate
1427c478bd9Sstevel@tonic-gatestart_eltorito_exec_SOURCES = start_eltorito.S
1437c478bd9Sstevel@tonic-gatestart_eltorito_exec_CCASFLAGS = $(STAGE2_COMPILE)
1447c478bd9Sstevel@tonic-gatestart_eltorito_exec_LDFLAGS = $(START_ELTORITO_LINK)
1457c478bd9Sstevel@tonic-gate
1467c478bd9Sstevel@tonic-gatestart_eltorito_exec-start.$(OBJEXT): stage2_size.h
1477c478bd9Sstevel@tonic-gate
1487c478bd9Sstevel@tonic-gatestage2_eltorito: pre_stage2 start_eltorito
1497c478bd9Sstevel@tonic-gate	-rm -f stage2_eltorito
1507c478bd9Sstevel@tonic-gate	cat start_eltorito pre_stage2 > stage2_eltorito
1517c478bd9Sstevel@tonic-gate
1527c478bd9Sstevel@tonic-gate# For e2fs_stage1_5 target.
1537c478bd9Sstevel@tonic-gatee2fs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
1547c478bd9Sstevel@tonic-gate	stage1_5.c fsys_ext2fs.c bios.c
1557c478bd9Sstevel@tonic-gatee2fs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \
1567c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
1577c478bd9Sstevel@tonic-gatee2fs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \
1587c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
1597c478bd9Sstevel@tonic-gatee2fs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
1607c478bd9Sstevel@tonic-gate
1617c478bd9Sstevel@tonic-gate# For fat_stage1_5 target.
1627c478bd9Sstevel@tonic-gatefat_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
1637c478bd9Sstevel@tonic-gate	stage1_5.c fsys_fat.c bios.c
1647c478bd9Sstevel@tonic-gatefat_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 \
1657c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
1667c478bd9Sstevel@tonic-gatefat_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 \
1677c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
1687c478bd9Sstevel@tonic-gatefat_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
1697c478bd9Sstevel@tonic-gate
1707c478bd9Sstevel@tonic-gate# For ffs_stage1_5 target.
1717c478bd9Sstevel@tonic-gateffs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
1727c478bd9Sstevel@tonic-gate	stage1_5.c fsys_ffs.c bios.c
1737c478bd9Sstevel@tonic-gateffs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \
1747c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
1757c478bd9Sstevel@tonic-gateffs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \
1767c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
1777c478bd9Sstevel@tonic-gateffs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
1787c478bd9Sstevel@tonic-gate
1797c478bd9Sstevel@tonic-gate# For ufs_stage1_5 target.
1807c478bd9Sstevel@tonic-gateufs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
1817c478bd9Sstevel@tonic-gate	stage1_5.c fsys_ufs.c bios.c
1827c478bd9Sstevel@tonic-gateufs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS=1 \
1837c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
1847c478bd9Sstevel@tonic-gateufs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS=1 \
1857c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
1867c478bd9Sstevel@tonic-gateufs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
1877c478bd9Sstevel@tonic-gate
1887c478bd9Sstevel@tonic-gate# For ufs2_stage1_5 target.
1897c478bd9Sstevel@tonic-gateufs2_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
1907c478bd9Sstevel@tonic-gate	stage1_5.c fsys_ufs2.c bios.c
1917c478bd9Sstevel@tonic-gateufs2_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS2=1 \
1927c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
1937c478bd9Sstevel@tonic-gateufs2_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS2=1 \
1947c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
1957c478bd9Sstevel@tonic-gateufs2_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
1967c478bd9Sstevel@tonic-gate
197b1b8ab34Slling# For zfs_stage1_5 target.
198b1b8ab34Sllingzfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
199*a6f561b4SSašo Kiselkov	stage1_5.c fsys_zfs.c zfs_fletcher.c zfs_lzjb.c zfs_lz4.c \
200*a6f561b4SSašo Kiselkov	zfs_sha256.c bios.c
201b1b8ab34Sllingzfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ZFS=1 \
202b1b8ab34Slling	-DNO_BLOCK_FILES=1
203b1b8ab34Sllingzfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ZFS=1 \
204b1b8ab34Slling	-DNO_BLOCK_FILES=1
205b1b8ab34Sllingzfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
206b1b8ab34Slling
2077c478bd9Sstevel@tonic-gate# For minix_stage1_5 target.
2087c478bd9Sstevel@tonic-gateminix_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
2097c478bd9Sstevel@tonic-gate	stage1_5.c fsys_minix.c bios.c
2107c478bd9Sstevel@tonic-gateminix_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \
2117c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
2127c478bd9Sstevel@tonic-gateminix_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \
2137c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
2147c478bd9Sstevel@tonic-gateminix_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
2157c478bd9Sstevel@tonic-gate
2167c478bd9Sstevel@tonic-gate# For reiserfs_stage1_5 target.
2177c478bd9Sstevel@tonic-gatereiserfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \
2187c478bd9Sstevel@tonic-gate	disk_io.c stage1_5.c fsys_reiserfs.c bios.c
2197c478bd9Sstevel@tonic-gatereiserfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \
2207c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
2217c478bd9Sstevel@tonic-gatereiserfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \
2227c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
2237c478bd9Sstevel@tonic-gatereiserfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
2247c478bd9Sstevel@tonic-gate
2257c478bd9Sstevel@tonic-gate# For vstafs_stage1_5 target.
2267c478bd9Sstevel@tonic-gatevstafs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \
2277c478bd9Sstevel@tonic-gate	disk_io.c stage1_5.c fsys_vstafs.c bios.c
2287c478bd9Sstevel@tonic-gatevstafs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_VSTAFS=1 \
2297c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
2307c478bd9Sstevel@tonic-gatevstafs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_VSTAFS=1 \
2317c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
2327c478bd9Sstevel@tonic-gatevstafs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
2337c478bd9Sstevel@tonic-gate
2347c478bd9Sstevel@tonic-gate# For jfs_stage1_5 target.
2357c478bd9Sstevel@tonic-gatejfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \
2367c478bd9Sstevel@tonic-gate	disk_io.c stage1_5.c fsys_jfs.c bios.c
2377c478bd9Sstevel@tonic-gatejfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_JFS=1 \
2387c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
2397c478bd9Sstevel@tonic-gatejfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_JFS=1 \
2407c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
2417c478bd9Sstevel@tonic-gatejfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
2427c478bd9Sstevel@tonic-gate
2437c478bd9Sstevel@tonic-gate# For xfs_stage1_5 target.
2447c478bd9Sstevel@tonic-gatexfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \
2457c478bd9Sstevel@tonic-gate	disk_io.c stage1_5.c fsys_xfs.c bios.c
2467c478bd9Sstevel@tonic-gatexfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_XFS=1 \
2477c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
2487c478bd9Sstevel@tonic-gatexfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_XFS=1 \
2497c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
2507c478bd9Sstevel@tonic-gatexfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
2517c478bd9Sstevel@tonic-gate
2527c478bd9Sstevel@tonic-gate# For iso9660_stage1_5 target.
2537c478bd9Sstevel@tonic-gateiso9660_stage1_5_exec_SOURCES = start_eltorito.S asm.S common.c char_io.c \
2547c478bd9Sstevel@tonic-gate	disk_io.c stage1_5.c fsys_iso9660.c bios.c
2557c478bd9Sstevel@tonic-gateiso9660_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ISO9660=1 \
2567c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
2577c478bd9Sstevel@tonic-gateiso9660_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ISO9660=1 \
2587c478bd9Sstevel@tonic-gate	-DNO_BLOCK_FILES=1
2597c478bd9Sstevel@tonic-gateiso9660_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
2607c478bd9Sstevel@tonic-gate
2617c478bd9Sstevel@tonic-gate# For diskless target.
2627c478bd9Sstevel@tonic-gatediskless_exec_SOURCES = $(pre_stage2_exec_SOURCES)
2637c478bd9Sstevel@tonic-gatediskless_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \
2647c478bd9Sstevel@tonic-gate	-DSUPPORT_DISKLESS=1
2657c478bd9Sstevel@tonic-gatediskless_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \
2667c478bd9Sstevel@tonic-gate	-DSUPPORT_DISKLESS=1
2677c478bd9Sstevel@tonic-gatediskless_exec_LDFLAGS = $(PRE_STAGE2_LINK)
2687c478bd9Sstevel@tonic-gatediskless_exec_LDADD = ../netboot/libdrivers.a
2697c478bd9Sstevel@tonic-gate
2707c478bd9Sstevel@tonic-gatediskless_size.h: diskless
2717c478bd9Sstevel@tonic-gate	-rm -f $@
2727c478bd9Sstevel@tonic-gate	set dummy `ls -l $^`; \
2737c478bd9Sstevel@tonic-gate	echo "#define DISKLESS_SIZE $$6" > $@
2747c478bd9Sstevel@tonic-gate
2757c478bd9Sstevel@tonic-gate# For nbloader target.
2767c478bd9Sstevel@tonic-gatenbloader_exec_SOURCES = nbloader.S
2777c478bd9Sstevel@tonic-gatenbloader_exec_CCASFLAGS = $(STAGE2_COMPILE)
2787c478bd9Sstevel@tonic-gatenbloader_exec_LDFLAGS = $(NBLOADER_LINK)
2797c478bd9Sstevel@tonic-gate
2807c478bd9Sstevel@tonic-gate# XXX: See the comment for start_exec-start.o.
2817c478bd9Sstevel@tonic-gatenbloader_exec-nbloader.$(OBJEXT): diskless_size.h
2827c478bd9Sstevel@tonic-gate
2837c478bd9Sstevel@tonic-gate# For nbgrub target.
2847c478bd9Sstevel@tonic-gatenbgrub: nbloader diskless
2857c478bd9Sstevel@tonic-gate	-rm -f $@
2867c478bd9Sstevel@tonic-gate	cat $^ > $@
2877c478bd9Sstevel@tonic-gate
2887c478bd9Sstevel@tonic-gate# For pxeloader target.
2897c478bd9Sstevel@tonic-gatepxeloader_exec_SOURCES = pxeloader.S
2907c478bd9Sstevel@tonic-gatepxeloader_exec_CCASFLAGS = $(STAGE2_COMPILE)
2917c478bd9Sstevel@tonic-gatepxeloader_exec_LDFLAGS = $(PXELOADER_LINK)
2927c478bd9Sstevel@tonic-gate
2937c478bd9Sstevel@tonic-gate# XXX: See the comment for start_exec-start.o.
2947c478bd9Sstevel@tonic-gatepxeloader_exec-pxeloader.$(OBJEXT): diskless_size.h
2957c478bd9Sstevel@tonic-gate
2967c478bd9Sstevel@tonic-gate# For pxegrub target.
2977c478bd9Sstevel@tonic-gatepxegrub: pxeloader diskless
2987c478bd9Sstevel@tonic-gate	-rm -f $@
2997c478bd9Sstevel@tonic-gate	cat $^ > $@
3007c478bd9Sstevel@tonic-gate
3017c478bd9Sstevel@tonic-gate# General rule for making a raw binary.
3027c478bd9Sstevel@tonic-gateSUFFIXES = .exec
3037c478bd9Sstevel@tonic-gate.exec:
3047c478bd9Sstevel@tonic-gate	$(OBJCOPY) -O binary $< $@
305