<commit_before>ENTRY=kernel_main
ORIGIN=0x10000
OBJS=main.o ports.o a20.o memory.o pit.o pic.o gdt.o tss.o idt.o isr.s.o isr.o syscall.o screen.o panic.o user.s.o pci.o

ASM=nasm
CC=$(CROSS_TARGET)-gcc
LD=$(CROSS_TARGET)-gcc

ASM_FLAGS=-f elf
CFLAGS=-c -Wall -Wextra -Wpedantic -std=c99 -ffreestanding -I../include -O2
LDFLAGS=-s -e $(ENTRY) -Ttext=$(ORIGIN) -nostdlib

kernel: $(OBJS)
	$(LD) $(LDFLAGS) $^ -o kernel.o
	objcopy -R .note -R .comment -S -O binary kernel.o kernel.bin

.PHONY: clean
clean:
	rm -fv $(OBJS)
	rm -fv kernel.o
	rm -fv kernel.bin

%.o: %.c
	$(CC) $(CFLAGS) $^ -o $@

%.s.o: %.asm
	$(ASM) $(ASM_FLAGS) $^ -o $@<commit_msg>Properly support additional flags to Makefile<commit_after>ENTRY=kernel_main
ORIGIN=0x10000
OBJS=main.o ports.o a20.o memory.o pit.o pic.o gdt.o tss.o idt.o isr.s.o isr.o syscall.o screen.o panic.o user.s.o pci.o

ASM=nasm
CC=$(CROSS_TARGET)-gcc
LD=$(CROSS_TARGET)-gcc

K_ASM_FLAGS=-f elf
K_CFLAGS=-c -Wall -Wextra -Wpedantic -std=c99 -ffreestanding -I../include -O2
K_LDFLAGS=-s -e $(ENTRY) -Ttext=$(ORIGIN) -nostdlib
ASM_FLAGS=
CFLAGS=
LDFLAGS=

kernel: $(OBJS)
	$(LD) $(K_LDFLAGS) $(LDFLAGS) $^ -o kernel.o
	objcopy -R .note -R .comment -S -O binary kernel.o kernel.bin

.PHONY: clean
clean:
	rm -fv $(OBJS)
	rm -fv kernel.o
	rm -fv kernel.bin

%.o: %.c
	$(CC) $(K_CFLAGS) $(CFLAGS) $^ -o $@

%.s.o: %.asm
	$(ASM) $(K_ASM_FLAGS) $(ASM_FLAGS) $^ -o $@
{'fraction_non_alphanumeric': 0.19142857142857142, 'fraction_numerical': 0.015714285714285715, 'mean_word_length': 3.4903846153846154, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '755385', 'n_tokens_mistral': 685, 'n_tokens_neox': 636, 'n_words': 159}