Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions etc/c/zlib/win64.mak
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Makefile for zlib64

MODEL=64
VCDIR=\Program Files (x86)\Microsoft Visual Studio 10.0\VC

CC=$(VCDIR)\bin\amd64\cl
LD=$(VCDIR)\bin\amd64\link
LIB=$(VCDIR)\bin\amd64\lib
CC=cl
LD=link
AR=lib

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


all: zlib64.lib example.exe infcover.exe minigzip.exe
all: zlib$(MODEL).lib example.exe infcover.exe minigzip.exe

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

zlib$(MODEL).lib: $(OBJS)
"$(LIB)" $(LIBFLAGS) /OUT:zlib$(MODEL).lib $(OBJS)
"$(AR)" $(LIBFLAGS) /OUT:zlib$(MODEL).lib $(OBJS)

example.exe: example.obj zlib$(MODEL).lib
"$(LD)" $(LDFLAGS) example.obj zlib$(MODEL).lib
Expand Down
53 changes: 13 additions & 40 deletions win64.mak
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Makefile to build D runtime library phobos64.lib for Win64
# Makefile to build D runtime library phobos{64,32mscoff}.lib for Windows MSVC
# Prerequisites:
# Microsoft Visual Studio
# Targets:
Expand All @@ -10,32 +10,28 @@
# 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
# make MODEL=32mscoff phobos32mscoff.lib
# Build phobos32mscoff.lib (with x86 cl.exe in PATH, otherwise set CC & AR manually)

## Memory model (32 or 64)
## Memory model (32mscoff or 64)
MODEL=64

## Copy command
## Assume MSVC cl.exe & lib.exe in PATH are set up for the target MODEL.
## 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`.
CC=cl
AR=lib

CP=cp
MAKE=make

## 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"
CFLAGS=/O2 /nologo

## Location of druntime tree

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

DFLAGS=-conf= -m$(MODEL) -O -release -w -de -preview=dip1000 -preview=dtorfields -preview=fieldwise -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 -preview=dip1000 -preview=fieldwise -I$(DRUNTIME)\import -unittest -version=StdUnittest -version=CoreUnittest

## 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
Expand Down Expand Up @@ -482,25 +469,11 @@ 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)"
"$(MAKE)" -f win64.mak MODEL=$(MODEL) "CC=$(CC)" "AR=$(AR)" zlib$(MODEL).lib
cd ..\..\..

######################################################
Expand All @@ -520,8 +493,8 @@ clean:
del $(LIB)
del phobos.json

install: phobos.zip
$(CP) phobos.lib phobos64.lib $(DIR)\windows\lib
install: phobos.zip $(LIB)
copy /y /b $(LIB) $(DIR)\windows\lib
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is unused - it a) didn't make sure the lib is actually built beforehand, and b) tried to copy a phobos.lib, which should have never existed (no MODEL suffix).

+rd/s/q $(DIR)\src\phobos
unzip -o phobos.zip -d $(DIR)\src\phobos

Expand Down