<commit_before>TOPDIR = $(shell pwd)
ARCH = x86
TARGET=x86_64-hermit

NEWLIB = $(TOPDIR)/$(ARCH)/$(TARGET)
RM = rm -rf
CD = cd
MKDIR = mkdir
TMP = $(TOPDIR)/tmp
OPT = --disable-shared --disable-multilib --enable-newlib-multithread #--disable-newlib-reent-small

# Prettify output
V = 0
ifeq ($V,0)
	Q = @
	P = > /dev/null
endif

default: $(ARCH)
	$Q$(MAKE) -C examples depend
	$Q$(MAKE) -C examples

$(ARCH):
	@echo Build newlib
	$Q$(RM) $(TMP)
	$Q$(MKDIR) $(TMP)
	$Q$(MKDIR) $(TMP)/binutils
	$Q$(CD) $(TMP)/binutils; $(TOPDIR)/binutils/configure --target=$(TARGET) --prefix=$(TOPDIR)/$(ARCH) --disable-shared --disable-nls --disable-gdb --disable-libdecnumber --disable-readline --disable-sim && $(MAKE) && $(MAKE) install
	$Q$(MKDIR) $(TMP)/newlib
	$Q$(CD) $(TMP)/newlib; $(TOPDIR)/src/configure --target=$(TARGET) --prefix=$(TOPDIR)/$(ARCH) $(OPT) && $(MAKE) && $(MAKE) install
	$Q$(MAKE) TARGET=$(TARGET) CFLAGS+="-I. -Iplatform/hermit -ffreestanding -O3 -Wall -I$(NEWLIB)/include -I../../include -I../../arch/$(ARCH)/include" LDFLAGS+="-nostdlib -L$(NEWLIB)/lib" -C pte depend
	$Q$(MAKE) TARGET=$(TARGET) CFLAGS+="-I. -Iplatform/hermit -ffreestanding -O3 -Wall -I$(NEWLIB)/include -I../../include -I../../arch/$(ARCH)/include" LDFLAGS+="-nostdlib -L$(NEWLIB)/lib" -C pte
	$Q$(MKDIR) $(TMP)/gcc
	$Q$(CD) $(TMP)/gcc; $(TOPDIR)/gcc/configure --target=$(TARGET) --prefix=$(TOPDIR)/$(ARCH) --without-headers --with-newlib --enable-languages=c --disable-nls --disable-shared --disable-libssp --enable-threads=single  && $(MAKE) && $(MAKE) install

clean:
	@echo Cleaning newlib
	$Q$(MAKE) -C examples clean
	$Q$(RM) $(TMP)

veryclean:
	@echo Propper cleaning newlib
	$Q$(MAKE) -C pte veryclean
	$Q$(MAKE) -C examples veryclean
	$Q$(RM) $(TOPDIR)/$(ARCH)<commit_msg>add rules to build pte, enable TLS support<commit_after>TOPDIR = $(shell pwd)
ARCH = x86
TARGET=x86_64-hermit

NEWLIB = $(TOPDIR)/$(ARCH)/$(TARGET)
RM = rm -rf
CD = cd
MKDIR = mkdir
TMP = $(TOPDIR)/tmp
OPT = --disable-shared --disable-multilib --enable-newlib-io-c99-formats --enable-newlib-multithread #--enable-newlib-reent-small

# Prettify output
V = 0
ifeq ($V,0)
	Q = @
	P = > /dev/null
endif

default: $(ARCH)
	$Q$(MAKE) TARGET=$(TARGET) CFLAGS+="-I. -Iplatform/hermit -Iplatform/helper -ffreestanding -O3 -Wall -I$(NEWLIB)/include -I../../include" LDFLAGS+="-nostdlib -L$(NEWLIB)/lib" -C pte depend
	$Q$(MAKE) TARGET=$(TARGET) CFLAGS+="-I. -Iplatform/hermit -Iplatform/helper -ffreestanding -O3 -Wall -I$(NEWLIB)/include -I../../include" LDFLAGS+="-nostdlib -L$(NEWLIB)/lib" -C pte
	$Q$(MAKE) CFLAGS+="-mtune=native -O3" -C examples depend
	$Q$(MAKE) CFLAGS+="-mtune=native -O3" -C examples

$(ARCH):
	@echo Build newlib
	$Q$(RM) $(TMP)
	$Q$(MKDIR) $(TMP)
	$Q$(MKDIR) $(TMP)/binutils
	$Q$(CD) $(TMP)/binutils; $(TOPDIR)/binutils/configure --target=$(TARGET) --prefix=$(TOPDIR)/$(ARCH) --disable-shared --disable-nls --disable-gdb --disable-libdecnumber --disable-readline --disable-sim --disable-libssp --enable-tls && $(MAKE) && $(MAKE) install
	$Q$(MKDIR) $(TMP)/newlib
	$Q$(CD) $(TMP)/newlib; $(TOPDIR)/src/configure --target=$(TARGET) --prefix=$(TOPDIR)/$(ARCH) $(OPT) && $(MAKE) && $(MAKE) install
	$Q$(MAKE) TARGET=$(TARGET) CFLAGS+="-O3 -I. -Iplatform/hermit -Iplatform/helper -ffreestanding -O3 -Wall -I$(NEWLIB)/include -I../../include -I../../arch/$(ARCH)/include" LDFLAGS+="-nostdlib -L$(NEWLIB)/lib" -C pte depend
	$Q$(MAKE) TARGET=$(TARGET) CFLAGS+="-O3 -I. -Iplatform/hermit -Iplatform/helper -ffreestanding -O3 -Wall -I$(NEWLIB)/include -I../../include -I../../arch/$(ARCH)/include" LDFLAGS+="-nostdlib -L$(NEWLIB)/lib" -C pte
	$Q$(MKDIR) $(TMP)/gcc
	$Q$(CD) $(TMP)/gcc; $(TOPDIR)/gcc/configure --target=$(TARGET) --prefix=$(TOPDIR)/$(ARCH) --without-headers --with-newlib --enable-languages=c --disable-nls --disable-shared --disable-libssp --enable-threads=posix --enable-tls && $(MAKE) && $(MAKE) install

clean:
	@echo Cleaning newlib
	$Q$(MAKE) -C examples clean
	$Q$(RM) $(TMP)

veryclean:
	@echo Propper cleaning newlib
	$Q$(MAKE) -C pte veryclean
	$Q$(MAKE) -C examples veryclean
	$Q$(RM) $(TOPDIR)/$(ARCH)
{'fraction_non_alphanumeric': 0.23799073396732504, 'fraction_numerical': 0.006827603023652768, 'mean_word_length': 4.045510455104551, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4701678', 'n_tokens_mistral': 1624, 'n_tokens_neox': 1576, 'n_words': 341}