cross-compile when not building on windows master
authorJohn Tsiombikas <nuclear@member.fsf.org>
Sun, 5 Jan 2020 07:30:31 +0000 (09:30 +0200)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Sun, 5 Jan 2020 07:30:31 +0000 (09:30 +0200)
Makefile

index a2c4f4b..45e6d4d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,17 @@
-src = $(wildcard src/*.c)\r
-obj = $(src:.c=.o)\r
-bin = rawdisktest\r
-\r
-CFLAGS = -pedantic -Wall -g\r
-LDFLAGS = -lsetupapi -luuid\r
-\r
-$(bin): $(obj)\r
-       $(CC) -o $(bin) $(obj) $(LDFLAGS)\r
-\r
-.PHONY: clean\r
-clean:\r
-       rm -f $(obj) $(bin)\r
+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)