forked from leezer3/OpenBVE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
129 lines (104 loc) · 3.22 KB
/
makefile
File metadata and controls
129 lines (104 loc) · 3.22 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# C-Sharp Compiler
HAS_MSBUILD := $(shell command -v msbuild 2> /dev/null)
ifdef HAS_MSBUILD
MSBUILD := msbuild
endif
ifndef HAS_MSBUILD
MSBUILD := xbuild
endif
# Directories
DEBUG_DIR := bin_debug
RELEASE_DIR := bin_release
OUTPUT_DIR := $(DEBUG_DIR)
# Final output names
MAC_BUILD_RESULT = macbuild.dmg
LINUX_BUILD_RESULT = linuxbuild.zip
DEBIAN_BUILD_RESULT = debianbuild.deb
# Used output name
ifeq ($(shell uname -s),Darwin)
BUILD_RESULT = $(MAC_BUILD_RESULT)
else
BUILD_RESULT = $(LINUX_BUILD_RESULT)
endif
# Colors
COLOR_BLACK := "\033[1;30m"
COLOR_RED := "\033[1;31m"
COLOR_GREEN := "\033[1;32m"
COLOR_YELLOW := "\033[1;33m"
COLOR_BLUE := "\033[1;34m"
COLOR_MAGENTA := "\033[1;35m"
COLOR_CYAN := "\033[1;36m"
COLOR_WHITE := "\033[1;37m"
COLOR_END := "\033[0m"
.PHONY: all
.PHONY: all-debug
.PHONY: all-release
.PHONY: debug
.PHONY: release
.PHONY: clean
.PHONY: clean-all
.PHONY: openbve
.PHONY: openbve-debug
.PHONY: openbve-release
.PHONY: publish
.PHONY: debian
.PHONY: restore
restore:
nuget restore OpenBVE.sln
debug: openbve-debug
release: openbve-release
openbve: openbve-debug
openbve-debug: restore
$(MSBUILD) /t:OpenBve /p:Configuration=Debug OpenBVE.sln
openbve-release: restore
$(MSBUILD) /t:OpenBve /p:Configuration=Release OpenBVE.sln
all: all-debug
all-debug: restore
$(MSBUILD) /t:build /p:Configuration=Debug OpenBVE.sln
all-release: restore
$(MSBUILD) /t:build /p:Configuration=Release OpenBVE.sln
clean-all: clean
clean:
$(MSBUILD) /t:clean /p:Configuration=Debug OpenBVE.sln
$(MSBUILD) /t:clean /p:Configuration=Release OpenBVE.sln
# Release Files
rm -f $(MAC_BUILD_RESULT) $(LINUX_BUILD_RESULT)
CP_UPDATE_FLAG = -u
CP_RECURSE = -r
ifeq ($(shell uname -s),Darwin)
CP_UPDATE_FLAG =
CP_RECURSE = -R
endif
ifeq ($(shell uname -s),Darwin)
publish: $(MAC_BUILD_RESULT)
else
publish: $(LINUX_BUILD_RESULT)
endif
debian: $(DEBIAN_BUILD_RESULT)
$(MAC_BUILD_RESULT): all-release
@rm -rf bin_release/DevTools/
@echo $(COLOR_RED)Decompressing $(COLOR_CYAN)installers/mac/MacBundle.tgz$(COLOR_END)
# Clear previous Mac build temporary files if they exist
@rm -rf mac
@rm -rf macbuild.dmg
@mkdir mac
@tar -C mac -xzf installers/mac/MacBundle.tgz
@echo $(COLOR_RED)Copying build data into $(COLOR_CYAN)OpenBVE.app$(COLOR_END)
@cp -r $(RELEASE_DIR)/* mac/OpenBVE.app/Contents/Resources/
@echo $(COLOR_RED)Creating $(COLOR_CYAN)$(MAC_BUILD_RESULT)$(COLOR_END)
@hdiutil create $(MAC_BUILD_RESULT) -volname "OpenBVE" -fs HFS+ -srcfolder "mac/OpenBVE.app"
$(LINUX_BUILD_RESULT): all-release
@rm -rf bin_release/DevTools/
@echo $(COLOR_RED)Compressing $(COLOR_CYAN)$(LINUX_BUILD_RESULT)$(COLOR_END)
@cd $(RELEASE_DIR); zip -qr9Z deflate ../$(LINUX_BUILD_RESULT) *
$(DEBIAN_BUILD_RESULT): all-release
@rm -rf bin_release/DevTools/
@echo $(COLOR_RED)Copying build into place....$(COLOR_END)
@mkdir -p installers/debian/usr/lib/openbve
#Generate current dpkg control file
@./DebianControl.sh
#Mark launch script as executable before packaging
@chmod +x installers/debian/usr/games/openbve
@cp -r -f $(CP_UPDATE_FLAG) $(RELEASE_DIR)/* installers/debian/usr/lib/openbve
@echo $(COLOR_RED)Compressing $(COLOR_CYAN)$(DEBIAN_BUILD_RESULT)$(COLOR_END)
@fakeroot dpkg-deb --build installers/debian