Skip to content

Commit

Permalink
build: remove debug flags from release go plugins
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Dellaluce <[email protected]>
Co-authored-by: Leonardo Grasso <[email protected]>
  • Loading branch information
2 people authored and poiana committed Jan 17, 2022
1 parent ac90db1 commit fa6b7e5
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 19 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CURL = curl

FALCOSECURITY_LIBS_REVISION=e25e44b3ba4cb90ba9ac75bf747978e41fb6b221

DEBUG = 1
OUTPUT_DIR := output
SOURCE_DIR := plugins
ARCH ?=$(shell uname -m)
Expand All @@ -31,7 +32,7 @@ all: plugin_info.h $(plugins)

.PHONY: $(plugins)
$(plugins):
cd plugins/$@ && make
cd plugins/$@ && make DEBUG=$(DEBUG)

.PHONY: clean
clean: clean/plugin_info.h $(plugins-clean) clean/packages clean/build/utils/version
Expand Down Expand Up @@ -67,6 +68,7 @@ $(plugins-packages): all build/utils/version
cp -r plugins/$(PLUGIN_NAME)/README.md $(OUTPUT_DIR)/$(PLUGIN_NAME)/
tar -zcvf $(OUTPUT_DIR)/$(PLUGIN_NAME)-$(PLUGIN_VERSION)-${ARCH}.tar.gz -C ${OUTPUT_DIR}/$(PLUGIN_NAME) .

release/%: DEBUG=0
release/%: plugin_info.h clean/% % build/utils/version
$(eval PLUGIN_NAME := $(shell basename $@))
$(eval PLUGIN_PATH := plugins/$(PLUGIN_NAME)/lib$(PLUGIN_NAME).so)
Expand Down
19 changes: 13 additions & 6 deletions plugins/cloudtrail/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@
#

SHELL=/bin/bash -o pipefail

GO ?= go

all: libcloudtrail.so
NAME := cloudtrail
OUTPUT := lib$(NAME).so

clean:
rm -f *.so *.h
ifeq ($(DEBUG), 1)
GODEBUGFLAGS= GODEBUG=cgocheck=2
else
GODEBUGFLAGS= GODEBUG=cgocheck=0
endif

libcloudtrail.so: cloudtrail.go extract.go source.go
GODEBUG=cgocheck=2 $(GO) build -buildmode=c-shared -o libcloudtrail.so *.go
all: $(OUTPUT)

clean:
@rm -f *.so *.h

$(OUTPUT): *.go
@$(GODEBUGFLAGS) $(GO) build -buildmode=c-shared -o $(OUTPUT)
19 changes: 13 additions & 6 deletions plugins/dummy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@
#

SHELL=/bin/bash -o pipefail

GO ?= go

all: libdummy.so
NAME := dummy
OUTPUT := lib$(NAME).so

clean:
rm -f *.so *.h
ifeq ($(DEBUG), 1)
GODEBUGFLAGS= GODEBUG=cgocheck=2
else
GODEBUGFLAGS= GODEBUG=cgocheck=0
endif

libdummy.so: dummy.go
GODEBUG=cgocheck=2 $(GO) build -buildmode=c-shared -o libdummy.so *.go
all: $(OUTPUT)

clean:
@rm -f *.so *.h

$(OUTPUT): *.go
@$(GODEBUGFLAGS) $(GO) build -buildmode=c-shared -o $(OUTPUT)
19 changes: 13 additions & 6 deletions plugins/json/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@
#

SHELL=/bin/bash -o pipefail

GO ?= go

all: libjson.so
NAME := json
OUTPUT := lib$(NAME).so

clean:
rm -f *.h *.so
ifeq ($(DEBUG), 1)
GODEBUGFLAGS= GODEBUG=cgocheck=2
else
GODEBUGFLAGS= GODEBUG=cgocheck=0
endif

libjson.so: json.go
GODEBUG=cgocheck=2 $(GO) build -buildmode=c-shared -o libjson.so *.go
all: $(OUTPUT)

clean:
@rm -f *.so *.h

$(OUTPUT): *.go
@$(GODEBUGFLAGS) $(GO) build -buildmode=c-shared -o $(OUTPUT)

0 comments on commit fa6b7e5

Please sign in to comment.