Skip to content

Commit

Permalink
make build supports selectively compiling some of the binaries
Browse files Browse the repository at this point in the history
Signed-off-by: adam <[email protected]>
  • Loading branch information
adam committed Sep 26, 2024
1 parent 46b84d4 commit d29ceb0
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ APPS2 := mdacore
APPS3 := kmesh-cni
APPS4 := kmeshctl

APPS := kmesh-daemon mdacore kmesh-cni kmeshctl

ifeq ($(BINARIES),)
BINARIES := $(APPS)
endif


# If the hub is not explicitly set, use default to kmesh-net.
HUB ?= ghcr.io/kmesh-net
Expand Down Expand Up @@ -79,13 +85,13 @@ all:

$(QUIET) make -C api/v2-c
$(QUIET) make -C bpf/deserialization_to_bpf_map

$(QUIET) $(GO) generate bpf/kmesh/bpf2go/bpf2go.go

$(call printlog, BUILD, $(APPS1))
$(QUIET) (export PKG_CONFIG_PATH=$(PKG_CONFIG_PATH):$(ROOT_DIR)mk; \
$(GO) build -ldflags $(LDFLAGS) -tags $(ENHANCED_KERNEL) -o $(APPS1) $(GOFLAGS) ./daemon/main.go)

$(call printlog, BUILD, "kernel")
$(QUIET) make -C kernel/ko_src

Expand Down Expand Up @@ -151,6 +157,33 @@ uninstall:
build:
VERSION=$(VERSION) ./kmesh_compile.sh

# Build kmesh-daemon if included in BINARIES
$(QUIET) ifneq ($(filter kmesh-daemon,$(BINARIES)),)
$(call printlog, BUILD, $(APPS1))
$(QUIET) (export PKG_CONFIG_PATH=$(PKG_CONFIG_PATH):$(ROOT_DIR)mk; \
$(GO) build -ldflags $(LDFLAGS) -tags $(ENHANCED_KERNEL) -o $(APPS1) $(GOFLAGS) ./daemon/main.go)
$(QUIET) endif

# Build mdacore if included in BINARIES
$(QUIET) ifneq ($(filter mdacore,$(BINARIES)),)
$(call printlog, BUILD, $(APPS2))
$(QUIET) cd oncn-mda && cmake . -B build && make -C build
$(QUIET) endif

# Build kmesh-cni if included in BINARIES
$(QUIET) ifneq ($(filter kmesh-cni,$(BINARIES)),)
$(call printlog, BUILD, $(APPS3))
$(QUIET) (export PKG_CONFIG_PATH=$(PKG_CONFIG_PATH):$(ROOT_DIR)mk; \
$(GO) build -ldflags $(LDFLAGS) -tags $(ENHANCED_KERNEL) -o $(APPS3) $(GOFLAGS) ./cniplugin/main.go)
$(QUIET) endif

# Build kmeshctl if included in BINARIES
$(QUIET) ifneq ($(filter kmeshctl,$(BINARIES)),)
$(call printlog, BUILD, $(APPS4))
$(QUIET) (export PKG_CONFIG_PATH=$(PKG_CONFIG_PATH):$(ROOT_DIR)mk; \
$(GO) build -ldflags $(LDFLAGS) -o $(APPS4) $(GOFLAGS) ./ctl/main.go)
$(QUIET) endif

.PHONY: docker
docker: build
docker build -f build/docker/dockerfile -t $(HUB)/$(TARGET):$(TAG) .
Expand Down

0 comments on commit d29ceb0

Please sign in to comment.