forked from MuMech/MechJeb2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
85 lines (66 loc) · 2.15 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
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
# Makefile for building MechJeb
ifeq ($(OS),Windows_NT)
# do 'Doze stuff
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
XDG_DATA_HOME := ${HOME}/.local/share
KSPDIR := ${XDG_DATA_HOME}/Steam/SteamApps/common/Kerbal Space Program
MANAGED := ${KSPDIR}/KSP_Data/Managed/
endif
ifeq ($(UNAME_S),Darwin)
KSPDIR := ${HOME}/Library/Application Support/Steam/SteamApps/common/Kerbal Space Program
MANAGED := ${KSPDIR}/KSP.app/Contents/Data/Managed/
endif
endif
MECHJEBFILES := $(wildcard MechJeb2/*.cs) \
$(wildcard MechJeb2/Maneuver/*.cs) \
$(wildcard MechJeb2/Properties/*.cs) \
$(wildcard MechJeb2/alglib/*.cs)
RESGEN2 := resgen2
GMCS := gmcs
GIT := git
TAR := tar
ZIP := zip
VERSION := $(shell ${GIT} describe --tags --always)
all: build
info:
@echo "== MechJeb2 Build Information =="
@echo " resgen2: ${RESGEN2}"
@echo " gmcs: ${GMCS}"
@echo " git: ${GIT}"
@echo " tar: ${TAR}"
@echo " zip: ${ZIP}"
@echo " KSP Data: ${KSPDIR}"
@echo "================================"
build: build/MechJeb2.dll
build/%.dll: ${MECHJEBFILES}
mkdir -p build
${RESGEN2} -usesourcepath MechJeb2/Properties/Resources.resx build/Resources.resources
${GMCS} -t:library -lib:"${MANAGED}" \
-r:Assembly-CSharp,Assembly-CSharp-firstpass,UnityEngine \
-out:$@ \
${MECHJEBFILES} \
-resource:build/Resources.resources,MuMech.Properties.Resources.resources
package: build ${MECHJEBFILES}
mkdir -p package/MechJeb2/Plugins
cp -r Parts package/MechJeb2/
cp build/MechJeb2.dll package/MechJeb2/Plugins/
cp LICENSE.md README.md package/MechJeb2/
%.tar.gz:
${TAR} zcf $@ package/MechJeb2
tar.gz: package MechJeb-${VERSION}.tar.gz
%.zip:
${ZIP} -9 -r $@ package/MechJeb2
zip: package MechJeb-${VERSION}.zip
clean:
@echo "Cleaning up build and package directories..."
rm -rf build/ package/
install: build
mkdir -p "${KSPDIR}"/GameData/MechJeb2/Plugins
cp -r Parts "${KSPDIR}"/GameData/MechJeb2/
cp build/MechJeb2.dll "${KSPDIR}"/GameData/MechJeb2/Plugins/
uninstall: info
rm -rf "${KSPDIR}"/GameData/MechJeb2/Plugins
rm -rf "${KSPDIR}"/GameData/MechJeb2/Parts
.PHONY : all info build package tar.gz zip clean install uninstall