From 94831068fb5573b1ebdb9def9c2ad09f0694d45c Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 13 May 2017 20:10:55 +0100 Subject: Build a Windows halibut.exe using clang-cl. Or rather, clang in MS-targeted code generation but still with the Unix-style command line, which lets me use the existing Makefile with almost no change. --- Buildscr | 18 ++++++++++++++---- Makefile | 9 ++++++--- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Buildscr b/Buildscr index 4ddbce9..a1f1e63 100644 --- a/Buildscr +++ b/Buildscr @@ -23,6 +23,19 @@ set Basename halibut-$(Version) # Make the source archive. in halibut do ./release.sh $(Basename) $(Version) +# Build a Windows binary of Halibut using clang-cl. +in halibut with clangcl64 do make CC='clang --target=x86_64-pc-windows-msvc18.0.0 -D_CRT_SECURE_NO_WARNINGS' CC_LINK='lld-link -defaultlib:libcmt -out:$$@' EXE=.exe +in halibut do mv build/halibut.exe . +in halibut do rm -rf build +delegate windows + # Code-sign the Windows binary, if the local bob config provides + # a script to do so. We assume here that the script accepts an -i + # option to provide a 'more info' URL, and that it signs the file + # in place. + ifneq "$(winsigncode)" "" in halibut do $(winsigncode) -i http://www.chiark.greenend.org.uk/~sgtatham/halibut/ halibut.exe + return halibut/halibut.exe +enddelegate + # Build a local binary of Halibut in order to build the docs. Make # sure to tag it with the supplied version number, so that the # release docs announce themselves as having been built with the @@ -33,11 +46,8 @@ in halibut do make $(Rel) in halibut/doc do make deliver halibut/*.tar.gz $@ +deliver halibut/halibut.exe $@ deliver halibut/doc/halibut.pdf $@ deliver halibut/doc/halibut.txt $@ deliver halibut/doc/halibut.chm $@ deliver halibut/doc/*.html $@ - -# FIXME: it'd be nice to add a Windows delegation here so we can -# ship a prebuilt Halibut executable. However, that requires a -# Windows makefile. diff --git a/Makefile b/Makefile index c9499e4..7402323 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,9 @@ CFLAGS += -DLOGALLOC LIBS += -lefence endif -all: halibut +EXE =# + +all: halibut$(EXE) SRC := ../ @@ -91,6 +93,7 @@ LIBCHARSET_GENPFX = charset-# MD = -MD CFLAGS += -I$(LIBCHARSET_SRCDIR) -I$(LIBCHARSET_OBJDIR) include $(LIBCHARSET_SRCDIR)Makefile +CC_LINK = $(CC) -o $@ MODULES := main malloc ustring error help licence version misc tree234 MODULES += input in_afm in_pf in_sfnt keywords contents index biblio @@ -100,8 +103,8 @@ MODULES += winhelp winchm deflate lzx lz77 huffman psdata wcwidth OBJECTS := $(addsuffix .o,$(MODULES)) $(LIBCHARSET_OBJS) DEPS := $(addsuffix .d,$(MODULES)) -halibut: $(OBJECTS) - $(CC) $(LFLAGS) -o halibut $(OBJECTS) $(LIBS) +halibut$(EXE): $(OBJECTS) + $(CC_LINK) $(LFLAGS) $(OBJECTS) $(LIBS) %.o: $(SRC)%.c $(CC) $(CFLAGS) -MD -c $< -- cgit v1.1