Skip to content

Instantly share code, notes, and snippets.

@ahamid
Created December 5, 2011 04:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahamid/1432300 to your computer and use it in GitHub Desktop.
Save ahamid/1432300 to your computer and use it in GitHub Desktop.
Makefile with ld flags
objects = ../../../mk/kimg.o cpu-arch.o scr-print.o
fill = ../../../utils/fill
cpu_objects = main.o task.o pgrequest.o descriptor.o thread.o tss.o interrupt.o paging.o memory.o cpu-asm.o syscall-gates.o int.o pic.o state_switch.o stack_winding.o caps.o permissions.o ttrace.o
prt_objects = print.o vga.o
dependencies = main.d task.d descriptor.d thread.d tss.d interrupt.d paging.d memory.d print.d caps.d permissions.d ttrace.d
CPPFLAGS += -I"../../../include/" -I"../include"
%.d : %.c
@echo making deps for $< ...
@gcc -E -MD $(CPPFLAGS) $< > /dev/null
all : kimg
kimg : $(objects)
$(LD) $(LDFLAGS) $(objects) --oformat binary -Ttext 0x100000 -e 0x100000 -Map kernel.map -o kimg
$(fill) kimg -m 512
#Checking Kernel size... (less than 0xF0000
../size.sh
kelf : $(objects)
$(LD) $(LDFLAGS) $(objects) -o kelf
cpu-arch.o : $(cpu_objects)
$(LD) $(LDFLAGS) -i $(cpu_objects) -o cpu-arch.o
scr-print.o : $(prt_objects)
$(LD) $(LDFLAGS) -i $(prt_objects) -o scr-print.o
.PHONY : clean
clean :
rm -f *.o *.d *.map kimg kelf zeros
rm -f *~
.PHONY : dep
dep : $(dependencies)
ifeq ($(filter clean dep,$(MAKECMDGOALS)), )
include $(dependencies)
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment