-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathMakefile
305 lines (251 loc) · 8.42 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
###############################################################################
# NFS makefile (requires Cygwin and GNU make)
#
# Rules of note:
#
# - make the 32-bit and 64-bit versions
# $ make all ...other make args, see below...
#
# - make release candidate 2:
# $ make all release_suffix=rc2
#
# - make demo and non-demo versions:
# $ make clean dist dist-demo LISPDIR=/c/acl90.patched
#
# - remove tag to build without changing version #:
# $ make delete_tag release_suffix=rc1
#
###############################################################################
# chosen because it seems to work on thor and for spr42738
#ACL_BUILD_ACLMALLOC_HEAP_START = 0x8ab0000
DO_MAKEFILE_LOCAL := $(shell if test -f Makefile.local; then echo yes; fi)
ifeq ($(DO_MAKEFILE_LOCAL),yes)
include Makefile.local
endif
NEWSDKDIR = /c/Program Files (x86)/Windows Kits/10/bin/x86
NEWSDK = $(shell if test -d "$(NEWSDKDIR)"; then echo yes; else echo no; fi)
ifeq ($(NEWSDK),yes)
FICODESIGN = ficodesign
# Add the directory containing "signtool.exe" to PATH so scm-bin/ficodesign can find it
PATH := $(PATH):$(NEWSDKDIR)
endif
# The variable NFSWIDTH specifies a 64bit version;
VCREDIST ?= $(shell if test "$(NFSWIDTH)" = "64"; then echo x64; else echo x86; fi)
defaultlisp = $(shell if test "$(NFSWIDTH)" = "64"; then echo .64.patched; else echo .patched; fi)
LISPDIR ?= /c/acl10.1$(defaultlisp)
LISPEXE = $(LISPDIR)/mlisp
MAKENSIS ?= "/cygdrive/c/Program Files (x86)/NSIS/makensis.exe"
# The variable VER_SUFFIX specifies a modifier appended to the
# name of the installer and to the name of the installed application.
version := $(shell ./anfs-version)
default: build
# use `dists' because `dist dist-demo' does not work.. see comment below
# near `dists' for why.
all:
$(MAKE) $(MFLAGS) clean dists NFSWIDTH=64 NFSLISPBSW=yes VER_SUFFIX=-64
$(MAKE) $(MFLAGS) clean dists
$(MAKE) $(MFLAGS) tag FORCE=$(FORCE)
MODULES = demoware:master
prereqs: FORCE
@bin/verify_modules.sh $(MODULES)
ifdef release_suffix
tag_name = nfs-$(version)-$(release_suffix)
else
tag_name = nfs-$(version)
endif
check_tag_name: FORCE
ifndef FORCE
@if git tag | grep -q '^$(tag_name)$$'; then \
echo ERROR: git tag $(tag_name) already exists; \
exit 1; \
else \
echo '**** TAG: $(tag_name)'; \
fi
endif
commit-id.cl: FORCE
echo -n '(defvar *nfsd-commit-id* "' > commit-id.cl
echo -n `git log -n1 --pretty=format:%H HEAD` >> commit-id.cl
echo -n '")' >> commit-id.cl
tag: FORCE
git.sh tag -a -m $(tag_name) $(FORCE) $(tag_name) HEAD
@echo NOTE: do this to push the tag:
@echo git.sh push origin $(tag_name)
delete_tag: FORCE
git.sh tag -d $(tag_name)
git.sh push origin :refs/tags/$(tag_name)
build: check_cpp
$(MAKE) $(MFLAGS) do_build
check_cpp: FORCE
@if ! which cpp > /dev/null 2>&1; then \
echo Error: cpp not installed.; \
exit 1; \
fi
build-demo: FORCE
$(MAKE) $(MFLAGS) DEMOWARE=xxx do_build
ifdef ACL_BUILD_ACLMALLOC_HEAP_START
env = env ACL_BUILD_ACLMALLOC_HEAP_START=$(ACL_BUILD_ACLMALLOC_HEAP_START)
else
env =
endif
do_build: prereqs commit-id.cl
# make sure the demo and non-demo versions do not share fasls:
rm -fr nfs *.fasl b.tmp build.out
echo '(dribble "build.out")' >> b.tmp
echo '(setq excl::*break-on-warnings* t)' >> b.tmp
ifdef DEMOWARE
echo '(push :nfs-demo *features*)' >> b.tmp
endif
# The variable NFSLISPBSW specifies byte swap in Lisp instead of machine instr.
ifdef NFSLISPBSW
echo '(push :nfs-lisp-bsw *features*)' >> b.tmp
endif
echo '(load "load.cl")' >> b.tmp
echo '(buildit)' >> b.tmp
echo '(dribble)' >> b.tmp
echo '(exit 0)' >> b.tmp
$(env) $(LISPEXE) +B +cn +s b.tmp -batch
rm -f b.tmp
if test -f nfs.cfg; then cp -p nfs.cfg nfs; fi
rm -fr nfs/system-dlls
if test ! -f nfs/vcredist_$(VCREDIST).exe; then \
cp -p "$(LISPDIR)/vcredist_$(VCREDIST).exe" nfs/; \
fi
$(MAKE) -C configure 'LISPDIR=$(LISPDIR)'
# Forcibly rebuild the configure program
configure: FORCE
rm -fr configure/configure
$(MAKE) -C configure 'LISPDIR=$(LISPDIR)'
installer-common: FORCE
rm -f nfs/nfs.cfg
rm -fr nfs/configure
cp -pr configure/configure nfs
mkdir -p dists
EXE = dists/setup-nfs-$(version)$(VER_SUFFIX).exe
DEMOEXE = dists/setup-nfs-$(version)$(VER_SUFFIX)-demo.exe
ifeq ($(NFSWIDTH),64)
INSTALLDIR = AllegroNFS64
else
INSTALLDIR = AllegroNFS
endif
COMMON_INSTALLER_OPTIONS = /DINSTALLDIR=$(INSTALLDIR)
installer: installer-common
$(MAKENSIS) /V1 $(COMMON_INSTALLER_OPTIONS) \
/DVERSION=$(version)$(VER_SUFFIX) \
/DVERSION2=$(version)$(VER_SUFFIX) \
nfs.nsi
ifdef FICODESIGN
$(FICODESIGN) $(EXE)
endif
sha256sum $(EXE) > $(EXE).sha256sum
installer-demo: installer-common
$(MAKENSIS) /V1 $(COMMON_INSTALLER_OPTIONS) \
/DNFSDEMO=true \
/DVERSION="$(version)$(VER_SUFFIX) Demo" \
/DVERSION2=$(version)$(VER_SUFFIX)-demo \
nfs.nsi
ifdef FICODESIGN
$(FICODESIGN) $(DEMOEXE)
endif
sha256sum $(DEMOEXE) > $(DEMOEXE).sha256sum
# Each build runs in a separate make because there are some
# shared dependencies.. and make will merge them .. and we don't
# want that. Specifically, ``installer-common'' will be run once
# instead of twice.
#
# `clean' added to make sure that configure is really rebuilt. There
# was evidence in June of 2011 that this wasn't happening. -Kevin/Elliott
dists: clean check_tag_name
@if grep -q '^(pushnew :nfs-' load.cl && ! grep -q 'nfsd-version.*beta' nfs-common.cl; then \
echo ERROR: debugging features enabled for production build; \
exit 1; \
fi
$(MAKE) $(MFLAGS) dist
$(MAKE) $(MFLAGS) dist-demo
dist: build installer
dist-demo: build-demo installer-demo
# Alias
demo-dist: dist-demo
DEST = ../nfs-outgoing/$(tag_name)
publish: FORCE
mkdir -p $(DEST)
$(MAKE) $(MFLAGS) NFSWIDTH=64 NFSLISPBSW=yes VER_SUFFIX=-64 publish_aux
$(MAKE) $(MFLAGS) publish_aux
publish_aux: FORCE
cp -p $(EXE) $(DEST)
cp -p $(EXE).sha256sum $(DEST)
cp -p $(DEMOEXE) $(DEST)
cp -p $(DEMOEXE).sha256sum $(DEST)
###############################################################################
# testing
# Needs the tirpc Cygwin package on Windows
exe := $(shell test -d c:/ && echo .exe)
hammer_deps = \
test/hammernfs-libs/mount_xdr.c \
test/hammernfs-libs/mount_clnt.c \
test/hammernfs-libs/nfs_clnt.c \
test/hammernfs-libs/nfs_xdr.c \
test/nfs-common.c
# $@ is the target and $< is the first dependency.
define build_test_program
cc -O -o $@ \
$(shell uname | grep -q CYGWIN && echo -I/usr/include/tirpc) \
$< \
$(hammer_deps) \
$(shell uname | grep -q CYGWIN && echo -ltirpc)
endef
hammernfs$(exe): test/hammernfs.c $(hammer_deps)
$(build_test_program)
test-conn-reset$(exe): test/test-conn-reset.c $(hammer_deps)
$(build_test_program)
test-big-readdir-udp$(exe): test/test-big-readdir-udp.c $(hammer_deps)
$(build_test_program)
test-nfs-low$(exe): test/test-nfs-low.c $(hammer_deps)
$(build_test_program)
perftest: FORCE
test/performance.sh test/performance.log.$(version)
$(LISPEXE) -L test/performance.cl
testnfs: test/testnfs.c
cc -O -o testnfs test/testnfs.c
results: FORCE
@prev=; for v in $$(cd results; echo *); do \
if [ "$$prev" ]; then \
test/results.cl $$prev $$v; \
fi; \
prev=$$v; \
done
# The following 3 variables must be set externally to specify
# the current test machine configuration.
LOCAL_TEST_DIR ?= /home/tmp/layer/nfs.test
REMOTE_TEST_DIR ?= /c/tmp/nfs.test
TEST_HOST ?= thunder
TEST_NFSPATH = /net/$(TEST_HOST)/nfs.test
###### times for various iterations:
# 1 iteration takes ~75 seconds.
# 240 iterations takes ~5.5 hours.
# 600 iterations takes ~13 hours.
STRESS_ITERATIONS ?= 600
# Each test gets progressively longer
runtests: testnfs test-nfs-low
date
./test-nfs-low $(TEST_HOST):/c
# test/misc-tests.sh $(TEST_HOST) /net/$(TEST_HOST)/c
# The above test does not always work because of Win10 permission issues.
./test/misc-tests.sh $(TEST_HOST) $(TEST_NFSPATH) $(REMOTE_TEST_DIR)
./testnfs -l $(LOCAL_TEST_DIR) -t $(REMOTE_TEST_DIR) \
$(TEST_HOST) $(TEST_NFSPATH)
./test/bigfile-test.sh $(LOCAL_TEST_DIR) $(TEST_NFSPATH)
./test/stress-test.sh $(LOCAL_TEST_DIR) $(TEST_NFSPATH) \
$(STRESS_ITERATIONS)
date
###############################################################################
# misc
echo_version: FORCE
@echo $(version)
clean: FORCE
rm -rf *.out *.fasl */*.fasl *.zip *.tmp nfs *~ .*~
rm -f gen-nfs-*.cl mount-*.cl sunrpc-common.cl nlm-*.cl nsm-*.cl
rm -f portmap-*.cl hammernfs$(exe) test-conn-reset$(exe) test-big-readdir-udp$(exe)
$(MAKE) -C configure clean
tags: FORCE
find . -name "*.cl" | xargs etags
FORCE: