feat: converge upon a more standard Makefile for golang plugins
This commit is contained in:
@@ -1,29 +1,33 @@
|
||||
include ../../common.mk
|
||||
|
||||
GO_ARGS ?= -a
|
||||
|
||||
SUBCOMMANDS = subcommands/rebuild subcommands/rebuildall subcommands/report subcommands/set
|
||||
TRIGGERS = install network-build-config network-compute-ports network-config-exists network-get-ipaddr network-get-listeners network-get-port network-get-property network-write-ipaddr network-write-port post-create post-delete
|
||||
build-in-docker: clean
|
||||
docker run --rm \
|
||||
-v $$PWD/../..:$(GO_REPO_ROOT) \
|
||||
-w $(GO_REPO_ROOT)/plugins/network \
|
||||
$(BUILD_IMAGE) \
|
||||
bash -c "make build" || exit $$?
|
||||
bash -c "GO_ARGS='$(GO_ARGS)' make build" || exit $$?
|
||||
|
||||
build: commands subcommands triggers
|
||||
subcommands: subcommands/rebuild subcommands/rebuildall subcommands/report subcommands/set
|
||||
triggers: install network-build-config network-compute-ports network-config-exists network-get-ipaddr network-get-listeners network-get-port network-get-property network-write-ipaddr network-write-port post-create post-delete
|
||||
|
||||
commands: **/**/commands.go
|
||||
go build -a -o commands src/commands/commands.go
|
||||
go build $(GO_ARGS) -o commands src/commands/commands.go
|
||||
|
||||
subcommands/rebuild: **/**/**/rebuild.go
|
||||
go build -a -o subcommands/rebuild src/subcommands/rebuild/rebuild.go
|
||||
subcommands: $(SUBCOMMANDS)
|
||||
|
||||
subcommands/rebuildall: **/**/**/rebuildall.go
|
||||
go build -a -o subcommands/rebuildall src/subcommands/rebuildall/rebuildall.go
|
||||
subcommands/%: src/subcommands/*/%.go
|
||||
go build $(GO_ARGS) -o $@ $<
|
||||
|
||||
subcommands/report: **/**/**/report.go
|
||||
go build -a -o subcommands/report src/subcommands/report/report.go
|
||||
clean:
|
||||
rm -rf commands subcommands network-* install post-create post-delete
|
||||
|
||||
subcommands/set: **/**/**/set.go
|
||||
go build -a -o subcommands/set src/subcommands/set/set.go
|
||||
src-clean:
|
||||
rm -rf .gitignore src vendor Makefile
|
||||
|
||||
triggers: $(TRIGGERS)
|
||||
|
||||
install: **/**/**/install.go
|
||||
go build -a -o install src/triggers/install/install.go
|
||||
@@ -60,9 +64,3 @@ post-create: **/**/**/post-create.go
|
||||
|
||||
post-delete: **/**/**/post-delete.go
|
||||
go build -a -o post-delete src/triggers/post-delete/post-delete.go
|
||||
|
||||
clean:
|
||||
rm -rf commands subcommands network-* install post-create post-delete
|
||||
|
||||
src-clean:
|
||||
rm -rf .gitignore src vendor Makefile
|
||||
|
||||
@@ -1,23 +1,25 @@
|
||||
include ../../common.mk
|
||||
|
||||
GO_ARGS ?= -a
|
||||
|
||||
SUBCOMMANDS = subcommands/gc subcommands/purge-cache
|
||||
|
||||
build-in-docker: clean
|
||||
docker run --rm \
|
||||
-v $$PWD/../..:$(GO_REPO_ROOT) \
|
||||
-w $(GO_REPO_ROOT)/plugins/repo \
|
||||
$(BUILD_IMAGE) \
|
||||
bash -c "make build" || exit $$?
|
||||
bash -c "GO_ARGS='$(GO_ARGS)' make build" || exit $$?
|
||||
|
||||
build: commands subcommands
|
||||
subcommands: subcommands/gc subcommands/purge-cache
|
||||
|
||||
commands: **/**/commands.go
|
||||
go build -a -o commands src/commands/commands.go
|
||||
go build $(GO_ARGS) -o commands src/commands/commands.go
|
||||
|
||||
subcommands/gc: **/**/**/gc.go
|
||||
go build -a -o subcommands/gc src/subcommands/gc/gc.go
|
||||
subcommands: $(SUBCOMMANDS)
|
||||
|
||||
subcommands/purge-cache: **/**/**/purge-cache.go
|
||||
go build -a -o subcommands/purge-cache src/subcommands/purge-cache/purge-cache.go
|
||||
subcommands/%: src/subcommands/*/%.go
|
||||
go build $(GO_ARGS) -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -rf commands subcommands
|
||||
|
||||
Reference in New Issue
Block a user