head	1.3;
access;
symbols
	initial_tag:1.1.1.1 kmkim:1.1.1;
locks; strict;
comment	@# @;


1.3
date	2006.01.31.19.26.57;	author lowlevel;	state Exp;
branches;
next	1.2;

1.2
date	2006.01.11.14.12.17;	author lowlevel;	state Exp;
branches;
next	1.1;

1.1
date	2006.01.05.13.13.39;	author lowlevel;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2006.01.05.13.13.39;	author lowlevel;	state Exp;
branches;
next	;


desc
@@


1.3
log
@Tested at Bochs, Vmware. Works fine at both emulators.
@
text
@.SUFFIXES: .asm

# defines
DEST_DIR=../bin

INCLUDE =-Iinclude -Imd/i686/include
AS_INCLUDE=-Imd/i686 
AS		=nasm
AS_ARGS	=-g $(AS_INCLUDE)
CC		=gcc
CC_ARGS	= -g -nostdinc -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(INCLUDE)
LD		=ld 
# BIOS loads 512 bytes of bootstrap.o onto 0x7C00
# Address from 0x8000 to 0x8FFF (64KB) is temporarily used for stack by bootstrap.o
# bootstrap loads the second sector onto 0x9000 
# entry16.o is located at 0x9000 and its size is 0x1000
# entry32.o is located at 0xA000 and it is called by entry16 @@ entry16.o
#
# entry16 is 16 bit code for switching CPU from real mode to protected mode.
# entry32 initiates stack and registers for every CPU 
#		  to get started calling C codes
#
# -e : set start address ( entry )
#


LD_ARGS =-g -nostdlib -e entry32 -Ttext 0xA000

SRCS	=					\
	md/i686/entry32.asm		\
	kernel.c				\
	md/i686/cpu.c			\
	md/i686/md_asm.asm		\
	md/i686/md.c			\
	md/i686/i8259.c			\
	md/i686/intr.c			\
	md/i686/console_drv.c	\
	md/i686/time.c 			\
	vsnprintf.c				\
	console.c 				\
	md/i686/smp/mpparse.c	\
	md/i686/smp/apic.c		\
	md/i686/smp/smp.c		\
	md/i686/profiler.c		
	
OBJS1	=$(SRCS:.c=.o)
OBJS	=$(OBJS1:.asm=.o)

# targets
all: install

install: lightos.bin
	cp lightos.bin $(DEST_DIR)
	cp lightos.lst $(DEST_DIR)
	cp lightos.sym $(DEST_DIR)
#	rm -f *.o lightos.bin lightos.lst lightos.sym kernel.bin
	

lightos.bin: md/i686/bootstrap.o md/i686/entry16.o kernel.bin
	cat md/i686/bootstrap.o md/i686/entry16.o kernel.bin > lightos.bin

clean:
	rm -f \
		*.o *.dump \
		md/i686/*.o md/i686/*.o.dump \
		md/i686/smp/*.o md/i686/smp/*.o.dump \
		lightos.bin kernel.bin lightos.sym lightos.lst $(DEST_DIR)/lightos.bin

# implicit rules
.asm.o:
	$(AS) $(AS_ARGS) -f win32 -o$@@ $<
#	objdump --source $@@ > $@@.dump

.c.o:
	$(CC) $(CC_ARGS) -c -o $@@.1 $<
#	Remove "_" from symbols
	objcopy $@@.1 --remove-leading-char $@@
	rm $@@.1
#	objdump --source $@@ > $@@.dump

# explicit rules
md/i686/bootstrap.o: md/i686/bootstrap.asm
	$(AS) $(AS_ARGS) -f bin -o$@@ $<

md/i686/entry16.o: md/i686/entry16.asm
	$(AS) $(AS_ARGS) -f bin -o$@@ $<
	
kernel.bin: $(OBJS)
	$(LD) $(LD_ARGS) -o$@@.o $(OBJS)
#	$(LD) -i $(LD_ARGS) -o$@@.o $(OBJS)
	objdump --source $@@.o >lightos.lst
	nm $@@.o | sort >lightos.sym
#	strip $@@.o
	objcopy -R .note -R .comment -S -O binary $@@.o $@@
	
@


1.2
log
@Changed makefile to copy binary into lightos/bin directory
@
text
@d13 5
a17 5
# BIOS loads bootstrap.o onto 0x7C00
#
# bootstrap loads the second sector onto 0x8000 
# entry16.o is located at 0x8000 and its size is 0x1000
# entry32.o is located at 0x9000 and it is called by entry16 @@ entry16.o
d26 2
a27 1
LD_ARGS =-g -nostdlib -e entry32 -Ttext 0x9000
d93 1
a93 1
	strip $@@.o
d95 1
a95 1
	@


1.1
log
@Initial revision
@
text
@d4 1
a4 1
DEST_DIR=../bochs
@


1.1.1.1
log
@Initial Import
@
text
@@
