summaryrefslogtreecommitdiff
path: root/example-cross-compile-cpp/Makefile
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2024-07-05 00:26:27 +0200
committerJohannes Stoelp <johannes.stoelp@gmail.com>2024-07-05 00:26:27 +0200
commited6bd7fd5552afc5b8633b77ba13f04da2168a75 (patch)
tree8e72b682ab079ee5d84d1b1ac2d18bce3a74242b /example-cross-compile-cpp/Makefile
parentb07a942993efe44e5dbdff8088b0ed87c79fc433 (diff)
downloadzig-playground-ed6bd7fd5552afc5b8633b77ba13f04da2168a75.tar.gz
zig-playground-ed6bd7fd5552afc5b8633b77ba13f04da2168a75.zip
cross: mini cpp cross compile using zig compiler
Diffstat (limited to 'example-cross-compile-cpp/Makefile')
-rw-r--r--example-cross-compile-cpp/Makefile17
1 files changed, 17 insertions, 0 deletions
diff --git a/example-cross-compile-cpp/Makefile b/example-cross-compile-cpp/Makefile
new file mode 100644
index 0000000..6b904a3
--- /dev/null
+++ b/example-cross-compile-cpp/Makefile
@@ -0,0 +1,17 @@
+riscv64: lin-riscv64
+aarch64: lin-aarch64
+mips64el: lin-mips64el
+
+lin-%:
+ zig build-exe lin.cc -target $*-linux-musl -lc --name $*.elf
+ file $*.elf
+ qemu-$* $*.elf
+
+win:
+ zig build-exe win.cc -target x86_64-windows -lc
+ file win.exe
+ wine win.exe
+
+clean:
+ git clean -fdx .
+