Browse Source

Add target to compile windows executable

DricomDragon 4 years ago
parent
commit
7d02ae4e4f
1 changed files with 11 additions and 2 deletions
  1. 11 2
      makefile

+ 11 - 2
makefile

@@ -1,7 +1,16 @@
 linux-artifact-name = hello-linux.out
+win-artifact-name = hello-windows.exe
+
+linux-compiler = g++
+
+# Embed c and c++ libraries (see https://stackoverflow.com/a/6405064)
+win-compiler = i686-w64-mingw32-g++-win32 -static-libstdc++ -static-libgcc
 
 $(linux-artifact-name): main.cpp
-	g++ main.cpp -o $(linux-artifact-name)
+	$(linux-compiler) main.cpp -o $(linux-artifact-name)
+
+$(win-artifact-name): main.cpp
+	$(win-compiler) main.cpp -o $(win-artifact-name)
 
 clean:
-	rm $(linux-artifact-name)
+	rm $(linux-artifact-name) $(win-artifact-name)