mirror of
https://github.com/Droid-MAX/SNANDer
synced 2026-07-09 22:00:53 +00:00
- Add LIBS_BASE variable to build-for-darwin.sh for homebrew libusb path detection - Add __APPLE__ to platform macros in ch347_spi.c and ch347_i2c.c for macOS support - Add CH347F_IFACE (interface 4) for CH347F devices on macOS/Linux - Dynamically select correct USB interface based on device PID (CH347F vs CH347T) Tested on macOS with CH347F reading W25Q128FV SPI NOR Flash successfully.
31 lines
526 B
Bash
Executable File
31 lines
526 B
Bash
Executable File
#!/bin/sh
|
|
|
|
PWD=$(pwd)
|
|
SRC_DIR=$PWD/src
|
|
BUILD_DIR=$PWD/build
|
|
|
|
prepare_dirs(){
|
|
if [ ! -d $BUILD_DIR ]; then
|
|
mkdir -p $BUILD_DIR || exit 1
|
|
fi
|
|
return 0
|
|
}
|
|
|
|
build_target(){
|
|
LIBUSB_PREFIX=$(brew --prefix libusb 2>/dev/null || echo "/opt/homebrew/opt/libusb")
|
|
make -C $SRC_DIR TARGET_OS=Darwin LIBS_BASE=$LIBUSB_PREFIX strip && mv $SRC_DIR/snander $BUILD_DIR
|
|
make -C $SRC_DIR clean
|
|
return 0
|
|
}
|
|
|
|
#clean_all(){
|
|
# if [ -d $BUILD_DIR ]; then
|
|
# rm -rf $BUILD_DIR || exit 1
|
|
# fi
|
|
# return 0
|
|
#}
|
|
|
|
prepare_dirs
|
|
build_target
|
|
#clean_all
|