Files
rclone/librclone/ctest/Makefile
BizaNator ffdd043b95 librclone/ctest: add Windows support and fix memory management
Make ctest build and run on Windows in addition to Linux/macOS:

- Add OS detection in Makefile using ifeq ($(OS),Windows_NT)
- Use .lib extension and .exe suffix on Windows
- Link Windows system libraries (winmm, ws2_32, ole32)
- Remove unused dlfcn.h include that prevented compilation on Windows

Fix memory management to use RcloneFreeString instead of free for
strings returned by RcloneRPC, as documented in the librclone README.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 10:51:15 +01:00

27 lines
516 B
Makefile

CFLAGS = -g -Wall
ifeq ($(OS),Windows_NT)
EXE = .exe
LIB = librclone.lib
LDFLAGS = -L. -lrclone -lwinmm -lws2_32 -lole32
else
EXE =
LIB = librclone.a
LDFLAGS = -L. -lrclone -lpthread -ldl
endif
ctest$(EXE): ctest.o $(LIB)
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
ctest.o: ctest.c librclone.h
$(CC) $(CFLAGS) -c $^ $(LDFLAGS)
$(LIB) librclone.h:
go build --buildmode=c-archive -o $(LIB) github.com/rclone/rclone/librclone
test: ctest$(EXE)
./ctest$(EXE)
clean:
rm -f tmp ctest ctest.exe *.o *.a *.lib *.h *.gch