forked from dlang/phobos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
win64.mak
514 lines (430 loc) · 12.3 KB
/
win64.mak
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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
# Makefile to build D runtime library phobos64.lib for Win64
# Prerequisites:
# Microsoft Visual Studio
# Targets:
# make
# Same as make unittest
# make phobos64.lib
# Build phobos64.lib
# make clean
# Delete unneeded files created by build process
# make unittest
# Build phobos64.lib, build and run unit tests
# make phobos32mscoff
# Build phobos32mscoff.lib
# make unittest32mscoff
# Build phobos32mscoff.lib, build and run unit tests
# make cov
# Build for coverage tests, run coverage tests
## Memory model (32 or 64)
MODEL=64
## Copy command
CP=cp
## Directory where dmd has been installed
DIR=\dmd2
## Visual C directories
VCDIR=\Program Files (x86)\Microsoft Visual Studio 10.0\VC
SDKDIR=\Program Files (x86)\Microsoft SDKs\Windows\v7.0A
## Flags for VC compiler
#CFLAGS=/Zi /nologo /I"$(VCDIR)\INCLUDE" /I"$(SDKDIR)\Include"
CFLAGS=/O2 /nologo /I"$(VCDIR)\INCLUDE" /I"$(SDKDIR)\Include"
## Location of druntime tree
DRUNTIME=../druntime
DRUNTIMELIB=$(DRUNTIME)/lib/druntime$(MODEL).lib
## Flags for dmd D compiler
DFLAGS=-conf= -m$(MODEL) -O -release -w -de -dip25 -I$(DRUNTIME)\import
#DFLAGS=-m$(MODEL) -unittest -g
#DFLAGS=-m$(MODEL) -unittest -cov -g
## Flags for compiling unittests
UDFLAGS=-conf= -g -m$(MODEL) -O -w -dip25 -I$(DRUNTIME)\import -unittest
## C compiler, linker, librarian
CC="$(VCDIR)\bin\amd64\cl"
LD="$(VCDIR)\bin\amd64\link"
AR="$(VCDIR)\bin\amd64\lib"
MAKE=make
## D compiler
DMD_DIR=../dmd
BUILD=release
OS=windows
DMD="$(DMD_DIR)/generated/$(OS)/$(BUILD)/$(MODEL)/dmd"
## Zlib library
ZLIB=etc\c\zlib\zlib$(MODEL).lib
.c.obj:
$(CC) -c $(CFLAGS) $*.c
.cpp.obj:
$(CC) -c $(CFLAGS) $*.cpp
.d.obj:
$(DMD) -c $(DFLAGS) $*
.asm.obj:
$(CC) -c $*
LIB=phobos$(MODEL).lib
targets : $(LIB)
test : test.exe
test.obj : test.d
$(DMD) -conf= -c -m$(MODEL) test -g $(UDFLAGS)
test.exe : test.obj $(LIB)
$(DMD) -conf= test.obj -m$(MODEL) -g -L/map
# ti_bit.obj ti_Abit.obj
SRC= \
unittest.d \
index.d
# The separation is a workaround for bug 4904 (optlink bug 3372).
SRC_STD_1= \
std\stdio.d \
std\string.d \
std\format.d \
std\file.d
SRC_STD_2a= \
std\array.d \
std\functional.d \
std\path.d \
std\outbuffer.d \
std\utf.d
SRC_STD_3= \
std\csv.d \
std\complex.d \
std\numeric.d \
std\bigint.d
SRC_STD_3a= \
std\math.d
SRC_STD_3b= \
std\uni.d \
std\base64.d \
std\ascii.d \
std\demangle.d \
std\uri.d \
std\mmfile.d \
std\getopt.d
SRC_STD_3c= \
std\signals.d \
std\meta.d \
std\typetuple.d \
std\traits.d \
std\encoding.d \
std\xml.d \
std\random.d \
std\exception.d \
std\compiler.d \
std\system.d \
std\concurrency.d
SRC_STD_3d= \
std\bitmanip.d \
std\typecons.d
SRC_STD_4= \
std\uuid.d
SRC_STD_6a=std\variant.d
SRC_STD_6c=std\zlib.d
SRC_STD_6e=std\socket.d
SRC_STD_6h=std\conv.d
SRC_STD_6i=std\zip.d
SRC_STD_7= \
std\stdint.d \
std\json.d \
std\parallelism.d \
std\mathspecial.d \
std\process.d
SRC_STD= \
$(SRC_STD_1) \
$(SRC_STD_2a) \
$(SRC_STD_3) \
$(SRC_STD_3a) \
$(SRC_STD_3b) \
$(SRC_STD_3c) \
$(SRC_STD_3d) \
$(SRC_STD_4) \
$(SRC_STD_6a) \
$(SRC_STD_6c) \
$(SRC_STD_6e) \
$(SRC_STD_6h) \
$(SRC_STD_6i) \
$(SRC_STD_7)
SRC_STD_ALGO_1= \
std\algorithm\package.d \
std\algorithm\comparison.d \
std\algorithm\iteration.d \
std\algorithm\mutation.d
SRC_STD_ALGO_2= \
std\algorithm\searching.d \
std\algorithm\setops.d
SRC_STD_ALGO_3= \
std\algorithm\sorting.d \
std\algorithm\internal.d
SRC_STD_ALGO= \
$(SRC_STD_ALGO_1) \
$(SRC_STD_ALGO_2) \
$(SRC_STD_ALGO_3)
SRC_STD_CONTAINER= \
std\container\array.d \
std\container\binaryheap.d \
std\container\dlist.d \
std\container\rbtree.d \
std\container\slist.d \
std\container\util.d \
std\container\package.d
SRC_STD_DATETIME= \
std\datetime\date.d \
std\datetime\interval.d \
std\datetime\package.d \
std\datetime\stopwatch.d \
std\datetime\systime.d \
std\datetime\timezone.d
SRC_STD_DIGEST= \
std\digest\crc.d \
std\digest\sha.d \
std\digest\md.d \
std\digest\ripemd.d \
std\digest\digest.d \
std\digest\hmac.d \
std\digest\murmurhash.d \
std\digest\package.d
SRC_STD_NET= \
std\net\isemail.d \
std\net\curl.d
SRC_STD_RANGE= \
std\range\package.d \
std\range\primitives.d \
std\range\interfaces.d
SRC_STD_REGEX= \
std\regex\internal\ir.d \
std\regex\package.d \
std\regex\internal\parser.d \
std\regex\internal\tests.d \
std\regex\internal\tests2.d \
std\regex\internal\backtracking.d \
std\regex\internal\thompson.d \
std\regex\internal\kickstart.d \
std\regex\internal\generator.d
SRC_STD_WIN= \
std\windows\registry.d \
std\windows\syserror.d \
std\windows\charset.d
SRC_STD_INTERNAL= \
std\internal\cstring.d \
std\internal\unicode_tables.d \
std\internal\unicode_comp.d \
std\internal\unicode_decomp.d \
std\internal\unicode_grapheme.d \
std\internal\unicode_norm.d \
std\internal\scopebuffer.d \
std\internal\test\dummyrange.d \
std\internal\test\range.d
SRC_STD_INTERNAL_DIGEST= \
std\internal\digest\sha_SSSE3.d
SRC_STD_INTERNAL_MATH= \
std\internal\math\biguintcore.d \
std\internal\math\biguintnoasm.d \
std\internal\math\biguintx86.d \
std\internal\math\gammafunction.d \
std\internal\math\errorfunction.d
SRC_STD_INTERNAL_WINDOWS= \
std\internal\windows\advapi32.d
SRC_STD_EXP= \
std\experimental\all.d std\experimental\checkedint.d std\experimental\typecons.d
SRC_STD_EXP_ALLOC_BB= \
std\experimental\allocator\building_blocks\affix_allocator.d \
std\experimental\allocator\building_blocks\aligned_block_list.d \
std\experimental\allocator\building_blocks\allocator_list.d \
std\experimental\allocator\building_blocks\ascending_page_allocator.d \
std\experimental\allocator\building_blocks\bitmapped_block.d \
std\experimental\allocator\building_blocks\bucketizer.d \
std\experimental\allocator\building_blocks\fallback_allocator.d \
std\experimental\allocator\building_blocks\free_list.d \
std\experimental\allocator\building_blocks\free_tree.d \
std\experimental\allocator\building_blocks\kernighan_ritchie.d \
std\experimental\allocator\building_blocks\null_allocator.d \
std\experimental\allocator\building_blocks\quantizer.d \
std\experimental\allocator\building_blocks\region.d \
std\experimental\allocator\building_blocks\scoped_allocator.d \
std\experimental\allocator\building_blocks\segregator.d \
std\experimental\allocator\building_blocks\stats_collector.d \
std\experimental\allocator\building_blocks\package.d
SRC_STD_EXP_ALLOC= \
std\experimental\allocator\common.d \
std\experimental\allocator\gc_allocator.d \
std\experimental\allocator\mallocator.d \
std\experimental\allocator\mmap_allocator.d \
std\experimental\allocator\showcase.d \
std\experimental\allocator\typed.d \
std\experimental\allocator\package.d \
$(SRC_STD_EXP_ALLOC_BB)
SRC_STD_EXP_LOGGER= \
std\experimental\logger\core.d \
std\experimental\logger\filelogger.d \
std\experimental\logger\multilogger.d \
std\experimental\logger\nulllogger.d \
std\experimental\logger\package.d
SRC_ETC=
SRC_ETC_C= \
etc\c\zlib.d \
etc\c\curl.d \
etc\c\sqlite3.d \
etc\c\odbc\sql.d \
etc\c\odbc\sqlext.d \
etc\c\odbc\sqltypes.d \
etc\c\odbc\sqlucode.d
SRC_TO_COMPILE= \
$(SRC_STD) \
$(SRC_STD_ALGO) \
$(SRC_STD_CONTAINER) \
$(SRC_STD_DATETIME) \
$(SRC_STD_DIGEST) \
$(SRC_STD_NET) \
$(SRC_STD_RANGE) \
$(SRC_STD_REGEX) \
$(SRC_STD_C) \
$(SRC_STD_WIN) \
$(SRC_STD_C_WIN) \
$(SRC_STD_INTERNAL) \
$(SRC_STD_INTERNAL_DIGEST) \
$(SRC_STD_INTERNAL_MATH) \
$(SRC_STD_INTERNAL_WINDOWS) \
$(SRC_STD_EXP) \
$(SRC_STD_EXP_ALLOC) \
$(SRC_STD_EXP_LOGGER) \
$(SRC_ETC) \
$(SRC_ETC_C)
SRC_ZLIB= \
etc\c\zlib\crc32.h \
etc\c\zlib\deflate.h \
etc\c\zlib\gzguts.h \
etc\c\zlib\inffixed.h \
etc\c\zlib\inffast.h \
etc\c\zlib\inftrees.h \
etc\c\zlib\inflate.h \
etc\c\zlib\trees.h \
etc\c\zlib\zconf.h \
etc\c\zlib\zlib.h \
etc\c\zlib\zutil.h \
etc\c\zlib\adler32.c \
etc\c\zlib\compress.c \
etc\c\zlib\crc32.c \
etc\c\zlib\deflate.c \
etc\c\zlib\example.c \
etc\c\zlib\gzclose.c \
etc\c\zlib\gzlib.c \
etc\c\zlib\gzread.c \
etc\c\zlib\gzwrite.c \
etc\c\zlib\infback.c \
etc\c\zlib\inffast.c \
etc\c\zlib\inflate.c \
etc\c\zlib\inftrees.c \
etc\c\zlib\minigzip.c \
etc\c\zlib\trees.c \
etc\c\zlib\uncompr.c \
etc\c\zlib\zutil.c \
etc\c\zlib\algorithm.txt \
etc\c\zlib\zlib.3 \
etc\c\zlib\ChangeLog \
etc\c\zlib\README \
etc\c\zlib\win32.mak \
etc\c\zlib\win64.mak \
etc\c\zlib\linux.mak \
etc\c\zlib\osx.mak
$(LIB) : $(SRC_TO_COMPILE) \
$(ZLIB) $(DRUNTIMELIB) win32.mak win64.mak
$(DMD) -lib -of$(LIB) -Xfphobos.json $(DFLAGS) $(SRC_TO_COMPILE) \
$(ZLIB) $(DRUNTIMELIB)
UNITTEST_OBJS= \
unittest1.obj \
unittest2.obj \
unittest2a.obj \
unittest3.obj \
unittest3a.obj \
unittest3b.obj \
unittest3c.obj \
unittest3d.obj \
unittest4.obj \
unittest5a.obj \
unittest5b.obj \
unittest5c.obj \
unittest6a.obj \
unittest6c.obj \
unittest6e.obj \
unittest6g.obj \
unittest6h.obj \
unittest6i.obj \
unittest7.obj \
unittest8a.obj \
unittest8b.obj \
unittest8c.obj \
unittest8d.obj \
unittest8e.obj \
unittest8f.obj \
unittest9.obj
unittest : $(LIB)
$(DMD) $(UDFLAGS) -c -ofunittest1.obj $(SRC_STD_1)
$(DMD) $(UDFLAGS) -c -ofunittest2.obj $(SRC_STD_RANGE)
$(DMD) $(UDFLAGS) -c -ofunittest2a.obj $(SRC_STD_2a)
$(DMD) $(UDFLAGS) -c -ofunittest3.obj $(SRC_STD_3)
$(DMD) $(UDFLAGS) -c -ofunittest3a.obj $(SRC_STD_3a)
$(DMD) $(UDFLAGS) -c -ofunittest3b.obj $(SRC_STD_3b)
$(DMD) $(UDFLAGS) -c -ofunittest3c.obj $(SRC_STD_3c)
$(DMD) $(UDFLAGS) -c -ofunittest3d.obj $(SRC_STD_3d) $(SRC_STD_DATETIME)
$(DMD) $(UDFLAGS) -c -ofunittest4.obj $(SRC_STD_4) $(SRC_STD_DIGEST)
$(DMD) $(UDFLAGS) -c -ofunittest5a.obj $(SRC_STD_ALGO_1)
$(DMD) $(UDFLAGS) -c -ofunittest5b.obj $(SRC_STD_ALGO_2)
$(DMD) $(UDFLAGS) -c -ofunittest5c.obj $(SRC_STD_ALGO_3)
$(DMD) $(UDFLAGS) -c -ofunittest6a.obj $(SRC_STD_6a)
$(DMD) $(UDFLAGS) -c -ofunittest6c.obj $(SRC_STD_6c)
$(DMD) $(UDFLAGS) -c -ofunittest6e.obj $(SRC_STD_6e)
$(DMD) $(UDFLAGS) -c -ofunittest6g.obj $(SRC_STD_CONTAINER)
$(DMD) $(UDFLAGS) -c -ofunittest6h.obj $(SRC_STD_6h)
$(DMD) $(UDFLAGS) -c -ofunittest6i.obj $(SRC_STD_6i)
$(DMD) $(UDFLAGS) -c -ofunittest7.obj $(SRC_STD_7) $(SRC_STD_EXP_LOGGER)
$(DMD) $(UDFLAGS) -c -ofunittest8a.obj $(SRC_STD_REGEX)
$(DMD) $(UDFLAGS) -c -ofunittest8b.obj $(SRC_STD_NET)
$(DMD) $(UDFLAGS) -c -ofunittest8c.obj $(SRC_STD_C) $(SRC_STD_WIN) $(SRC_STD_C_WIN)
$(DMD) $(UDFLAGS) -c -ofunittest8d.obj $(SRC_STD_INTERNAL) $(SRC_STD_INTERNAL_DIGEST) $(SRC_STD_INTERNAL_MATH) $(SRC_STD_INTERNAL_WINDOWS)
$(DMD) $(UDFLAGS) -c -ofunittest8e.obj $(SRC_ETC) $(SRC_ETC_C)
$(DMD) $(UDFLAGS) -c -ofunittest8f.obj $(SRC_STD_EXP)
$(DMD) $(UDFLAGS) -c -ofunittest9.obj $(SRC_STD_EXP_ALLOC)
$(DMD) $(UDFLAGS) -L/OPT:NOICF unittest.d $(UNITTEST_OBJS) \
$(ZLIB) $(DRUNTIMELIB)
.\unittest.exe
#unittest : unittest.exe
# unittest
#
#unittest.exe : unittest.d $(LIB)
# $(DMD) -conf= unittest -g
# dmc unittest.obj -g
cov : $(SRC_TO_COMPILE) $(LIB)
$(DMD) -conf= -m$(MODEL) -cov $(UDFLAGS) -ofcov.exe unittest.d $(SRC_TO_COMPILE) $(LIB)
cov
################### Win32 COFF support #########################
# default to 32-bit compiler relative to the location of the 64-bit compiler,
# link and lib are architecture agnostic
CC32=$(CC)\..\..\cl
# build phobos32mscoff.lib
phobos32mscoff:
$(MAKE) -f win64.mak "DMD=$(DMD)" "MAKE=$(MAKE)" MODEL=32mscoff "CC=\$(CC32)"\"" "AR=\$(AR)"\"" "VCDIR=$(VCDIR)" "SDKDIR=$(SDKDIR)"
# run unittests for 32-bit COFF version
unittest32mscoff:
$(MAKE) -f win64.mak "DMD=$(DMD)" "MAKE=$(MAKE)" MODEL=32mscoff "CC=\$(CC32)"\"" "AR=\$(AR)"\"" "VCDIR=$(VCDIR)" "SDKDIR=$(SDKDIR)" unittest
######################################################
$(ZLIB): $(SRC_ZLIB)
cd etc\c\zlib
$(MAKE) -f win64.mak MODEL=$(MODEL) zlib$(MODEL).lib "CC=\$(CC)"\"" "LIB=\$(AR)"\"" "VCDIR=$(VCDIR)"
cd ..\..\..
######################################################
zip:
del phobos.zip
zip32 -r phobos.zip . -x .git\* -x \*.lib -x \*.obj
phobos.zip : zip
clean:
cd etc\c\zlib
$(MAKE) -f win64.mak MODEL=$(MODEL) clean
cd ..\..\..
del $(DOCS)
del $(UNITTEST_OBJS) unittest.obj unittest.exe
del $(LIB)
del phobos.json
install: phobos.zip
$(CP) phobos.lib phobos64.lib $(DIR)\windows\lib
+rd/s/q $(DIR)\src\phobos
unzip -o phobos.zip -d $(DIR)\src\phobos
auto-tester-build: targets
JOBS=$(NUMBER_OF_PROCESSORS)
GMAKE=gmake
auto-tester-test:
$(GMAKE) -j$(JOBS) -f posix.mak unittest BUILD=release DMD="$(DMD)" OS=win$(MODEL) \
CUSTOM_DRUNTIME=1 PIC=0 MODEL=$(MODEL) DRUNTIME=$(DRUNTIMELIB) CC=$(CC)