<commit_before>#
# XXX compiling user progs with -mcmodel=kernel
#

# Custom config file?  Otherwise use defaults.
-include config.mk
Q          ?= @
TOOLPREFIX ?= x86_64-jos-elf-
QEMU 	   ?= qemu-system-x86_64
QEMUSMP	   ?= 4
QEMUSRC    ?= ../mtrace
MTRACE	   ?= $(QEMU)
HW	   ?= qemu

O  = o.$(HW)
CC = $(TOOLPREFIX)gcc
AS = $(TOOLPREFIX)gas
LD = $(TOOLPREFIX)ld
NM = $(TOOLPREFIX)nm
OBJCOPY = $(TOOLPREFIX)objcopy

CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -O2 -Wall -MD -ggdb \
	 -m64 -Werror -std=c99 -fms-extensions -mno-sse -mcmodel=large -I$(QEMUSRC) \
	 -fno-omit-frame-pointer -DHW_$(HW) -include param.h
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
ASFLAGS = -m64 -gdwarf-2
LDFLAGS += -m elf_x86_64

OBJS = \
	bio.o \
	bonsai.o \
	cga.o \
	condvar.o \
	console.o \
	exec.o \
	file.o \
	fs.o \
	ioapic.o \
	lapic.o \
	hwvm.o \
	hz.o \
	kalloc.o \
	kbd.o \
	main.o \
	memide.o \
	mp.o \
	ns.o \
	picirq.o \
	pipe.o \
	proc.o \
	prof.o \
	gc.o \
	sampler.o \
	sched.o \
	spinlock.o \
	swtch.o \
	string.o \
	syscall.o \
	sysfile.o \
	sysproc.o \
	uart.o \
	vm.o \
	trap.o \
	trapasm.o \
	wq.o \
	incbin.o
OBJS := $(addprefix $(O)/, $(OBJS))

ULIB = ulib.o usys.o printf.o umalloc.o uthread.o
ULIB := $(addprefix $(O)/, $(ULIB))

UPROGS= \
	_cat \
	_init \
	_forkexectree \
	_forkexecbench \
	_forktree \
	_ls \
	_mapbench \
	_maptest \
	_sh \
	_thrtest
UPROGS := $(addprefix $(O)/, $(UPROGS))

$(O)/kernel: $(O) $(O)/boot.o $(OBJS)
	@echo "  LD     $@"
	$(Q)$(LD) $(LDFLAGS) -T kernel.ld -z max-page-size=4096 -e start \
		-o $@ $(O)/boot.o $(OBJS)

$(O):
	$(Q)mkdir $(O)

$(O)/%.o: %.c
	@echo "  CC     $@"
	$(Q)$(CC) $(CFLAGS) -c -o $@ $<

$(O)/incbin.o: ASFLAGS+=-DMAKE_OUT=$(O)
$(O)/incbin.o: $(O)/initcode $(O)/bootother $(O)/fs.img
$(O)/%.o: %.S
	@echo "  CC     $@"
	$(Q)$(CC) $(ASFLAGS) -c -o $@ $<

$(O)/initcode: TTEXT = 0x0
$(O)/bootother: TTEXT = 0x7000
$(O)/%: %.S
	@echo "  CC     $@"
	$(Q)$(CC) $(CFLAGS) -nostdinc -I. -c $< -o $@.o
	$(Q)$(LD) $(LDFLAGS) -N -e start -Ttext $(TTEXT) -o $@.out $@.o
	$(Q)$(OBJCOPY) -S -O binary $@.out $@
<commit_msg>include halt to exit out of qemu<commit_after>#
# XXX compiling user progs with -mcmodel=kernel
#

# Custom config file?  Otherwise use defaults.
-include config.mk
Q          ?= @
TOOLPREFIX ?= x86_64-jos-elf-
QEMU 	   ?= qemu-system-x86_64
QEMUSMP	   ?= 4
QEMUSRC    ?= ../mtrace
MTRACE	   ?= $(QEMU)
HW	   ?= qemu

O  = o.$(HW)
CC = $(TOOLPREFIX)gcc
AS = $(TOOLPREFIX)gas
LD = $(TOOLPREFIX)ld
NM = $(TOOLPREFIX)nm
OBJCOPY = $(TOOLPREFIX)objcopy

CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -O2 -Wall -MD -ggdb \
	 -m64 -Werror -std=c99 -fms-extensions -mno-sse -mcmodel=large -I$(QEMUSRC) \
	 -fno-omit-frame-pointer -DHW_$(HW) -include param.h
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
ASFLAGS = -m64 -gdwarf-2
LDFLAGS += -m elf_x86_64

OBJS = \
	bio.o \
	bonsai.o \
	cga.o \
	condvar.o \
	console.o \
	exec.o \
	file.o \
	fs.o \
	ioapic.o \
	lapic.o \
	hwvm.o \
	hz.o \
	kalloc.o \
	kbd.o \
	main.o \
	memide.o \
	mp.o \
	ns.o \
	picirq.o \
	pipe.o \
	proc.o \
	prof.o \
	gc.o \
	sampler.o \
	sched.o \
	spinlock.o \
	swtch.o \
	string.o \
	syscall.o \
	sysfile.o \
	sysproc.o \
	uart.o \
	vm.o \
	trap.o \
	trapasm.o \
	wq.o \
	incbin.o
OBJS := $(addprefix $(O)/, $(OBJS))

ULIB = ulib.o usys.o printf.o umalloc.o uthread.o
ULIB := $(addprefix $(O)/, $(ULIB))

UPROGS= \
	_cat \
	_init \
	_forkexectree \
	_forkexecbench \
	_forktree \
	_ls \
	_mapbench \
	_maptest \
	_sh \
	_thrtest \
	_halt
UPROGS := $(addprefix $(O)/, $(UPROGS))

$(O)/kernel: $(O) $(O)/boot.o $(OBJS)
	@echo "  LD     $@"
	$(Q)$(LD) $(LDFLAGS) -T kernel.ld -z max-page-size=4096 -e start \
		-o $@ $(O)/boot.o $(OBJS)

$(O):
	$(Q)mkdir $(O)

$(O)/%.o: %.c
	@echo "  CC     $@"
	$(Q)$(CC) $(CFLAGS) -c -o $@ $<

$(O)/incbin.o: ASFLAGS+=-DMAKE_OUT=$(O)
$(O)/incbin.o: $(O)/initcode $(O)/bootother $(O)/fs.img
$(O)/%.o: %.S
	@echo "  CC     $@"
	$(Q)$(CC) $(ASFLAGS) -c -o $@ $<

$(O)/initcode: TTEXT = 0x0
$(O)/bootother: TTEXT = 0x7000
$(O)/%: %.S
	@echo "  CC     $@"
	$(Q)$(CC) $(CFLAGS) -nostdinc -I. -c $< -o $@.o
	$(Q)$(LD) $(LDFLAGS) -N -e start -Ttext $(TTEXT) -o $@.out $@.o
	$(Q)$(OBJCOPY) -S -O binary $@.out $@

{'fraction_non_alphanumeric': 0.22809040590405905, 'fraction_numerical': 0.015682656826568265, 'mean_word_length': 2.3750972762645914, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '7257448', 'n_tokens_mistral': 2249, 'n_tokens_neox': 2140, 'n_words': 445}