-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·57 lines (52 loc) · 2.16 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
prefix ?= /usr/local
UNAME := $(shell uname)
debug:
-mkdir bin
swift build -c debug
$(eval X64_PATH=$(shell swift build -c debug --show-bin-path | tail -n 1))
cp "$(X64_PATH)/lunarcmd" bin/lunarcmd
@echo "\033[32;1mBuild succeeded. To install, run "'`sudo make install`'"\033[0m"
release:
ifeq ($(UNAME), Darwin)
-mkdir bin
swift build --arch x86_64 -c release
@echo "\033[32;1mBuilt for x86_64\033[0m"
swift build --arch arm64 -c release
@echo "\033[32;1mBuilt for arm64\033[0m"
$(eval X64_PATH=$(shell swift build --arch x86_64 -c release --show-bin-path | tail -n 1))
$(eval ARM64_PATH=$(shell swift build --arch arm64 -c release --show-bin-path | tail -n 1))
lipo -create "$(X64_PATH)/lunarcmd" "$(ARM64_PATH)/lunarcmd" -output bin/lunarcmd
@echo "\033[32;1mBuild succeeded. To install, run "'`sudo make install`'"\033[0m"
else
-mkdir bin
swift build -c release --static-swift-stdlib
$(eval X64_PATH=$(shell swift build -c release --show-bin-path | tail -n 1))
cp "$(X64_PATH)/lunarcmd" bin/lunarcmd
@echo "\033[32;1mBuild succeeded. To install, run "'`sudo make install`'"\033[0m"
endif
package:
ifeq ($(UNAME), Darwin)
-mkdir lunarcmd_mac
swift build --arch x86_64 -c release
@echo "\033[32;1mBuilt for x86_64\033[0m"
swift build --arch arm64 -c release
@echo "\033[32;1mBuilt for arm64\033[0m"
$(eval X64_PATH=$(shell swift build --arch x86_64 -c release --show-bin-path | tail -n 1))
$(eval ARM64_PATH=$(shell swift build --arch arm64 -c release --show-bin-path | tail -n 1))
lipo -create "$(X64_PATH)/lunarcmd" "$(ARM64_PATH)/lunarcmd" -output lunarcmd_mac/lunarcmd
zip lunarcmd_mac.zip -r lunarcmd_mac
rm -r lunarcmd_mac
@echo "\033[32;1mBuild succeeded. LunarCmd is in lunarcmd_mac.zip\033[0m"
else
-mkdir lunarcmd_linux
swift build -c release --static-swift-stdlib
$(eval X64_PATH=$(shell swift build -c release --show-bin-path | tail -n 1))
cp "$(X64_PATH)/lunarcmd" lunarcmd_linux/lunarcmd
zip lunarcmd_linux.zip -r lunarcmd_linux
rm -r lunarcmd_linux
@echo "\033[32;1mBuild succeeded. LunarCmd is in lunarcmd_linux.zip\033[0m"
endif
install:
-mkdir "$(prefix)/bin"
cp ./bin/* "$(prefix)/bin/"
@echo "\033[32;1mSuccessfully installed lunarcmd\033[0m"