Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions minichlink/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ H_S:=cmdserver.h funconfig.h hidapi.h libusb.h microgdbstub.h minichlink.h seria
# gdb-multilib {file}
# target remote :2345

CFLAGS_WINDOWS:=-Os -s -Wall -D_WIN32_WINNT=0x0600 -I. -Wall -DCH32V003 -DMINICHLINK
LDFLAGS_WINDOWS:=-L. -lpthread -lusb-1.0 -lsetupapi -lws2_32
ifeq ($(OS),Windows_NT)
TOOLS:=minichlink.exe
TOOLS:=minichlink minichlink.dll
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this need to be minichlink.exe?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above comment

CFLAG:=-Os -s -Wall -D_WIN32_WINNT=0x0600 -I. -Wall -DCH32V003 -DMINICHLINK
LDFLAGS:=-L. -lpthread -lusb-1.0 -lsetupapi -lws2_32
else
OS_NAME := $(shell uname -s | tr A-Z a-z)
ifeq ($(OS_NAME),linux)
Expand Down Expand Up @@ -39,18 +39,14 @@ endif

all : $(TOOLS)

# will need mingw-w64-x86-64-dev gcc-mingw-w64-x86-64
minichlink.exe : $(C_S) $(H_S) Makefile
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does the .exe get generated in the new version?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make on windows will actually handle this for us. Not specifying an extension leads to generating an exe.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise commands like rm minichlink will delete minichlink.exe. I can only assume this is intentionally done by mingw devs

x86_64-w64-mingw32-gcc -o $@ $(C_S) $(LDFLAGS_WINDOWS) $(CFLAGS_WINDOWS)
minichlink : $(C_S) $(H_S)
$(CC) -o $@ $(C_S) $(LDFLAGS) $(CFLAGS) $(INCS)

minichlink : $(C_S) $(H_S) Makefile
gcc -o $@ $(C_S) $(LDFLAGS) $(CFLAGS) $(INCS)
minichlink.so : $(C_S) $(H_S)
$(CC) -o $@ $(C_S) $(LDFLAGS) $(CFLAGS) $(INCS) -shared -fPIC

minichlink.so : $(C_S) $(H_S) Makefile
gcc -o $@ $(C_S) $(LDFLAGS) $(CFLAGS) $(INCS) -shared -fPIC

minichlink.dll : $(C_S) $(H_S) Makefile
x86_64-w64-mingw32-gcc -o $@ $(C_S) $(LDFLAGS_WINDOWS) $(CFLAGS_WINDOWS) $(INCS) -shared -DMINICHLINK_AS_LIBRARY
minichlink.dll : $(C_S) $(H_S)
$(CC) -o $@ $(C_S) $(LDFLAGS) $(CFLAGS) $(INCS) -shared -DMINICHLINK_AS_LIBRARY

install_udev_rules :
cp 99-minichlink.rules /etc/udev/rules.d/
Expand All @@ -62,4 +58,4 @@ inspect_bootloader : minichlink
riscv64-unknown-elf-objdump -S -D test.bin -b binary -m riscv:rv32 | less

clean :
rm -rf $(TOOLS) minichlink.exe
rm -rf $(TOOLS) minichlink.exe