#
#  GRUB stage1 makefile
#

CFLAGS= $(SHARED_FLAGS) $(STAGE1_EXTRA_FLAGS)

STAGE1_EXTRA_FLAGS = -DRECOMPUTE_EACH_TIME

all: ../bin/stage1

ifeq ($(PC9800),)

stage1.o:	stage1.S Makefile ../Makefile
	$(CC) $(CFLAGS) -c -o stage1.o stage1.S

stage1.exec:	stage1.o Makefile ../Makefile
	$(LD) -N -Ttext 7C00 -o stage1.exec stage1.o

else

stage1.o:	stage1-98.S Makefile ../Makefile
	$(CC) $(CFLAGS) $(if $(STAGE2_MAX_PARAGRAPHS), \
				-DSTAGE2_PARAGRAPHS=$(STAGE2_MAX_PARAGRAPHS)) \
		-c -Wa,-a=stage1-98.list -o $@ stage1-98.S

stage1.exec:	stage1.o
	$(LD) -N -Ttext 0000 -o $@ stage1.o

endif

../bin/stage1:	stage1.exec Makefile ../Makefile
	$(OBJCOPY) -O binary stage1.exec ../bin/stage1

clean:
	rm -f stage1.o stage1.exec

