diff --git a/bindings/c/.gitignore b/bindings/c/.gitignore index b6211651bd2..567609b1234 100644 --- a/bindings/c/.gitignore +++ b/bindings/c/.gitignore @@ -1,2 +1 @@ -tests/hello -tests/hello.o +build/ diff --git a/bindings/c/Makefile b/bindings/c/Makefile new file mode 100644 index 00000000000..6f58eed1d99 --- /dev/null +++ b/bindings/c/Makefile @@ -0,0 +1,37 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +RPATH=$(PWD)/../../target/debug +CFLAGS = -I./include +LDFLAGS = -L$(RPATH) -Wl,-rpath,$(RPATH) +LIBS = -lopendal +OBJ_DIR=build/ + +all: $(OBJ_DIR) build test + +$(OBJ_DIR): + mkdir -p $@ + +build: + cargo build + +test: + $(CC) tests/hello.c -o $(OBJ_DIR)/hello $(CFLAGS) $(LDFLAGS) $(LIBS) + +clean: + cargo clean + rm -rf $(OBJ_DIR) diff --git a/bindings/c/README.md b/bindings/c/README.md new file mode 100644 index 00000000000..adbcf1e21e4 --- /dev/null +++ b/bindings/c/README.md @@ -0,0 +1,13 @@ +# OpenDAL C Binding (WIP) + +# Build C bindings + +```bash +make +make build +make test +``` + +## License + +[Apache v2.0](https://www.apache.org/licenses/LICENSE-2.0) diff --git a/bindings/c/tests/Makefile b/bindings/c/tests/Makefile deleted file mode 100644 index 9ea33ad9d29..00000000000 --- a/bindings/c/tests/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# -# Build the example client -# - -RPATH=$(PWD)/../../../target/debug -CFLAGS = -I../include -LDFLAGS = -L$(RPATH) -Wl,-rpath,$(RPATH) -LIBS = -lopendal - -all: build - -build: - $(CC) hello.c -o hello $(CFLAGS) $(LDFLAGS) $(LIBS)