Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
refactor: add -C to some Makefile commands
Browse files Browse the repository at this point in the history
  • Loading branch information
adamtagscherer committed Feb 23, 2024
1 parent 11eb55d commit cc61a5c
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,19 @@ LDFLAGS += -X 'github.com/openclarity/vmclarity/core/version.CommitHash=$(COMMIT
LDFLAGS += -X 'github.com/openclarity/vmclarity/core/version.BuildTimestamp=$(BUILD_TIMESTAMP)'

bin/vmclarity-orchestrator: $(shell find api provider orchestrator utils core) | $(BIN_DIR)
go build -C orchestrator $(BUILD_OPTS) -ldflags="$(LDFLAGS)" -o $(ROOT_DIR)/$@ cmd/main.go
go -C $(ROOT_DIR)/orchestrator build $(BUILD_OPTS) -ldflags="$(LDFLAGS)" -o $(ROOT_DIR)/$@ cmd/main.go

bin/vmclarity-apiserver: $(shell find api api/server) | $(BIN_DIR)
go build -C api/server $(BUILD_OPTS) -ldflags="$(LDFLAGS)" -o $(ROOT_DIR)/$@ cmd/main.go
go -C $(ROOT_DIR)/api/server build $(BUILD_OPTS) -ldflags="$(LDFLAGS)" -o $(ROOT_DIR)/$@ cmd/main.go

bin/vmclarity-cli: $(shell find api cli utils core) | $(BIN_DIR)
go build -C cli $(BUILD_OPTS) -ldflags="$(LDFLAGS)" -o $(ROOT_DIR)/$@ cmd/main.go
go -C $(ROOT_DIR)/cli build $(BUILD_OPTS) -ldflags="$(LDFLAGS)" -o $(ROOT_DIR)/$@ cmd/main.go

bin/vmclarity-ui-backend: $(shell find api uibackend/server) | $(BIN_DIR)
go build -C uibackend/server $(BUILD_OPTS) -ldflags="$(LDFLAGS)" -o $(ROOT_DIR)/$@ cmd/main.go
go -C $(ROOT_DIR)/uibackend/server build $(BUILD_OPTS) -ldflags="$(LDFLAGS)" -o $(ROOT_DIR)/$@ cmd/main.go

bin/vmclarity-cr-discovery-server: $(shell find api containerruntimediscovery/server utils core) | $(BIN_DIR)
go build -C containerruntimediscovery/server $(BUILD_OPTS) -ldflags="$(LDFLAGS)" -o $(ROOT_DIR)/$@ cmd/main.go
go -C $(ROOT_DIR)/containerruntimediscovery/server build $(BUILD_OPTS) -ldflags="$(LDFLAGS)" -o $(ROOT_DIR)/$@ cmd/main.go

.PHONY: clean
clean: clean-ui clean-go ## Clean all build artifacts
Expand All @@ -100,7 +100,7 @@ clean-ui: ## Clean UI build
TIDYGOMODULES = $(addprefix tidy-, $(GOMODULES))

$(TIDYGOMODULES):
cd $(@:tidy-%=%) && go mod tidy -go=$(GO_VERSION)
go -C $(@:tidy-%=%) mod tidy -go=$(GO_VERSION)

.PHONY: gomod-tidy
gomod-tidy: $(TIDYGOMODULES) ## Run go mod tidy for all go modules
Expand All @@ -109,7 +109,7 @@ gomod-tidy: $(TIDYGOMODULES) ## Run go mod tidy for all go modules
MODLISTGOMODULES = $(addprefix modlist-, $(GOMODULES))

$(MODLISTGOMODULES):
cd $(@:modlist-%=%) && go list -m -mod=readonly all 1> /dev/null
go -C $(@:modlist-%=%) list -m -mod=readonly all 1> /dev/null

.PHONY: gomod-list
gomod-list: $(MODLISTGOMODULES)
Expand Down Expand Up @@ -153,12 +153,12 @@ endif

.PHONY: e2e
e2e: $(E2E_TARGETS) ## Run end-to-end test suite
$(E2E_ENV) go test -C e2e -v -failfast -test.v -test.paniconexit0 -timeout 2h -ginkgo.v .
$(E2E_ENV) go -C $(ROOT_DIR)/e2e test -v -failfast -test.v -test.paniconexit0 -timeout 2h -ginkgo.v .

VENDORMODULES = $(addprefix vendor-, $(GOMODULES))

$(VENDORMODULES):
cd $(@:vendor-%=%) && go mod vendor
go -C $(@:vendor-%=%) mod vendor

.PHONY: gomod-vendor
gomod-vendor: $(VENDORMODULES) # Make vendored copy of dependencies for all modules
Expand Down Expand Up @@ -209,7 +209,7 @@ endif
TESTGOMODULES = $(addprefix test-, $(GOMODULES))

$(TESTGOMODULES):
go test -C $(@:test-%=%) $(GOTEST_OPTS) ./...
go -C $(@:test-%=%) test $(GOTEST_OPTS) ./...

.PHONY: test
test: $(TESTGOMODULES) ## Run Go unit tests
Expand Down Expand Up @@ -288,21 +288,21 @@ gen-api: gen-apiserver-api gen-uibackend-api ## Generating API code
.PHONY: gen-apiserver-api
gen-apiserver-api: ## Generating Go library for API specification
$(info Generating API for backend code ...)
@go generate -C api/types
@go generate -C api/client
@go generate -C api/server
go -C $(ROOT_DIR)/api/types generate
go -C $(ROOT_DIR)/api/client generate
go -C $(ROOT_DIR)/api/server generate

.PHONY: gen-uibackend-api
gen-uibackend-api: ## Generating Go library for UI Backend API specification
$(info Generating API for UI backend code ...)
@go generate -C uibackend/types
@go generate -C uibackend/client
@go generate -C uibackend/server
go -C $(ROOT_DIR)/uibackend/types generate
go -C $(ROOT_DIR)/uibackend/client generate
go -C $(ROOT_DIR)/uibackend/server generate

.PHONY: gen-bicep
gen-bicep: bin/bicep ## Generating Azure Bicep template(s)
$(info Generating Azure Bicep template(s) ...)
@$(BICEP_BIN) build installation/azure/vmclarity.bicep
$(BICEP_BIN) build installation/azure/vmclarity.bicep

.PHONY: gen-helm-docs
gen-helm-docs: bin/helm-docs ## Generating documentation for Helm chart
Expand Down Expand Up @@ -337,7 +337,7 @@ $(DIST_DIR)/%/vmclarity-cli: $(shell find api cli utils core)
GOOS=$(firstword $(subst -, ,$*)) \
GOARCH=$(lastword $(subst -, ,$*)) \
CGO_ENABLED=0 \
go build -C cli/cmd -ldflags="$(LDFLAGS)" -o $@ main.go
go -C $(ROOT_DIR)/cli build -ldflags="$(LDFLAGS)" -o $@ cmd/main.go

$(DIST_DIR)/%/LICENSE: $(ROOT_DIR)/LICENSE
cp -v $< $@
Expand Down

0 comments on commit cc61a5c

Please sign in to comment.