-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
72 lines (52 loc) · 1.73 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
.PHONY: all clean install-dev test s3-deps
PROJECT:=PlanningNode
SOURCEDIR:=Source
SOURCE:=$(wildcard $(SOURCEDIR)/*.cs $(SOURCEDIR)/*/*.cs $(SOURCEDIR)/*.csproj)
GAMELINK:=$(SOURCEDIR)/KSP_Data
DEFAULTGAMEDIR:=$(HOME)/.local/share/Steam/steamapps/common/Kerbal\ Space\ Program
DISTDIR:=GameData/$(PROJECT)
STATICS:=$(wildcard $(DISTDIR)/* $(DISTDIR)/*/*)
DLL:=$(DISTDIR)/Plugins/$(PROJECT).dll
ZIP:=$(PROJECT).zip
TESTINGDIR:=$(DEFAULTGAMEDIR)/GameData/$(PROJECT)
all: $(ZIP)
$(ZIP): $(DLL) $(STATICS)
cd $(SOURCEDIR) && msbuild /t:MakeZip
$(DLL): $(GAMELINK) $(SOURCE)
cd $(SOURCEDIR) && msbuild /r
$(GAMELINK):
@if [ -x $(DEFAULTGAMEDIR) ]; \
then \
ln -s $(DEFAULTGAMEDIR)/KSP_Data $@; \
else \
echo "$@ not found."; \
echo 'This must be a symlink to Kerbal Space Program/KSP_Data.'; \
exit 2; \
fi
clean:
cd $(SOURCEDIR) && msbuild /t:Clean
rm -f *.gpg
install-dev: $(TESTINGDIR)
$(TESTINGDIR):
ln -sf "$$(pwd)/$(DISTDIR)" "$(DEFAULTGAMEDIR)/GameData"
test: $(TESTINGDIR) $(DLL)
steam steam://rungameid/220200
ifdef GITHUB_TOKEN
# These use = instead of := to avoid setting them if DEFAULTGAMEDIR doesn't exist
KSP_VERSION=$(shell egrep -o '^Version [0-9]+\.[0-9]+' "$(DEFAULTGAMEDIR)"/readme.txt | awk '{print $$2}')
DEP_FILE=KSP_Data-$(KSP_VERSION).tar.gz.gpg
KSP_DEPENDS=$(shell hxselect -c -s '\n' HintPath < $(SOURCEDIR)/$(PROJECT).csproj | tr '\\' /)
$(DEP_FILE): $(GAMELINK)
mkdir -p KSP_Data/Managed
for F in $(KSP_DEPENDS); do cp -a "$(SOURCEDIR)/$$F" KSP_Data/Managed ; done
tar czf - KSP_Data | gpg --batch --passphrase $$GITHUB_TOKEN -c > $@
rm -r KSP_Data
ifdef AWS_ACCESS_KEY_ID
ifdef AWS_SECRET_ACCESS_KEY
ifdef AWS_DEFAULT_REGION
s3-deps: $(DEP_FILE)
aws s3 cp $^ s3://hebarusan/$^
endif
endif
endif
endif