-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
77 lines (63 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
.PHONY: all clean
PROJECT=SmartTank
SOURCEDIR=src
SOURCE=$(wildcard $(SOURCEDIR)/*.cs) $(wildcard $(SOURCEDIR)/*/*.cs) $(wildcard $(SOURCEDIR)/*.csproj)
ASSETDIR=assets
ICONS=$(wildcard $(ASSETDIR)/*.png)
CONFIGS=$(wildcard $(ASSETDIR)/*.cfg) $(wildcard $(ASSETDIR)/*.ltp)
LANGUAGES=$(ASSETDIR)/lang
README=README.md
GAMELINK=$(SOURCEDIR)/KSP_Data
PROCPARTSLINK=$(SOURCEDIR)/ProceduralParts
DEFAULTGAMEDIR=$(HOME)/.local/share/Steam/steamapps/common/Kerbal Space Program
DEBUGDLL=$(SOURCEDIR)/bin/Debug/$(PROJECT).dll
RELEASEDLL=$(SOURCEDIR)/bin/Release/$(PROJECT).dll
DISTDIR=$(PROJECT)
RELEASEZIP=$(PROJECT).zip
DLLDOCS=$(SOURCEDIR)/bin/Release/$(PROJECT).xml
DLLSYMBOLS=$(SOURCEDIR)/bin/Debug/$(PROJECT).pdb
LICENSE=LICENSE
INTERNALCKAN=$(PROJECT).ckan
VERSION=$(PROJECT).version
TAGS=tags
TARGETS=$(DEBUGDLL) $(RELEASEDLL) $(RELEASEZIP)
all: $(TAGS) $(TARGETS)
$(TAGS): $(SOURCE)
ctags -f $@ $^
$(DLLSYMBOLS): $(DEBUGDLL)
$(DLLDOCS): $(RELEASEDLL)
$(DEBUGDLL): $(SOURCE) $(GAMELINK) $(PROCPARTSLINK)
cd $(SOURCEDIR) && msbuild /p:Configuration=Debug
$(RELEASEDLL): $(SOURCE) $(GAMELINK) $(PROCPARTSLINK)
cd $(SOURCEDIR) && msbuild /p:Configuration=Release
$(RELEASEZIP): $(RELEASEDLL) $(ICONS) $(README) $(LICENSE) $(INTERNALCKAN) $(VERSION) $(CONFIGS) $(LANGUAGES)
mkdir -p $(DISTDIR)
cp -a $^ $(DISTDIR)
zip -qr $@ $(DISTDIR) -x \*.settings
$(PROCPARTSLINK):
if [ ! -x "$(DEFAULTGAMEDIR)" ]; \
then \
echo "$(PROCPARTSLINK) not found."; \
echo 'This must be a symlink to the folder where ProceduralParts is installed.'; \
exit 2; \
elif [ ! -d "$(DEFAULTGAMEDIR)/GameData/ProceduralParts" ]; \
then \
echo "ProceduralParts is not installed at $(DEFAULTGAMEDIR)."; \
echo "It is a prerequisite for this mod."; \
exit 2; \
else \
ln -s "$(DEFAULTGAMEDIR)"/GameData/ProceduralParts $(PROCPARTSLINK); \
fi
$(GAMELINK):
if [ -d "$(DEFAULTGAMEDIR)" ]; \
then \
ln -s "$(DEFAULTGAMEDIR)"/KSP_Data $(GAMELINK); \
else \
echo "$(GAMELINK) 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 $(TARGETS) $(TAGS)
rm -rf $(SOURCEDIR)/bin $(SOURCEDIR)/obj $(DISTDIR)