Makefile: all asm in Gnu AS
This commit is contained in:
parent
0040fb1cda
commit
814d38bc97
16
Makefile
16
Makefile
@ -15,14 +15,16 @@ SUBDIRS := core drivers tests arch/$(ARCH)
|
||||
INCDIRS += $(foreach dir, $(SUBDIRS), -I$(dir))
|
||||
CPPFLAGS += $(INCDIRS)
|
||||
|
||||
asmsrc=$(wildcard arch/$(ARCH)/boot/*.asm)
|
||||
asmsrc=
|
||||
asmobj=$(asmsrc:%.asm=%.o)
|
||||
gasmsrc=$(wildcard arch/$(ARCH)/*.S arch/$(ARCH)/boot/*.S)
|
||||
gasmobj=$(gasmsrc:%.S=%.o)
|
||||
csrc=$(shell find $(SUBDIRS) -type f -name "*.c")# $(wildcard *.c)
|
||||
cobj=$(csrc:%.c=%.o) arch/$(ARCH)/cpu_context_switch.o arch/$(ARCH)/irq_pit.o arch/$(ARCH)/irq_wrappers.o arch/$(ARCH)/exception_wrappers.o arch/$(ARCH)/syscall_wrappers.o
|
||||
deps = $(csrc:%.c=%.d)
|
||||
cobj=$(csrc:%.c=%.o)
|
||||
deps=$(csrc:%.c=%.d) $(gasmsrc:%.S=%.d)
|
||||
|
||||
kernel kernel.sym &: $(asmobj) $(cobj) linker.ld
|
||||
$(CC) -m32 -ffreestanding -nostdlib $(cobj) $(asmobj) -o kernel -T linker.ld -lgcc
|
||||
kernel kernel.sym &: $(asmobj) $(gasmobj) $(cobj) linker.ld
|
||||
$(CC) -m32 -ffreestanding -nostdlib $(cobj) $(gasmobj) $(asmobj) -o kernel -T linker.ld -lgcc
|
||||
objcopy --only-keep-debug kernel kernel.sym
|
||||
objcopy --strip-debug kernel
|
||||
|
||||
@ -39,7 +41,7 @@ disk.img:
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
%.o: %.S
|
||||
$(CC) $(INCDIRS) -c "$<" $(CFLAGS) -o "$@"
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c "$<" -o "$@"
|
||||
|
||||
|
||||
test: CFLAGS += -DRUN_TEST
|
||||
@ -61,7 +63,7 @@ debug_test: CFLAGS += $(DEBUG_FLAGS) -DRUN_TEST
|
||||
debug_test: debug
|
||||
|
||||
clean:
|
||||
$(RM) kernel $(asmobj) $(cobj) $(deps) fd.iso kernel.sym
|
||||
$(RM) kernel $(asmobj) $(gasmobj) $(cobj) $(deps) fd.iso kernel.sym
|
||||
$(RM) -r isodir
|
||||
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
|
@ -31,7 +31,7 @@ stack is properly aligned and failure to align the stack will result in
|
||||
undefined behavior.
|
||||
*/
|
||||
.section .bss
|
||||
.align 16
|
||||
.align 4096
|
||||
stack_bottom:
|
||||
.skip 16384 # 16 KiB
|
||||
stack_top:
|
||||
@ -117,3 +117,7 @@ Set the size of the _start symbol to the current location '.' minus its start.
|
||||
This is useful when debugging or when you implement call tracing.
|
||||
*/
|
||||
.size _start, . - _start
|
||||
.global _stack_bottom
|
||||
_stack_bottom: stack_bottom
|
||||
.global _stack_stop
|
||||
_stack_stop: stack_top
|
Loading…
Reference in New Issue
Block a user