Skip to content

Commit

Permalink
Merge pull request #114 from obsti8383/master
Browse files Browse the repository at this point in the history
Optimize Makefile + Generate CycloneDX BOM
  • Loading branch information
obsti8383 committed Jun 16, 2022
2 parents c426cf4 + b016e10 commit ff73b65
Show file tree
Hide file tree
Showing 7 changed files with 649 additions and 37 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.vscode/
build/
rsrc.syso
19 changes: 11 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
.DEFAULT_GOAL := build
BUILD_FOLDER = $(shell pwd)/build
FLAGS_WINDOWS = GOOS=windows GOARCH=386 CC=i686-w64-mingw32-gcc CGO_ENABLED=1
MINGW32GCC := $(shell command -v i686-w64-mingw32-gcc 2> /dev/null)
BUILD_FOLDER = $(shell pwd)/build
FLAGS_WINDOWS = GOOS=windows GOARCH=386 CC=i686-w64-mingw32-gcc CGO_ENABLED=1
MINGW32GCC = $(shell command -v i686-w64-mingw32-gcc 2> /dev/null)
GOFLAGS_WINUI = -trimpath -buildvcs=false --ldflags '-s -w -extldflags "-static" -H windowsgui'
GOFLAGS_CLI = -trimpath -buildvcs=false -tags=cli --ldflags '-s -w -extldflags "-static"'

clean:
rm -rf $(BUILD_FOLDER)

pre: clean
@mkdir -p $(BUILD_FOLDER)
env go get -d ./
env go mod download
go install github.com/akavel/rsrc
cat tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go install %
go mod download

build: pre lint vet
ifndef MINGW32GCC
Expand All @@ -20,9 +21,11 @@ endif
@echo "[builder] Building Windows executable"
@mkdir -p $(BUILD_FOLDER)/
$(GOPATH)/bin/rsrc -arch 386 -manifest harden.manifest -ico harden.ico -o rsrc.syso
$(FLAGS_WINDOWS) go build --ldflags '-s -w -extldflags "-static" -H windowsgui' -o $(BUILD_FOLDER)/hardentools.exe
$(FLAGS_WINDOWS) go build $(GOFLAGS_WINUI) -o $(BUILD_FOLDER)/hardentools.exe
$(FLAGS_WINDOWS) cyclonedx-gomod app -output hardentools.bom.xml -licenses
@echo "[builder] Building Windows commandline executable"
$(FLAGS_WINDOWS) go build -tags cli --ldflags '-s -w -extldflags "-static"' -o $(BUILD_FOLDER)/hardentools-cli.exe
$(FLAGS_WINDOWS) go build $(GOFLAGS_CLI) -o $(BUILD_FOLDER)/hardentools-cli.exe
$(FLAGS_WINDOWS) GOFLAGS=-tags=cli cyclonedx-gomod app -output hardentools-cli.bom.xml -licenses
@echo "[builder] Done!"


Expand Down
60 changes: 57 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,63 @@
module github.com/securitywithoutborders/hardentools

go 1.16
go 1.18

require (
fyne.io/fyne/v2 v2.0.1
github.com/akavel/rsrc v0.10.2 // indirect
golang.org/x/sys v0.0.0-20210313110737-8e9fff1a3a18
github.com/CycloneDX/cyclonedx-gomod v1.2.0
github.com/akavel/rsrc v0.10.2
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e
)

require (
github.com/CycloneDX/cyclonedx-go v0.5.0 // indirect
github.com/Microsoft/go-winio v0.4.16 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-minhash v0.0.0-20170608043002-7fe510aff544 // indirect
github.com/ekzhu/minhash-lsh v0.0.0-20171225071031-5c06ee8586a1 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/fredbi/uri v0.0.0-20181227131451-3dcfdacbaaf3 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/fyne-io/mobile v0.1.2 // indirect
github.com/go-enry/go-license-detector/v4 v4.3.0 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/go-git/go-git/v5 v5.4.2 // indirect
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 // indirect
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200625191551-73d3c3675aa3 // indirect
github.com/godbus/dbus/v5 v5.0.4 // indirect
github.com/goki/freetype v0.0.0-20181231101311-fa8a33aabaff // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hhatto/gorst v0.0.0-20181029133204-ca9f730cac5b // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jdkato/prose v1.1.0 // indirect
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/montanaflynn/stats v0.0.0-20151014174947-eeaced052adb // indirect
github.com/peterbourgon/ff/v3 v3.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rs/zerolog v1.26.1 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/shogo82148/go-shuffle v0.0.0-20170808115208-59829097ff3b // indirect
github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95 // indirect
github.com/srwiley/oksvg v0.0.0-20200311192757-870daf9aa564 // indirect
github.com/srwiley/rasterx v0.0.0-20200120212402-85cb7272f5e9 // indirect
github.com/stretchr/testify v1.7.0 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce // indirect
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2 // indirect
golang.org/x/image v0.0.0-20200430140353-33d19683fad8 // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gonum.org/v1/gonum v0.7.0 // indirect
gopkg.in/neurosnap/sentences.v1 v1.0.6 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)

0 comments on commit ff73b65

Please sign in to comment.