summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile7
-rw-r--r--flake.nix13
2 files changed, 17 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index c73c09e..c1283d4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,5 @@
+EXE ?= pit
+
CC ?= gcc
AR ?= ar
CHK_SOURCES ?= src/main.c $(SRCS)
@@ -13,7 +15,6 @@ LIB_CORE := libcolonq-pit.a
SRCS_NATIVE := src/native.c
OBJECTS_NATIVE := $(SRCS_NATIVE:src/%.c=$(BUILD)/%.o)
LIB_NATIVE := libcolonq-pit-native.a
-EXE := pit
prefix ?= /usr/local
exec_prefix ?= $(prefix)
@@ -29,10 +30,10 @@ $(EXE): $(BUILD)/main.o $(LIB_NATIVE) $(LIB_CORE)
$(CC) -o $@ $^ $(LDFLAGS)
$(LIB_CORE): $(OBJECTS_CORE)
- ar rcs $@ $^
+ $(AR) rcs $@ $^
$(LIB_NATIVE): $(OBJECTS_NATIVE)
- ar rcs $@ $^
+ $(AR) rcs $@ $^
$(BUILD):
mkdir $(BUILD)/
diff --git a/flake.nix b/flake.nix
index 8312ec9..f000caf 100644
--- a/flake.nix
+++ b/flake.nix
@@ -34,11 +34,24 @@
make CC=wasm32-clang prefix=$out install-core
'';
};
+ pit-windows = pkgs.pkgsCross.mingwW64.stdenv.mkDerivation {
+ pname = "pit";
+ version = "git";
+ src = ./.;
+ hardeningDisable = ["all"];
+ buildPhase = ''
+ make CC=x86_64-w64-mingw32-cc AR=x86_64-w64-mingw32-ar EXE=pit.exe
+ '';
+ installPhase = ''
+ make CC=x86_64-w64-mingw32-cc AR=x86_64-w64-mingw32-ar EXE=pit.exe prefix=$out install
+ '';
+ };
in {
packages = {
inherit pit;
default = pit;
wasm = pit-wasm;
+ windows = pit-windows;
};
devShells.default = pkgs.mkShell {
hardeningDisable = ["all"];