Skip to content

Commit 18bb597

Browse files
authored
Merge pull request #8482 from kinke/cleanup_win64.mak
Somewhat clean up win64.mak
2 parents a4a18d2 + d8f3b19 commit 18bb597

2 files changed

Lines changed: 19 additions & 47 deletions

File tree

etc/c/zlib/win64.mak

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# Makefile for zlib64
22

33
MODEL=64
4-
VCDIR=\Program Files (x86)\Microsoft Visual Studio 10.0\VC
54

6-
CC=$(VCDIR)\bin\amd64\cl
7-
LD=$(VCDIR)\bin\amd64\link
8-
LIB=$(VCDIR)\bin\amd64\lib
5+
CC=cl
6+
LD=link
7+
AR=lib
98

10-
CFLAGS=/O2 /nologo /I"$(VCDIR)\INCLUDE"
9+
CFLAGS=/O2 /nologo
1110
LIBFLAGS=/nologo
1211
LDFLAGS=/nologo
1312
O=.obj
@@ -21,7 +20,7 @@ OBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) gzclose$(O) gzlib$(O) gzre
2120
gzwrite$(O) infback$(O) inffast$(O) inflate$(O) inftrees$(O) trees$(O) uncompr$(O) zutil$(O)
2221

2322

24-
all: zlib64.lib example.exe infcover.exe minigzip.exe
23+
all: zlib$(MODEL).lib example.exe infcover.exe minigzip.exe
2524

2625
adler32.obj: zutil.h zlib.h zconf.h
2726
"$(CC)" /c $(CFLAGS) $*.c
@@ -80,7 +79,7 @@ minigzip.obj: test\minigzip.c zlib.h zconf.h
8079
"$(CC)" /c $(cvarsdll) $(CFLAGS) test\$*.c
8180

8281
zlib$(MODEL).lib: $(OBJS)
83-
"$(LIB)" $(LIBFLAGS) /OUT:zlib$(MODEL).lib $(OBJS)
82+
"$(AR)" $(LIBFLAGS) /OUT:zlib$(MODEL).lib $(OBJS)
8483

8584
example.exe: example.obj zlib$(MODEL).lib
8685
"$(LD)" $(LDFLAGS) example.obj zlib$(MODEL).lib

win64.mak

Lines changed: 13 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Makefile to build D runtime library phobos64.lib for Win64
1+
# Makefile to build D runtime library phobos{64,32mscoff}.lib for Windows MSVC
22
# Prerequisites:
33
# Microsoft Visual Studio
44
# Targets:
@@ -10,32 +10,28 @@
1010
# Delete unneeded files created by build process
1111
# make unittest
1212
# Build phobos64.lib, build and run unit tests
13-
# make phobos32mscoff
14-
# Build phobos32mscoff.lib
15-
# make unittest32mscoff
16-
# Build phobos32mscoff.lib, build and run unit tests
1713
# make cov
1814
# Build for coverage tests, run coverage tests
15+
# make MODEL=32mscoff phobos32mscoff.lib
16+
# Build phobos32mscoff.lib (with x86 cl.exe in PATH, otherwise set CC & AR manually)
1917

20-
## Memory model (32 or 64)
18+
## Memory model (32mscoff or 64)
2119
MODEL=64
2220

23-
## Copy command
21+
## Assume MSVC cl.exe & lib.exe in PATH are set up for the target MODEL.
22+
## Otherwise set them explicitly, e.g., to `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx86\x86\cl.exe`.
23+
CC=cl
24+
AR=lib
2425

25-
CP=cp
26+
MAKE=make
2627

2728
## Directory where dmd has been installed
2829

2930
DIR=\dmd2
3031

31-
## Visual C directories
32-
VCDIR=\Program Files (x86)\Microsoft Visual Studio 10.0\VC
33-
SDKDIR=\Program Files (x86)\Microsoft SDKs\Windows\v7.0A
34-
3532
## Flags for VC compiler
3633

