Makefile: some simplification
This commit is contained in:
parent
2cfa67b8e2
commit
47f1d3f8ab
11
Makefile
11
Makefile
@ -2,11 +2,11 @@
|
|||||||
CPPFLAGS = -MMD
|
CPPFLAGS = -MMD
|
||||||
AS=nasm
|
AS=nasm
|
||||||
ASFLAGS += -f elf32
|
ASFLAGS += -f elf32
|
||||||
#LDFLAGS += -m32 -nostdlib -mkernel -fno-stack-protector
|
LDFLAGS += -m elf_i386
|
||||||
LDFLAGS += -m32 -nostdlib -static -fno-common -fno-use-cxa-atexit -fno-exceptions -fno-non-call-exceptions -fno-weak -fno-rtti -fno-stack-protector
|
|
||||||
CFLAGS += -m32 -Wall -Wextra -Werror -ffreestanding -fno-exceptions -fno-pie -fno-stack-protector -fno-tree-vectorize
|
CFLAGS += -m32 -Wall -Wextra -Werror -ffreestanding -fno-exceptions -fno-pie -fno-stack-protector -fno-tree-vectorize
|
||||||
CXXFLAGS += -m32 -Wall -Wextra -Werror -ffreestanding -fno-exceptions -fno-rtti -fno-pie
|
CXXFLAGS += -m32 -Wall -Wextra -Werror -ffreestanding -fno-exceptions -fno-rtti -fno-pie
|
||||||
DEBUG_FLAGS += -g -Og -DDEBUG -fno-omit-frame-pointer -fno-inline
|
DEBUG_FLAGS += -g -Og -DDEBUG -fno-omit-frame-pointer -fno-inline
|
||||||
|
LIBGCC = $(shell $(CC) -print-libgcc-file-name $(CFLAGS))
|
||||||
|
|
||||||
QEMU_OPT += -hda disk.img
|
QEMU_OPT += -hda disk.img
|
||||||
ARCH?=x86
|
ARCH?=x86
|
||||||
@ -24,7 +24,7 @@ cobj=$(csrc:%.c=%.o)
|
|||||||
deps=$(csrc:%.c=%.d) $(gasmsrc:%.S=%.d)
|
deps=$(csrc:%.c=%.d) $(gasmsrc:%.S=%.d)
|
||||||
|
|
||||||
kernel kernel.sym &: $(asmobj) $(gasmobj) $(cobj) linker.ld
|
kernel kernel.sym &: $(asmobj) $(gasmobj) $(cobj) linker.ld
|
||||||
$(CC) -m32 -ffreestanding -nostdlib $(cobj) $(gasmobj) $(asmobj) -o kernel -T linker.ld -lgcc
|
$(LD) $(LDFLAGS) $(asmobj) $(gasmobj) $(cobj) -o kernel -T linker.ld $(LIBGCC)
|
||||||
objcopy --only-keep-debug kernel kernel.sym
|
objcopy --only-keep-debug kernel kernel.sym
|
||||||
objcopy --strip-debug kernel
|
objcopy --strip-debug kernel
|
||||||
|
|
||||||
@ -38,9 +38,11 @@ disk.img: disk.sfdisk
|
|||||||
qemu-img create -f raw $@ 32M
|
qemu-img create -f raw $@ 32M
|
||||||
sfdisk $@ < disk.sfdisk
|
sfdisk $@ < disk.sfdisk
|
||||||
|
|
||||||
|
# NASM without preprocessing
|
||||||
%.o:%.asm
|
%.o:%.asm
|
||||||
$(AS) $(ASFLAGS) -o $@ $<
|
$(AS) $(ASFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
#GNU GAS ASM with C Preprocessing
|
||||||
%.o: %.S
|
%.o: %.S
|
||||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c "$<" -o "$@"
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c "$<" -o "$@"
|
||||||
|
|
||||||
@ -55,9 +57,6 @@ run:kernel disk.img
|
|||||||
debug: CFLAGS += $(DEBUG_FLAGS) -DRUN_TEST
|
debug: CFLAGS += $(DEBUG_FLAGS) -DRUN_TEST
|
||||||
debug: CXXFLAGS += $(DEBUG_FLAGS)
|
debug: CXXFLAGS += $(DEBUG_FLAGS)
|
||||||
debug:kernel kernel.sym
|
debug:kernel kernel.sym
|
||||||
#qemu-system-x86_64 -s -S -kernel kernel&
|
|
||||||
#qemu-system-i386 -s -S -kernel kernel&
|
|
||||||
#gdb -s kernel.sym -ex "target remote localhost:1234" -ex "dir core:driver:arch/$(ARCH))'"
|
|
||||||
gdb -q -x debug.gdb
|
gdb -q -x debug.gdb
|
||||||
|
|
||||||
debug_test: CFLAGS += $(DEBUG_FLAGS) -DRUN_TEST
|
debug_test: CFLAGS += $(DEBUG_FLAGS) -DRUN_TEST
|
||||||
|
2
userspace/Makefile
Normal file
2
userspace/Makefile
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Used to generated .d file that deal with header dependencies
|
||||||
|
CPPFLAGS = -MMD
|
Loading…
Reference in New Issue
Block a user