From 7c9e6e610ffa4c4cb6fe98e150849bd8569f8d08 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 10 Mar 2019 04:51:42 +0100 Subject: build: allow make to skip hidden directory to reduce stats Signed-off-by: Jason A. Donenfeld --- .gitignore | 3 +-- Makefile | 12 ++++++------ build.bat | 16 ++++++++-------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 494c3301..7fbadcea 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,5 @@ *.swp *.bak *.syso -.tmp .idea -deps +.deps diff --git a/Makefile b/Makefile index 8a93a700..a2f0a898 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ export CGO_ENABLED := 1 export GOOS := windows export GOARCH := amd64 REAL_GOROOT := $(shell go env GOROOT) -export GOROOT := $(PWD)/deps/go +export GOROOT := $(PWD)/.deps/go export PATH := $(GOROOT)/bin:$(PATH) DEPLOYMENT_HOST ?= winvm @@ -13,17 +13,17 @@ DEPLOYMENT_PATH ?= Desktop all: wireguard.exe -deps/.prepared: - mkdir -p deps +.deps/prepared: + mkdir -p .deps rsync -a --delete --exclude=pkg/obj/go-build "$(REAL_GOROOT)/" "$(GOROOT)/" - patch -f -N -r- -d deps/go -p1 < golang-runtime-dll-injection.patch + patch -f -N -r- -d .deps/go -p1 < golang-runtime-dll-injection.patch touch "$@" resources.syso: resources.rc manifest.xml ui/icon/icon.ico $(WINDRES) -i $< -o $@ -O coff rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d)) -wireguard.exe: resources.syso $(call rwildcard,,*.go *.c *.h) deps/.prepared +wireguard.exe: resources.syso $(call rwildcard,,*.go *.c *.h) .deps/prepared go build -ldflags="-H windowsgui -s -w" -v -o $@ deploy: wireguard.exe @@ -31,6 +31,6 @@ deploy: wireguard.exe scp wireguard.exe $(DEPLOYMENT_HOST):$(DEPLOYMENT_PATH) clean: - rm -rf resources.syso wireguard.exe deps + rm -rf resources.syso wireguard.exe .deps .PHONY: deploy clean all diff --git a/build.bat b/build.bat index e6be76f8..c355c529 100644 --- a/build.bat +++ b/build.bat @@ -2,11 +2,11 @@ set STARTDIR=%cd% set OLDPATH=%PATH% -if exist deps\.prepared goto :build +if exist .deps\prepared goto :build :installdeps - rmdir /s /q deps 2> NUL - mkdir deps || goto :error - cd deps || goto :error + rmdir /s /q .deps 2> NUL + mkdir .deps || goto :error + cd .deps || goto :error echo [+] Downloading golang curl -#fo go.zip https://dl.google.com/go/go1.12.windows-amd64.zip || goto :error echo [+] Verifying golang @@ -31,17 +31,17 @@ if exist deps\.prepared goto :build .\patch.exe -f -N -r- -d go -p1 --binary < ..\golang-runtime-dll-injection.patch || goto :error echo [+] Cleaning up del patch.exe patch.zip go.zip mingw.zip || goto :error - copy /y NUL .prepared > NUL || goto :error + copy /y NUL prepared > NUL || goto :error cd .. || goto :error :build - set PATH=%STARTDIR%\deps\x86_64-w64-mingw32-native\bin\;%STARTDIR%\deps\go\bin\;%PATH% + set PATH=%STARTDIR%\.deps\x86_64-w64-mingw32-native\bin\;%STARTDIR%\.deps\go\bin\;%PATH% set CC=x86_64-w64-mingw32-gcc.exe set CFLAGS=-O3 -Wall -std=gnu11 set GOOS=windows set GOARCH=amd64 - set GOPATH=%STARTDIR%\deps\gopath - set GOROOT=%STARTDIR%\deps\go + set GOPATH=%STARTDIR%\.deps\gopath + set GOROOT=%STARTDIR%\.deps\go set CGO_ENABLED=1 echo [+] Assembling resources windres.exe -i resources.rc -o resources.syso -O coff || goto :error -- cgit v1.2.3-59-g8ed1b