OUTPUT=kernel.img all : $(OUTPUT) #PREFIX=i686-pc-linux-gnu- PREFIX= NEWLIBPATH=/usr/lib/newlib/i686-linux-gnu CC=$(PREFIX)gcc CXX=$(PREFIX)g++ LD=$(PREFIX)ld OBJDUMP=$(PREFIX)objdump STRIP=$(PREFIX)strip CFLAGS=-I. -m32 -fno-builtin -nostdlib -I../include/common -I../include/kernel -I$(NEWLIBPATH)/include -Os -std=c99 ASFLAGS=-m32 #-Wa,-a,-ad CXXFLAGS:=$(CFLAGS) -fno-rtti -fno-exceptions #LIBGCC:=/usr/lib/gcc/x86_64-linux-gnu/4.6/32/libgcc.a #LDFLAGS:=-L/usr/lib/newlib/i686-linux-gnu/lib $(NEWLIBPATH)/lib/crt0.o $(NEWLIBPATH)/lib/crt1.o $(NEWLIBPATH)/lib/libc.a $(NEWLIBPATH)/lib/libm.a $(LIBGCC) #--gc-sections # cnstdlib.o stuff.o # cnstdlib.o # $(LD) -m elf_i386 -T link.ld --oformat elf32-i386 -o $@ $^ $(LDFLAGS) # loader.o #loader.o D3Stuff:=3d.o DrawFunctions.o Rasterizer.o CFLAGS:=$(CFLAGS) -DRASTERIZER kernel.elf : loader.o main.o mystdlib.o $(D3Stuff) $(LD) -dead-strip -nostdlib --nmagic -m elf_i386 -T linker.ld -o $@ $^ $(LDFLAGS) # $(STRIP) --strip-unneeded $@ $(OBJDUMP) -S --disassemble $@ > kernel.dump pad : pad.c gcc -o $@ $^ $(OUTPUT) : kernel.elf pad objcopy -O binary kernel.elf kernel.img ./pad run : $(OUTPUT) hexdump -C $^ qemu-system-i386 -hda $^ clean : rm -rf *~ *.o $(OUTPUT) kernel.elf