win32 Makefile for i2ccl.exe

This commit is contained in:
James Bowman 2019-02-27 07:54:22 -08:00
parent 9ad4dcda3a
commit 2831dba645
4 changed files with 31 additions and 2 deletions

View File

@ -3,7 +3,9 @@
#include <assert.h> #include <assert.h>
#include <memory.h> #include <memory.h>
#include <fcntl.h> #include <fcntl.h>
#if !defined(WIN32)
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#define __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS

5
c/go
View File

@ -2,9 +2,10 @@ set -e
rm -rf build/* rm -rf build/*
make -f linux/Makefile make -f linux/Makefile
build/i2ccl /dev/ttyUSB0 i # build/i2ccl /dev/ttyUSB0 i d
# build/i2ccl /dev/ttyUSB0 w 0x48 3 r 0x48 2
# make -f win32/Makefile make -f win32/Makefile
# cp build/spicl.exe /data/win10/ # cp build/spicl.exe /data/win10/
# #
# rm -f win32gui/obj/* win32gui/bin/Win32App.exe # rm -f win32gui/obj/* win32gui/bin/Win32App.exe

8
c/win32/Makefile Normal file
View File

@ -0,0 +1,8 @@
CC = /usr/bin/i686-w64-mingw32-g++
CFLAGS += -I common -static-libgcc -static-libstdc++
all: build/i2ccl.exe
build/i2ccl.exe: win32/i2c.c common/i2cdriver.c
mkdir -p build/
$(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $^

18
c/win32/i2c.c Normal file
View File

@ -0,0 +1,18 @@
#include <stdio.h>
#include <stdlib.h>
#include "i2cdriver.h"
int main(int argc, char *argv[])
{
I2CDriver sd;
if (argc < 2) {
printf("Usage: i2ccl <PORTNAME> <commands>\n");
exit(1);
} else {
i2c_connect(&sd, argv[1]);
if (!sd.connected)
exit(1);
return i2c_commands(&sd, argc - 2, argv + 2);
}
}