<commit_before>CXX_FLAGS=-Wall -Werror -ffast-math -O3 -msse

HEADERS = MLVal.h Util.h Var.h Type.h Uniform.h Expr.h Image.h Func.h Rehydrate.h Reduction.h Uniform.h

all: libHalide.a Halide.h

# Set env USE_GPU=1 to build with the GPU target forced.
USE_GPU ?= 0
GPU_CFLAGS = -DUSE_GPU=$(USE_GPU)

CUDA_LIBS ?= -L/usr/local/cuda/lib -lcuda
LLVM_DIR ?= ../llvm/Release+Asserts
LLVM_CONFIG_EXE=$(LLVM_DIR)/bin/llvm-config
LLVM_CFLAGS_CXX=$(shell $(LLVM_CONFIG_EXE) --cflags) -I$(LLVM_DIR)/../include
LLVM_LIBS_CXX=$(shell $(LLVM_CONFIG_EXE) --libs jit bitwriter bitreader x86 arm interpreter linker nvptx ipo)
LLVM_LIBS_C=-lllvm -lllvm_executionengine -lllvm_bitwriter -lllvm_bitreader -lllvm_analysis -lllvm_target

OCAML_LLVM_LIB_DIR=$(LLVM_DIR)/lib/ocaml
OCAML_LIB_DIR=$(shell ocamlc -where)
LLVM_LDFLAGS=$(shell $(LLVM_CONFIG_EXE) --ldflags)
LIBS=$(OCAML_LIBS_C) $(LLVM_LDFLAGS) $(LLVM_LIBS_C) $(LLVM_LIBS_CXX) $(CUDA_LIBS) -ldl -lstdc++

HALIDE_OBJS=$(addprefix _build/,_MLHalide.o MLVal.o Expr.o ExprContents.o Type.o Util.o Image.o Func.o FuncContents.o Var.o Rehydrate.o Reduction.o)

libHalide.a: $(HALIDE_OBJS) ../src/_build/libllsupport_impl.a
	ld -r -o Halide.o $(HALIDE_OBJS) -L$(OCAML_LLVM_LIB_DIR) -L../src/_build -lllsupport_impl -L$(LLVM_DIR)/lib $(LLVM_LIBS_C) $(LLVM_LIBS_CXX) -L$(OCAML_LIB_DIR) -lasmrun -lunix -lcamlstr -lnums -lbigarray
	rm -f libHalide.a
	ar q libHalide.a Halide.o
	ranlib libHalide.a

_build/%.o: %.cpp
	$(CXX) $(CXX_FLAGS) $(GPU_CFLAGS) $(LLVM_CFLAGS_CXX) -I $(OCAML_LIB_DIR) -c $< -o $@

_build/_MLHalide.o: ../src/_build/halide.cmxa
	mkdir -p _build
	ocamlfind ocamlopt -ccopt -O3 -output-obj -linkall -o _build/_MLHalide.o -package sexplib.syntax -linkpkg $(OCAML_LLVM_LIB_DIR)/llvm.cmxa $(OCAML_LLVM_LIB_DIR)/llvm_executionengine.cmxa $(OCAML_LLVM_LIB_DIR)/llvm_bitreader.cmxa ../src/_build/halide.cmxa

