Skip to content

Commit

Permalink
More diagnostics; clear GO cache after build.
Browse files Browse the repository at this point in the history
  • Loading branch information
hillu committed Nov 20, 2024
1 parent 7cf0b43 commit 068e941
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@ all: $(EXE)
$(info Build OK)

# Set up target-architecture-specific environment variables:
# CC, PKG_CONFIG_LIBDIR, GOOS, GOARCH
# CC, PKG_CONFIG_PATH, GOOS, GOARCH
$(foreach arch,$(ARCHS),\
$(if $(findstring $(3rdparty_NATIVE_ARCH),$(arch)),,\
$(eval _build/$(arch)/%: private export CC=$(arch)-gcc))\
$(eval _build/$(arch)/%: private export PKG_CONFIG_LIBDIR=$(CURDIR)/_3rdparty/tgt/$(arch)/lib/pkgconfig)\
$(eval _build/$(arch)/%: private export PKG_CONFIG_PATH=$(CURDIR)/_3rdparty/tgt/$(arch)/lib/pkgconfig)\
$(eval _build/$(arch)/%: private export GOOS=\
$(or $(if $(findstring linux,$(arch)),linux),\
Expand All @@ -66,11 +65,9 @@ $(if $(findstring x86_64-linux,$(3rdparty_NATIVE_ARCH)),\
$(eval unit-test: private export CC=x86_64-linux-musl-gcc)\
$(eval unit-test: private export GOOS=linux)\
$(eval unit-test: private export GOARCH=amd64)\
$(eval unit-test: private export PKG_CONFIG_LIBDIR=$(CURDIR)/_3rdparty/tgt/x86_64-linux-musl/lib/pkgconfig)\
$(eval unit-test: private export PKG_CONFIG_PATH=$(CURDIR)/_3rdparty/tgt/x86_64-linux-musl/lib/pkgconfig)\
,\
$(eval unit-test: private export CC=$(firstword $(shell which gcc cc)))\
$(eval unit-test: private export PKG_CONFIG_LIBDIR=$(CURDIR)/_3rdparty/tgt/$(3rdparty_NATIVE_ARCH)/lib/pkgconfig)\
$(eval unit-test: private export PKG_CONFIG_PATH=$(CURDIR)/_3rdparty/tgt/$(3rdparty_NATIVE_ARCH)/lib/pkgconfig))

$(EXE) unit-test: private export CGO_ENABLED=1
Expand All @@ -96,12 +93,13 @@ unit-test:
$(info [+] Running tests...)
$(info [+] test_flags=$(test_flags) test_pathspec=$(test_pathspec))
$(info [+] GOROOT=$(GOROOT) GOOS=$(GOOS) GOARCH=$(GOARCH) CC=$(CC))
$(info [+] PKG_CONFIG_LIBDIR=$(PKG_CONFIG_LIBDIR))
$(info [+] PKG_CONFIG_PATH=$(PKG_CONFIG_PATH))
env | grep PKG_
$(GOROOT)/bin/go test $(test_flags) \
-ldflags '-w -s -linkmode=external -extldflags "$(extldflags)"' \
-tags yara_static \
$(test_pathspec)
find `go env GOCACHE)` -type f | xargs rm -f

$(EXE) unit-test: $(GOFILES) $(RCFILES) Makefile 3rdparty.mk 3rdparty-all.stamp

Expand All @@ -111,15 +109,16 @@ $(EXE): VERSIONDEF := $(if $(VERSIONSUFFIX),-X $(NAMESPACE).Version=$(VERSION)$(
$(EXE):
$(info [+] Building spyre...)
$(info [+] GOROOT=$(GOROOT) GOOS=$(GOOS) GOARCH=$(GOARCH) CC=$(CC))
$(info [+] PKG_CONFIG_LIBDIR=$(PKG_CONFIG_LIBDIR))
$(info [+] PKG_CONFIG_PATH=$(PKG_CONFIG_PATH))
which pkg-config
pkg-config --debug --list-package-names
#pkg-config --debug --list-package-names
env | grep PKG_
mkdir -p $(@D)
$(GOROOT)/bin/go build \
-ldflags '$(VERSIONDEF) -w -s -linkmode=external -extldflags "$(extldflags)"' \
-tags yara_static \
-o $@ $(NAMESPACE)/cmd/spyre
find `go env GOCACHE)` -type f | xargs rm -f

.PHONY: release
release: spyre-$(VERSION)$(VERSIONSUFFIX).zip
Expand Down

0 comments on commit 068e941

Please sign in to comment.