diff options
Diffstat (limited to 'libc/Makefile')
-rw-r--r-- | libc/Makefile | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libc/Makefile b/libc/Makefile index f4286ae..d57b9c4 100644 --- a/libc/Makefile +++ b/libc/Makefile @@ -12,25 +12,29 @@ COBJS = str.o \ list.o CC = ../cross/opt/bin/i686-elf-gcc LD = ../cross/opt/bin/i686-elf-ld -OC = ../cross/opt/bin/i686-elf-ar +AR = ../cross/opt/bin/i686-elf-ar +AS = nasm # Flags to make the binary smaller TODO: Remove after indirect pointer support! CSFLAGS = -mpreferred-stack-boundary=2 -fno-asynchronous-unwind-tables -Os -CFLAGS = $(CSFLAGS) -Wall -Wextra -nostdlib -nostdinc -ffreestanding -fno-builtin -mgeneral-regs-only -std=c99 -m32 -pedantic-errors -Iinc/ +CFLAGS = $(CSFLAGS) -Wall -Wextra -nostdlib -nostdinc -fno-builtin -mno-red-zone -mgeneral-regs-only -std=c99 -m32 -pedantic-errors -Iinc/ + +ASFLAGS = -f elf32 %.o: %.c @$(CC) -c $(CFLAGS) $< -o $@ libc: CFLAGS += -Duserspace -fPIE libc: $(COBJS) + @$(AS) $(ASFLAGS) crt/crt0.asm -o crt0.o @mkdir -p ../build/ - @$(AR) qc ../build/libc.a $+ + @$(AR) rcs ../build/libc.a crt0.o $+ -libk: CFLAGS += -Dkernel +libk: CFLAGS += -Dkernel -ffreestanding libk: $(COBJS) @mkdir -p ../build/ - @$(AR) qc ../build/libk.a $+ + @$(AR) rcs ../build/libk.a $+ clean: @find . -name "*.o" -type f -delete |