Skip to content

Commit

Permalink
pkg-config diagnostics; empty Go build cache after builds
Browse files Browse the repository at this point in the history
  • Loading branch information
hillu committed Nov 21, 2024
1 parent 220dcda commit 5279944
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ all: $(EXE)
$(foreach arch,$(ARCHS),\
$(if $(findstring $(3rdparty_NATIVE_ARCH),$(arch)),,\
$(eval _build/$(arch)/%: private export CC=$(arch)-gcc))\
$(eval _build/$(arch)/%: private export PKG_CONFIG_PATH=$(CURDIR)/_3rdparty/tgt/$(arch)/lib/pkgconfig)\
$(eval _build/$(arch)/%: export PKG_CONFIG_PATH=$(CURDIR)/_3rdparty/tgt/$(arch)/lib/pkgconfig)\
$(eval _build/$(arch)/%: private export GOOS=\
$(or $(if $(findstring linux,$(arch)),linux),\
$(if $(findstring mingw,$(arch)),windows),\
Expand All @@ -73,6 +73,7 @@ $(if $(findstring x86_64-linux,$(3rdparty_NATIVE_ARCH)),\
$(EXE) unit-test: private export CGO_ENABLED=1
$(EXE) unit-test: private export PATH := $(CURDIR)/_3rdparty/tgt/bin:$(PATH)
$(EXE): private extldflags = $(if $(findstring darwin,$(GOOS)),,-static)
$(EXE): private export PKG_CONFIG_DEBUG_SPEW=1

# Build resource files
%_resource_windows_amd64.syso: %.rc
Expand All @@ -93,10 +94,12 @@ unit-test:
$(info [+] test_flags=$(test_flags) test_pathspec=$(test_pathspec))
$(info [+] GOROOT=$(GOROOT) GOOS=$(GOOS) GOARCH=$(GOARCH) CC=$(CC))
$(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 @@ -107,11 +110,14 @@ $(EXE):
$(info [+] Building spyre...)
$(info [+] GOROOT=$(GOROOT) GOOS=$(GOOS) GOARCH=$(GOARCH) CC=$(CC))
$(info [+] PKG_CONFIG_PATH=$(PKG_CONFIG_PATH))
which pkg-config
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 5279944

Please sign in to comment.