../src/_build/halide.cmxa: ../src/*.ml
	make -C ../src lib.native

../src/_build/libllsupport_impl.a: ../src/*.c ../src/architecture.*.cpp ../src/architecture.*.ll
	make -C ../src lib.llsupport

Halide.h: $(HEADERS)
	cat $(HEADERS) | grep -v "include \"" > Halide.h

halide: libHalide.a Halide.h
	mkdir -p halide
	cp Halide.h libHalide.a $@

halide.tgz: halide
	tar zcvf $@ $<

deploy: halide.tgz
	rm -rf halide

clean:
	rm -rf halide/*
	rm -f _build/*
	rm -f libHalide.a Halide.o
<commit_msg>Make cpp_bindings rebuild Halide.h<commit_after>CXX_FLAGS=-Wall -Werror -ffast-math -O3 -msse

HEADERS = MLVal.h Util.h Var.h Type.h Uniform.h Expr.h Image.h Func.h Rehydrate.h Reduction.h Uniform.h

all: libHalide.a Halide.h

# Set env USE_GPU=1 to build with the GPU target forced.
USE_GPU ?= 0
GPU_CFLAGS = -DUSE_GPU=$(USE_GPU)

CUDA_LIBS ?= -L/usr/local/cuda/lib -lcuda
LLVM_DIR ?= ../llvm/Release+Asserts
LLVM_CONFIG_EXE=$(LLVM_DIR)/bin/llvm-config
LLVM_CFLAGS_CXX=$(shell $(LLVM_CONFIG_EXE) --cflags) -I$(LLVM_DIR)/../include
LLVM_LIBS_CXX=$(shell $(LLVM_CONFIG_EXE) --libs jit bitwriter bitreader x86 arm interpreter linker nvptx ipo)
LLVM_LIBS_C=-lllvm -lllvm_executionengine -lllvm_bitwriter -lllvm_bitreader -lllvm_analysis -lllvm_target

OCAML_LLVM_LIB_DIR=$(LLVM_DIR)/lib/ocaml
OCAML_LIB_DIR=$(shell ocamlc -where)
LLVM_LDFLAGS=$(shell $(LLVM_CONFIG_EXE) --ldflags)
LIBS=$(OCAML_LIBS_C) $(LLVM_LDFLAGS) $(LLVM_LIBS_C) $(LLVM_LIBS_CXX) $(CUDA_LIBS) -ldl -lstdc++

HALIDE_OBJS=$(addprefix _build/,_MLHalide.o MLVal.o Expr.o ExprContents.o Type.o Util.o Image.o Func.o FuncContents.o Var.o Rehydrate.o Reduction.o)

libHalide.a: $(HALIDE_OBJS) ../src/_build/libllsupport_impl.a Halide.h
	ld -r -o Halide.o $(HALIDE_OBJS) -L$(OCAML_LLVM_LIB_DIR) -L../src/_build -lllsupport_impl -L$(LLVM_DIR)/lib $(LLVM_LIBS_C) $(LLVM_LIBS_CXX) -L$(OCAML_LIB_DIR) -lasmrun -lunix -lcamlstr -lnums -lbigarray
	rm -f libHalide.a
	ar q libHalide.a Halide.o
	ranlib libHalide.a

_build/%.o: %.cpp
	$(CXX) $(CXX_FLAGS) $(GPU_CFLAGS) $(LLVM_CFLAGS_CXX) -I $(OCAML_LIB_DIR) -c $< -o $@

_build/_MLHalide.o: ../src/_build/halide.cmxa
	mkdir -p _build
	ocamlfind ocamlopt -ccopt -O3 -output-obj -linkall -o _build/_MLHalide.o -package sexplib.syntax -linkpkg $(OCAML_LLVM_LIB_DIR)/llvm.cmxa $(OCAML_LLVM_LIB_DIR)/llvm_executionengine.cmxa $(OCAML_LLVM_LIB_DIR)/llvm_bitreader.cmxa ../src/_build/halide.cmxa

../src/_build/halide.cmxa: ../src/*.ml
	make -C ../src lib.native

../src/_build/libllsupport_impl.a: ../src/*.c ../src/architecture.*.cpp ../src/architecture.*.ll
	make -C ../src lib.llsupport

Halide.h: $(HEADERS)
	cat $(HEADERS) | grep -v "include \"" > Halide.h

halide: libHalide.a Halide.h
	mkdir -p halide
	cp Halide.h libHalide.a $@

halide.tgz: halide
	tar zcvf $@ $<

deploy: halide.tgz
	rm -rf halide

clean:
	rm -rf halide/*
	rm -f _build/*
	rm -f libHalide.a Halide.o

{'fraction_non_alphanumeric': 0.15485787017394995, 'fraction_numerical': 0.002545608824777259, 'mean_word_length': 4.244716351501668, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7181488', 'n_tokens_mistral': 2156, 'n_tokens_neox': 2046, 'n_words': 402}