37-
#CFLAGS=/Zi /nologo /I"$(VCDIR)\INCLUDE" /I"$(SDKDIR)\Include"
38-
CFLAGS=/O2 /nologo /I"$(VCDIR)\INCLUDE" /I"$(SDKDIR)\Include"
34+
CFLAGS=/O2 /nologo
3935

4036
## Location of druntime tree
4137

@@ -45,20 +41,11 @@ DRUNTIMELIB=$(DRUNTIME)/lib/druntime$(MODEL).lib
4541
## Flags for dmd D compiler
4642

4743
DFLAGS=-conf= -m$(MODEL) -O -release -w -de -preview=dip1000 -preview=dtorfields -preview=fieldwise -I$(DRUNTIME)\import
48-
#DFLAGS=-m$(MODEL) -unittest -g
49-
#DFLAGS=-m$(MODEL) -unittest -cov -g
5044

5145
## Flags for compiling unittests
5246

5347
UDFLAGS=-conf= -g -m$(MODEL) -O -w -preview=dip1000 -preview=fieldwise -I$(DRUNTIME)\import -unittest -version=StdUnittest -version=CoreUnittest
5448

55-
## C compiler, linker, librarian
56-
57-
CC=$(VCDIR)\bin\amd64\cl
58-
LD=$(VCDIR)\bin\amd64\link
59-
AR=$(VCDIR)\bin\amd64\lib
60-
MAKE=make
61-
6249
## D compiler
6350

6451
DMD_DIR=../dmd
@@ -482,25 +469,11 @@ cov : $(SRC_TO_COMPILE) $(LIB)
482469
"$(DMD)" -conf= -m$(MODEL) -cov $(UDFLAGS) -ofcov.exe unittest.d $(SRC_TO_COMPILE) $(LIB)
483470
cov
484471

485-
################### Win32 COFF support #########################
486-
487-
# default to 32-bit compiler relative to the location of the 64-bit compiler,
488-
# link and lib are architecture agnostic
489-
CC32=$(CC)\..\..\cl
490-
491-
# build phobos32mscoff.lib
492-
phobos32mscoff:
493-
"$(MAKE)" -f win64.mak "DMD=$(DMD)" "MAKE=$(MAKE)" MODEL=32mscoff "CC=$(CC32)" "AR=$(AR)" "VCDIR=$(VCDIR)" "SDKDIR=$(SDKDIR)"
494-
495-
# run unittests for 32-bit COFF version
496-
unittest32mscoff:
497-
"$(MAKE)" -f win64.mak "DMD=$(DMD)" "MAKE=$(MAKE)" MODEL=32mscoff "CC=$(CC32)" "AR=$(AR)" "VCDIR=$(VCDIR)" "SDKDIR=$(SDKDIR)" unittest
498-
499472
######################################################
500473

501474
$(ZLIB): $(SRC_ZLIB)
502475
cd etc\c\zlib
503-
"$(MAKE)" -f win64.mak MODEL=$(MODEL) zlib$(MODEL).lib "CC=$(CC)" "LIB=$(AR)" "VCDIR=$(VCDIR)"
476+
"$(MAKE)" -f win64.mak MODEL=$(MODEL) "CC=$(CC)" "AR=$(AR)" zlib$(MODEL).lib
504477
cd ..\..\..
505478

506479
######################################################
@@ -520,8 +493,8 @@ clean:
520493
del $(LIB)
521494
del phobos.json
522495

523-
install: phobos.zip
524-
$(CP) phobos.lib phobos64.lib $(DIR)\windows\lib
496+
install: phobos.zip $(LIB)
497+
copy /y /b $(LIB) $(DIR)\windows\lib
525498
+rd/s/q $(DIR)\src\phobos
526499
unzip -o phobos.zip -d $(DIR)\src\phobos
527500

0 commit comments

Comments
 (0)