librclone: export the rclone RC as a C library #4891

This commit is contained in:
lewisxy
2021-04-28 16:55:08 +01:00
committed by Nick Craig-Wood
parent 4401d180aa
commit 316e65589b
3 changed files with 187 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
CFLAGS = -g -Wall
LDFLAGS = -L. -lrclone -lpthread -ldl
static: ctest
shared:
go build --buildmode=c-shared -o librclone.so github.com/rclone/rclone/librclone
ctest: ctest.o librclone.h
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
ctest.o: ctest.c librclone.h
$(CC) $(CFLAGS) -c $^ $(LDFLAGS)
build:
go build
librclone.h:
go build --buildmode=c-archive -o librclone.a github.com/rclone/rclone/librclone
clean:
rm -f tmp ctest *.o *.a *.h *.gch