Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Add script distinct for linux and windows
Browse files Browse the repository at this point in the history
PATCH
  • Loading branch information
Saverio976 committed Nov 29, 2023
1 parent 41afc13 commit 1e29723
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,24 @@
TARGET = koaky
MARVIN_TARGET = glados

CP = cp
RM = rm -rf

ifeq ($(OS),Windows_NT)
CP = Copy-Item
RM = Remove-Item -Force -Recurse
BIN_STACK = $(TARGET)-exe.exe
BIN_TARGET = $(TARGET).exe
SHELL = command.exe
else
CP = cp
RM = rm -rf
BIN_STACK = $(TARGET)-exe
BIN_TARGET = $(TARGET)
endif

all: $(TARGET)

$(TARGET):
stack build
ifeq ($(OS),Windows_NT)
$(CP) "(stack path --local-install-root)/bin/$(BIN_STACK)" "$(BIN_TARGET)"
./scripts/Build.ps1
else
$(CP) "$(shell stack path --local-install-root)/bin/$(BIN_STACK)" "$(BIN_TARGET)"
./scripts/Build.sh
endif
$(CP) "$(BIN_TARGET)" "$(MARVIN_TARGET)"

Expand Down
8 changes: 8 additions & 0 deletions scripts/Build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$binStack = $args[0]
$binTarget = $args[1]

stack build

$pathLocalRoot = stack path --local-install-root

Copy-Item "$pathLocalRoot/bin/$binStack" "$binTarget"
8 changes: 8 additions & 0 deletions scripts/Build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

BIN_STACK="$1"
BIN_TARGET="$2"

stack build

cp "$(stack path --local-install-root)/bin/$BIN_STACK" "$BIN_TARGET"

0 comments on commit 1e29723

Please sign in to comment.