diff --git a/devLib/Makefile b/devLib/Makefile index cf665d6..8a1e60c 100644 --- a/devLib/Makefile +++ b/devLib/Makefile @@ -36,8 +36,20 @@ DYNAMIC=libwiringPiDev.so.$(VERSION) #DEBUG = -g -O0 DEBUG = -O2 -CC = gcc -INCLUDE = -I. + +GCC_ARCH := $(shell gcc -dumpmachine) + +ifeq ($(OS),Windows_NT) + CROSS_COMPILE ?= arm-linux-gnueabihf- +else + ifneq ($(GCC_ARCH),arm-linux-gnueabihf) + CROSS_COMPILE ?= arm-linux-gnueabihf- + endif +endif + +CC = $(CROSS_COMPILE)gcc + +INCLUDE = -I. -I/usr/local/include DEFS = -D_GNU_SOURCE CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC diff --git a/gpio/Makefile b/gpio/Makefile index 9ec160d..af8eedc 100644 --- a/gpio/Makefile +++ b/gpio/Makefile @@ -32,7 +32,19 @@ endif #DEBUG = -g -O0 DEBUG = -O2 -CC = gcc + +GCC_ARCH := $(shell gcc -dumpmachine) + +ifeq ($(OS),Windows_NT) + CROSS_COMPILE ?= arm-linux-gnueabihf- +else + ifneq ($(GCC_ARCH),arm-linux-gnueabihf) + CROSS_COMPILE ?= arm-linux-gnueabihf- + endif +endif + +CC = $(CROSS_COMPILE)gcc + INCLUDE = -I$(DESTDIR)$(PREFIX)/include CFLAGS = $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe diff --git a/wiringPi/Makefile b/wiringPi/Makefile index 287fa58..eb770c8 100644 --- a/wiringPi/Makefile +++ b/wiringPi/Makefile @@ -36,7 +36,19 @@ DYNAMIC=libwiringPi.so.$(VERSION) #DEBUG = -g -O0 DEBUG = -O2 -CC = gcc + +GCC_ARCH := $(shell gcc -dumpmachine) + +ifeq ($(OS),Windows_NT) + CROSS_COMPILE ?= arm-linux-gnueabihf- +else + ifneq ($(GCC_ARCH),arm-linux-gnueabihf) + CROSS_COMPILE ?= arm-linux-gnueabihf- + endif +endif + +CC = $(CROSS_COMPILE)gcc + INCLUDE = -I. DEFS = -D_GNU_SOURCE CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Winline $(INCLUDE) -pipe -fPIC diff --git a/wiringPiD/Makefile b/wiringPiD/Makefile index 6b2cc9e..e71c2e4 100644 --- a/wiringPiD/Makefile +++ b/wiringPiD/Makefile @@ -31,7 +31,19 @@ endif #DEBUG = -g -O0 DEBUG = -O2 -CC = gcc + +GCC_ARCH := $(shell gcc -dumpmachine) + +ifeq ($(OS),Windows_NT) + CROSS_COMPILE ?= arm-linux-gnueabihf- +else + ifneq ($(GCC_ARCH),arm-linux-gnueabihf) + CROSS_COMPILE ?= arm-linux-gnueabihf- + endif +endif + +CC = $(CROSS_COMPILE)gcc + INCLUDE = -I$(DESTDIR)$(PREFIX)/include CFLAGS = $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe