#
# Makefile for the linux kernel.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definitions are now in the main makefile...


AS86    =as86 -0 -a
AS386	=as86 -3
LD86    =ld86 -0

.s.o:
	$(AS) -o $*.o $<
.c.o:
	$(CC) $(CFLAGS) -c $<
#.S.s:
#	$(CPP) -D__ASSEMBLY__ -traditional $< -o $*.s
.S.o:
	$(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o

OBJS  = process.o signal.o entry.o traps.o irq.o vm86.o bios32.o ptrace.o \
	ioport.o ldt.o setup.o sys_i386.o smp.o

all: trampoline.hex kernel.o head.o

#head.o: head.s

head.o: head.S $(TOPDIR)/include/linux/tasks.h
	$(CC) -D__ASSEMBLY__ -traditional -c $*.S -o $*.o
#	$(CPP) -traditional -o $*.s $<

trampoline.hex: trampoline
	(dd if=trampoline bs=1 skip=32 | hexify >trampoline.hex )

trampoline: trampoline.o trampoline32.o
	$(LD86) -s -o $@ trampoline.o trampoline32.o

trampoline.o: trampoline.s
	$(AS86) -o $@ $<

trampoline32.o: trampoline32.s
	$(AS386) -o $@ $<

trampoline.s: trampoline.S $(CONFIGURE) $(TOPDIR)/include/linux/config.h Makefile
	$(CPP) -traditional $< -o $@

trampoline32.s: trampoline32.S $(CONFIGURE) $(TOPDIR)/include/linux/config.h Makefile
	$(CPP) -traditional $< -o $@

kernel.o: $(OBJS)
	$(LD) -r -o kernel.o $(OBJS)
	sync

dep:
	$(CPP) -M *.c > .depend

modules:

include $(TOPDIR)/Rules.make
