From: John Tsiombikas Date: Sun, 5 Jan 2020 07:30:31 +0000 (+0200) Subject: cross-compile when not building on windows X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=rawdisktest;a=commitdiff_plain cross-compile when not building on windows --- diff --git a/Makefile b/Makefile index a2c4f4b..45e6d4d 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,17 @@ -src = $(wildcard src/*.c) -obj = $(src:.c=.o) -bin = rawdisktest - -CFLAGS = -pedantic -Wall -g -LDFLAGS = -lsetupapi -luuid - -$(bin): $(obj) - $(CC) -o $(bin) $(obj) $(LDFLAGS) - -.PHONY: clean -clean: - rm -f $(obj) $(bin) +src = $(wildcard src/*.c) +obj = $(src:.c=.o) +bin = rawdisktest.exe + +CFLAGS = -pedantic -Wall -g +LDFLAGS = -lsetupapi -luuid + +ifneq ($(shell uname -s | sed 's/MINGW.*/mingw/'), mingw) + CC = i686-w64-mingw32-gcc +endif + +$(bin): $(obj) + $(CC) -o $(bin) $(obj) $(LDFLAGS) + +.PHONY: clean +clean: + rm -f $(obj) $(bin)