2019-04-13 19:15:23 +02:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
#
|
|
|
|
# Copyright (C) 2018-2019 WireGuard LLC. All Rights Reserved.
|
|
|
|
#
|
|
|
|
|
2019-04-16 16:10:48 +02:00
|
|
|
# TODO: Unify version definition with wintun.vcxproj.
|
|
|
|
WINTUN_VERSION_MAJ=0
|
|
|
|
WINTUN_VERSION_MIN=0
|
|
|
|
WINTUN_VERSION_REV=2019
|
2019-04-18 12:21:23 +02:00
|
|
|
WINTUN_VERSION_BUILD=0128
|
|
|
|
WINTUN_VERSION=$(WINTUN_VERSION_MAJ).$(WINTUN_VERSION_MIN).$(WINTUN_VERSION_REV).$(WINTUN_VERSION_BUILD)
|
2019-04-16 16:10:48 +02:00
|
|
|
|
2019-04-13 19:15:23 +02:00
|
|
|
!IFNDEF CFG
|
|
|
|
CFG=Release
|
|
|
|
!ENDIF
|
|
|
|
!IFNDEF PLAT
|
2019-04-15 13:14:42 +02:00
|
|
|
PLAT=amd64
|
2019-04-13 19:15:23 +02:00
|
|
|
!ENDIF
|
2019-04-15 13:14:42 +02:00
|
|
|
!IF "$(PLAT)" == "x86" || "$(PLAT)" == "X86"
|
|
|
|
PLAT=x86
|
|
|
|
PLAT_MSBUILD=Win32
|
2019-04-16 16:10:48 +02:00
|
|
|
PLAT_WIX=x86
|
2019-04-15 13:14:42 +02:00
|
|
|
!ELSEIF "$(PLAT)" == "amd64" || "$(PLAT)" == "AMD64"
|
|
|
|
PLAT=amd64
|
|
|
|
PLAT_MSBUILD=x64
|
2019-04-16 16:10:48 +02:00
|
|
|
PLAT_WIX=x64
|
2019-04-15 13:25:31 +02:00
|
|
|
!ELSEIF "$(PLAT)" == "arm64" || "$(PLAT)" == "ARM64"
|
|
|
|
PLAT=arm64
|
|
|
|
PLAT_MSBUILD=ARM64
|
2019-04-16 16:10:48 +02:00
|
|
|
PLAT_WIX=arm64 # TODO: Follow WiX ARM64 support.
|
2019-04-13 19:15:23 +02:00
|
|
|
!ELSE
|
2019-04-15 13:25:31 +02:00
|
|
|
!ERROR Invalid platform "$(PLAT)". PLAT must be "x86", "amd64", or "arm64".
|
2019-04-13 19:15:23 +02:00
|
|
|
!ENDIF
|
2019-04-18 12:52:56 +02:00
|
|
|
DIST_DIR=dist
|
2019-04-15 13:14:42 +02:00
|
|
|
OUTPUT_DIR=$(PLAT)\$(CFG)
|
2019-04-18 12:21:23 +02:00
|
|
|
MSM_NAME=wintun_$(WINTUN_VERSION)_$(PLAT)
|
2019-04-15 13:14:42 +02:00
|
|
|
MSBUILD_FLAGS=/p:Configuration="$(CFG)" /p:Platform="$(PLAT_MSBUILD)" /m /v:minimal /nologo
|
2019-04-18 12:21:23 +02:00
|
|
|
WIX_CANDLE_FLAGS=-nologo -ext WixDifxAppExtension -ext WixIIsExtension -arch "$(PLAT_WIX)" -dWINTUN_VERSION="$(WINTUN_VERSION)"
|
2019-04-17 13:25:55 +02:00
|
|
|
WIX_LIGHT_FLAGS=-nologo -ext WixDifxAppExtension -ext WixIIsExtension -b output_dir="$(OUTPUT_DIR)" -sw1103
|
2019-04-13 19:15:23 +02:00
|
|
|
|
|
|
|
build ::
|
|
|
|
msbuild.exe "wintun.vcxproj" /t:Build $(MSBUILD_FLAGS)
|
|
|
|
|
|
|
|
clean ::
|
2019-04-18 12:52:56 +02:00
|
|
|
-rd /s /q "$(DIST_DIR)" > NUL 2>&1
|
2019-04-18 11:24:38 +02:00
|
|
|
-rd /s /q "$(OUTPUT_DIR)" > NUL 2>&1
|
2019-04-13 19:15:23 +02:00
|
|
|
|
2019-04-15 13:25:31 +02:00
|
|
|
!IF "$(CFG)" == "Release" && "$(PLAT)" != "arm64"
|
2019-04-13 19:15:23 +02:00
|
|
|
|
|
|
|
dvl :: "wintun.DVL.XML"
|
|
|
|
|
|
|
|
clean ::
|
2019-04-18 11:24:38 +02:00
|
|
|
-rd /s /q "sdv" > NUL 2>&1
|
2019-04-17 15:09:21 +02:00
|
|
|
-del /f /q "wintun.DVL.XML" > NUL 2>&1
|
2019-04-18 11:25:08 +02:00
|
|
|
-del /f /q "smvbuild.log" > NUL 2>&1
|
2019-04-17 15:09:21 +02:00
|
|
|
-del /f /q "smvstats.txt" > NUL 2>&1
|
2019-04-13 19:15:23 +02:00
|
|
|
|
|
|
|
"sdv\SDV.DVL.xml" "$(OUTPUT_DIR)\vc.nativecodeanalysis.all.xml" :
|
|
|
|
msbuild.exe "wintun.vcxproj" /t:sdv /p:Inputs="/check:*" $(MSBUILD_FLAGS)
|
|
|
|
|
|
|
|
"wintun.DVL.XML" : "sdv\SDV.DVL.xml" "$(OUTPUT_DIR)\vc.nativecodeanalysis.all.xml"
|
|
|
|
msbuild.exe "wintun.vcxproj" /t:dvl $(MSBUILD_FLAGS)
|
|
|
|
|
2019-04-18 12:52:56 +02:00
|
|
|
msm :: "$(DIST_DIR)\$(MSM_NAME).msm"
|
2019-04-16 16:10:48 +02:00
|
|
|
|
|
|
|
"$(OUTPUT_DIR)\wintun.wixobj" : "wintun.wxs"
|
|
|
|
"$(WIX)bin\candle.exe" $(WIX_CANDLE_FLAGS) -out $@ $**
|
|
|
|
|
2019-04-18 12:52:56 +02:00
|
|
|
"$(DIST_DIR)\$(MSM_NAME).msm" : \
|
|
|
|
"$(DIST_DIR)" \
|
2019-04-16 16:10:48 +02:00
|
|
|
"$(OUTPUT_DIR)\wintun.cer" \
|
|
|
|
"$(OUTPUT_DIR)\wintun\wintun.cat" \
|
|
|
|
"$(OUTPUT_DIR)\wintun\wintun.inf" \
|
|
|
|
"$(OUTPUT_DIR)\wintun\wintun.sys" \
|
|
|
|
"$(OUTPUT_DIR)\wintun.wixobj" \
|
|
|
|
"$(WIX)bin\difxapp_$(PLAT_WIX).wixlib"
|
2019-04-18 12:52:56 +02:00
|
|
|
"$(WIX)bin\light.exe" $(WIX_LIGHT_FLAGS) -out "$(DIST_DIR)\$(MSM_NAME).msm" -spdb "$(OUTPUT_DIR)\wintun.wixobj" "$(WIX)bin\difxapp_$(PLAT_WIX).wixlib"
|
|
|
|
|
|
|
|
!ENDIF
|
|
|
|
|
|
|
|
"$(DIST_DIR)" :
|
|
|
|
md $@ > NUL 2>&1
|