Skip to content

Commit

Permalink
Migrate Makefile to use alpha-build-machinery
Browse files Browse the repository at this point in the history
  • Loading branch information
tnozicka authored and damemi committed Oct 15, 2019
1 parent 1fbba8b commit fe5f72a
Showing 1 changed file with 32 additions and 20 deletions.
52 changes: 32 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,33 +1,45 @@
all: build
.PHONY: all

RUNTIME ?= podman
RUNTIME_IMAGE_NAME ?= openshift-api-generator
# Include the library makefile
include $(addprefix ./hack/alpha-build-machinery/make/, \
golang.mk \
targets/openshift/deps.mk \
targets/openshift/crd-schema-gen.mk \
)

build:
go build github.com/openshift/api/...
.PHONY: build
GO_PACKAGES :=$(addsuffix ...,$(addprefix ./,$(filter-out vendor/,$(filter-out hack/,$(wildcard */)))))
GO_BUILD_PACKAGES :=$(GO_PACKAGES)
GO_BUILD_PACKAGES_EXPANDED :=$(GO_BUILD_PACKAGES)
# LDFLAGS are not needed for dummy builds (saving time on calling git commands)
GO_LD_FLAGS:=

test:
go test github.com/openshift/api/...
.PHONY: test
# Set crd-schema-gen variables
CONTROLLER_GEN_VERSION :=v0.2.1

verify:
# $1 - target name
# $2 - apis
# $3 - manifests
# $4 - output
$(call add-crd-gen,config,./config/v1,./config/v1,./config/v1)

RUNTIME ?= podman
RUNTIME_IMAGE_NAME ?= openshift-api-generator

verify-scripts:
bash -x hack/verify-deepcopy.sh
bash -x hack/verify-protobuf.sh
bash -x hack/verify-swagger-docs.sh
.PHONY: verify

update-deps:
hack/update-deps.sh
.PHONY: update-deps
.PHONY: verify-scripts
verify: verify-scripts

generate-with-container: Dockerfile.build
$(RUNTIME) build -t $(RUNTIME_IMAGE_NAME) -f Dockerfile.build .
$(RUNTIME) run -ti --rm -v $(PWD):/go/src/github.com/openshift/api:z -w /go/src/github.com/openshift/api $(RUNTIME_IMAGE_NAME) make generate

generate:
update-scripts:
hack/update-deepcopy.sh
hack/update-protobuf.sh
hack/update-swagger-docs.sh
.PHONY: generate
.PHONY: update-scripts
update: update-scripts

generate-with-container: Dockerfile.build
$(RUNTIME) build -t $(RUNTIME_IMAGE_NAME) -f Dockerfile.build .
$(RUNTIME) run -ti --rm -v $(PWD):/go/src/github.com/openshift/api:z -w /go/src/github.com/openshift/api $(RUNTIME_IMAGE_NAME) make update-scripts

0 comments on commit fe5f72a

Please sign in to comment.