-
Notifications
You must be signed in to change notification settings - Fork 267
/
Makefile
118 lines (103 loc) · 3.53 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
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
MyProductName = "SSHFS-Win"
MyCompanyName = "Navimatics LLC"
MyDescription = "SSHFS for Windows"
MyProductVersion = "2021.1 Beta2"
MyProductStage = "Beta"
MyVersion = 3.7.$(shell date '+%y%j')
ifeq ($(shell uname -m),x86_64)
MyArch = x64
else
MyArch = x86
endif
CertIssuer = "DigiCert"
CrossCert = "DigiCert High Assurance EV Root CA.crt"
PrjDir = $(shell pwd)
BldDir = .build/$(MyArch)
DistDir = $(BldDir)/dist
SrcDir = $(BldDir)/src
RootDir = $(BldDir)/root
WixDir = $(BldDir)/wix
Status = $(BldDir)/status
BinExtra= ssh #bash ls mount
export PATH := $(shell cygpath -au "$$WIX")/bin:$(PATH)
goal: $(Status) $(Status)/done
$(Status):
mkdir -p $(Status)
$(Status)/done: $(Status)/dist
touch $(Status)/done
$(Status)/dist: $(Status)/wix
mkdir -p $(DistDir)
cp $(shell cygpath -aw $(WixDir)/sshfs-win-$(MyVersion)-$(MyArch).msi) $(DistDir)
tools/signtool sign \
/ac tools/$(CrossCert) \
/i $(CertIssuer) \
/n $(MyCompanyName) \
/d $(MyDescription) \
/fd sha1 \
/t http://timestamp.digicert.com \
'$(shell cygpath -aw $(DistDir)/sshfs-win-$(MyVersion)-$(MyArch).msi)' || \
echo "SIGNING FAILED! The product has been successfully built, but not signed." 1>&2
touch $(Status)/dist
$(Status)/wix: $(Status)/sshfs-win sshfs-win.wxs
mkdir -p $(WixDir)
cp sshfs-win.wxs $(WixDir)/
candle -nologo -arch $(MyArch) -pedantic\
-dMyProductName=$(MyProductName)\
-dMyCompanyName=$(MyCompanyName)\
-dMyDescription=$(MyDescription)\
-dMyProductVersion=$(MyProductVersion)\
-dMyProductStage=$(MyProductStage)\
-dMyVersion=$(MyVersion)\
-dMyArch=$(MyArch)\
-o "$(shell cygpath -aw $(WixDir)/sshfs-win.wixobj)"\
"$(shell cygpath -aw $(WixDir)/sshfs-win.wxs)"
heat dir $(shell cygpath -aw $(RootDir))\
-nologo -dr INSTALLDIR -cg C.Main -srd -ke -sreg -gg -sfrag\
-o $(shell cygpath -aw $(WixDir)/root.wxs)
candle -nologo -arch $(MyArch) -pedantic\
-dMyProductName=$(MyProductName)\
-dMyCompanyName=$(MyCompanyName)\
-dMyDescription=$(MyDescription)\
-dMyProductVersion=$(MyProductVersion)\
-dMyProductStage=$(MyProductStage)\
-dMyVersion=$(MyVersion)\
-dMyArch=$(MyArch)\
-o "$(shell cygpath -aw $(WixDir)/root.wixobj)"\
"$(shell cygpath -aw $(WixDir)/root.wxs)"
light -nologo\
-o $(shell cygpath -aw $(WixDir)/sshfs-win-$(MyVersion)-$(MyArch).msi)\
-ext WixUIExtension\
-b $(RootDir)\
$(shell cygpath -aw $(WixDir)/root.wixobj)\
$(shell cygpath -aw $(WixDir)/sshfs-win.wixobj)
touch $(Status)/wix
$(Status)/sshfs-win: $(Status)/root sshfs-win.c
gcc -o $(RootDir)/bin/sshfs-win sshfs-win.c
strip $(RootDir)/bin/sshfs-win
touch $(Status)/sshfs-win
$(Status)/root: $(Status)/make
mkdir -p $(RootDir)/{bin,dev/{mqueue,shm},etc}
(cygcheck $(SrcDir)/sshfs/build/sshfs; for f in $(BinExtra); do cygcheck /usr/bin/$$f; done) |\
tr -d '\r' | tr '\\' / | xargs cygpath -au | grep '^/usr/bin/' | sort | uniq |\
while read f; do cp $$f $(RootDir)/bin; done
cp $(SrcDir)/sshfs/build/sshfs $(RootDir)/bin
strip $(RootDir)/bin/sshfs
for f in $(BinExtra); do cp /usr/bin/$$f $(RootDir)/bin; done
cp -R $(PrjDir)/etc $(RootDir)
touch $(Status)/root
$(Status)/make: $(Status)/config
cd $(SrcDir)/sshfs/build && ninja
touch $(Status)/make
$(Status)/config: $(Status)/patch
mkdir -p $(SrcDir)/sshfs/build
cd $(SrcDir)/sshfs/build && meson ..
touch $(Status)/config
$(Status)/patch: $(Status)/clone
cd $(SrcDir)/sshfs && for f in $(PrjDir)/patches/*.patch; do patch --binary -p1 <$$f; done
touch $(Status)/patch
$(Status)/clone:
mkdir -p $(SrcDir)
git clone $(PrjDir)/sshfs $(SrcDir)/sshfs
touch $(Status)/clone
clean:
git clean -dffx