Fashioning a makefile to build openssl for windows and am running into something that has me puzzled. I want to just have it built with one call to make, supplying the platform to build. There is a parent makefile which calls a sub-make having set a few parameters based on the platform (linux, win32, win64, win64debug, etc).
The sub-makefile section for windows reads as follows:
winConfig: patch.tmp
cd $(BUILD_HOME)/openssl-$(VERSION) ; \
$(CHMOD) -R 777 * ; \
perl Configure $(PERL_CFG_TARGET) $(CFG_BASEOPTS) ; \
[ $(CFG_BITS) = 32 ] && ms/do_ms.bat ; \
[ $(CFG_BITS) = 64 ] && ms/do_win64a.bat
$(TOUCH) cfg-win$(CFG_BITS)$(CFG_DEBUG).tmp cfg.tmp
$(TOUCH) winConfig
winBuild: winConfig remakeDirs
cd $(BUILD_HOME)/openssl-$(VERSION) ; \
env -u MAKE -u MAKEFLAGS nmake -f ms/nt.mak install ; \
$(CP) crypto/ec/ec_lcl.h crypto/ecdsa/ecs_locl.h $(OPENSSL_INSTALL_DIR)/include/openssl/
$(TOUCH) winBuild
winPkg: winConfig winBuild
$(RM) $(TARGET_HOME)/$(OPENSSL_TARBALL)
$(TAR) -C $(OPENSSL_INSTALL_BASE) -cf $(TARGET_HOME)/$(OPENSSL_TARBALL) $(OPENSSL_INSTALL_TARGET)
$(GZIP) -f $(TARGET_HOME)/$(OPENSSL_TARBALL)
$(RM) $(OPENSSL_INSTALL_DIR)
$(TOUCH) winPkg
## build and install for Windows:
all-win: winPkg
A number of variables are set up top and that all appears to work fine. There are two issues I have here:
In the winbuild target, I get complaints about env not being found, however, nmake will not run unless I preceed it with that env command. Weird?
This is the one that really has me puzzled. The nmake lines appear to be run in the background. I say that because, I find in the output, the copy command, quickly followed by the tar + gzip commands... while the compile has just gotten underway. The resulting tarball, created approx 10min before the build completes, has only the directory structure of the install folder, plus the two files referenced.
How can I have this process completed synchronously without having to resort to building and tarring separately?
EDIT: Updated sample makefile above.
Calling via:
make -f openssl.mf win64
where openssl.mf contains:
win64:
make -j 1 -f openssl-sub.mf all-win CC=cl CXX=cl OUTPATH=out64 CFG_TARGET=VC-WIN64A
It continues to call the nmake in the background, then proceed to tar up a fairly empty directory. Not at all what I want to accomplish. I would like the make process sit and wait until nmake returns... is that possible?
Errored output:
cd L:/dev/openssl/openssl-build/openssl-1.0.1l ; \
env -u MAKE -u MAKEFLAGS nmake -f ms/nt.mak install ; \
L:/wintools/cygwin/cp -f crypto/ec/ec_lcl.h crypto/ecdsa/ecs_locl.h L:/dev/openssl/openssl-install/win64-x86/include/openssl/
Microsoft (R) Program Maintenance Utility Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.
Building OpenSSL
perl util/mkdir-p.pl "tmp32"
created directory `tmp32'
perl util/mkdir-p.pl "out32"
created directory `out32'
perl util/mkdir-p.pl "inc32"
created directory `inc32'
perl util/mkdir-p.pl "inc32\openssl"
L:/wintools/cygwin/touch winBuild
created directory `inc32/openssl'
perl util/copy.pl ".\.\e_os.h" "tmp32\e_os.h"
Copying: ././e_os.h to tmp32/e_os.h
perl util/copy.pl ".\crypto\cryptlib.h" "tmp32\cryptlib.h"
Copying: ./crypto/cryptlib.h to tmp32/cryptlib.h
perl util/copy.pl ".\crypto\buildinf.h" "tmp32\buildinf.h"
Copying: ./crypto/buildinf.h to tmp32/buildinf.h
perl util/copy.pl ".\crypto\md32_common.h" "tmp32\md32_common.h"
Copying: ./crypto/md32_common.h to tmp32/md32_common.h
perl util/copy.pl ".\crypto\o_time.h" "tmp32\o_time.h"
Copying: ./crypto/o_time.h to tmp32/o_time.h
L:/wintools/rm -rf /dev/openssl/packages/win64-x86-openssl-1.0.1l.tar
perl util/copy.pl ".\crypto\o_str.h" "tmp32\o_str.h"
L:/wintools/Gow/bin/tar.exe -C L:/dev/openssl/openssl-install -cf /dev/openssl/packages/win64-x86-openssl-1.0.1l.tar win64-x86
Copying: ./crypto/o_str.h to tmp32/o_str.h
perl util/copy.pl ".\crypto\o_dir.h" "tmp32\o_dir.h"
Copying: ./crypto/o_dir.h to tmp32/o_dir.h
perl util/copy.pl ".\crypto\constant_time_locl.h" "tmp32\constant_time_locl.h"
Copying: ./crypto/constant_time_locl.h to tmp32/constant_time_locl.h
perl util/copy.pl ".\crypto\md4\md4_locl.h" "tmp32\md4_locl.h"
L:/wintools/cygwin/gzip -f /dev/openssl/packages/win64-x86-openssl-1.0.1l.tar
Copying: ./crypto/md4/md4_locl.h to tmp32/md4_locl.h
perl util/copy.pl ".\crypto\md5\md5_locl.h" "tmp32\md5_locl.h"
Copying: ./crypto/md5/md5_locl.h to tmp32/md5_locl.h
perl util/copy.pl ".\crypto\sha\sha_locl.h" "tmp32\sha_locl.h"
gzip: /dev/openssl/packages/win64-x86-openssl-1.0.1l.tar: No such file or directory
make[1]: *** [winPkg] Error 1
make[1]: Leaving directory `L:/dev/openssl'
make: *** [win64] Error 2
You can see, nr the bottom, where the tar command from winPkg has been issued prior to winbuild having completed.