AS = as
AS86 = as86
LD = ld
LD86 = ld86
AS  = as
GCC = gcc

all: weix_seting bootsect

bootsect: bootsect.o
	$(LD86) -0 -s -d -o bootsect bootsect.o

bootsect.o : bootsect.s
	$(AS86) -0 -a -o bootsect.o tmp.s
	$(AS86) -0 -l boot.list -a tmp.s


bootsect.s : bootsect.S
	$(GCC) -D__KERNEL__ -E -traditional -o bootsect.s bootsect.S
	(./get_size.sh) > tmp.s
	cat bootsect.s >> tmp.s


weix_seting: weix_seting.o
	$(LD86) -0 -s -d -o weix_seting weix_seting.o

weix_seting.o : weix_seting.s
	$(AS86) -0 -a -o weix_seting.o weix_seting.s

weix_seting.s : weix_seting.S
	$(GCC) -D__KERNEL__ -E -traditional -o weix_seting.s weix_seting.S

#bootsect: bootsect.o
#	$(LD) -Ttext 0x0 -s --oformat binary -o bootsect bootsect.o

#bootsect.o :
#	$(GCC) -D__KERNEL__ -E -traditional -o $*.s $*.S
#	(./get_size.sh) >  tmp.s
#	cat bootsect.s >> tmp.s
#	$(AS) -o $@ tmp.s

#weix_seting:
#	$(GCC) -I../include -D__ASSEMBLY__ -traditional -c $@.S -o $@.o
#	$(LD) -Ttext 0x0 -s --oformat binary -e begtext -o weix_seting weix_seting.o

clean:
	rm *.o
	rm *.s
