mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-04 11:06:21 +00:00
netmon: Build netmon from the master Makefile
This commit modifies the Makefile at the root of this repository so that the binary kata-netmon can be built from there. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
fca74356da
commit
f1315908c7
22
Makefile
22
Makefile
@ -39,6 +39,7 @@ SCRIPTS :=
|
|||||||
|
|
||||||
# list of binaries to install
|
# list of binaries to install
|
||||||
BINLIST :=
|
BINLIST :=
|
||||||
|
BINLIBEXECLIST :=
|
||||||
|
|
||||||
BIN_PREFIX = $(PROJECT_TYPE)
|
BIN_PREFIX = $(PROJECT_TYPE)
|
||||||
PROJECT_DIR = $(PROJECT_TAG)
|
PROJECT_DIR = $(PROJECT_TAG)
|
||||||
@ -49,6 +50,11 @@ TARGET = $(BIN_PREFIX)-runtime
|
|||||||
TARGET_OUTPUT = $(CURDIR)/$(TARGET)
|
TARGET_OUTPUT = $(CURDIR)/$(TARGET)
|
||||||
BINLIST += $(TARGET)
|
BINLIST += $(TARGET)
|
||||||
|
|
||||||
|
NETMON_DIR = netmon
|
||||||
|
NETMON_TARGET = $(PROJECT_TYPE)-netmon
|
||||||
|
NETMON_TARGET_OUTPUT = $(CURDIR)/$(NETMON_TARGET)
|
||||||
|
BINLIBEXECLIST += $(NETMON_TARGET)
|
||||||
|
|
||||||
DESTDIR := /
|
DESTDIR := /
|
||||||
|
|
||||||
installing = $(findstring install,$(MAKECMDGOALS))
|
installing = $(findstring install,$(MAKECMDGOALS))
|
||||||
@ -225,7 +231,12 @@ define SHOW_ARCH
|
|||||||
$(shell printf "\\t%s%s\\\n" "$(1)" $(if $(filter $(ARCH),$(1))," (default)",""))
|
$(shell printf "\\t%s%s\\\n" "$(1)" $(if $(filter $(ARCH),$(1))," (default)",""))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
all: runtime
|
all: runtime netmon
|
||||||
|
|
||||||
|
netmon: $(NETMON_TARGET_OUTPUT)
|
||||||
|
|
||||||
|
$(NETMON_TARGET_OUTPUT): $(SOURCES)
|
||||||
|
$(QUIET_BUILD)(cd $(NETMON_DIR) && go build -i -o $@ -ldflags "-X main.version=$(VERSION)")
|
||||||
|
|
||||||
runtime: $(TARGET_OUTPUT) $(CONFIG)
|
runtime: $(TARGET_OUTPUT) $(CONFIG)
|
||||||
.DEFAULT: default
|
.DEFAULT: default
|
||||||
@ -405,11 +416,14 @@ check-go-static:
|
|||||||
coverage:
|
coverage:
|
||||||
$(QUIET_TEST).ci/go-test.sh html-coverage
|
$(QUIET_TEST).ci/go-test.sh html-coverage
|
||||||
|
|
||||||
install: default runtime install-scripts install-completions install-config install-bin
|
install: default runtime install-scripts install-completions install-config install-bin install-bin-libexec
|
||||||
|
|
||||||
install-bin: $(BINLIST)
|
install-bin: $(BINLIST)
|
||||||
$(foreach f,$(BINLIST),$(call INSTALL_EXEC,$f,$(BINDIR)))
|
$(foreach f,$(BINLIST),$(call INSTALL_EXEC,$f,$(BINDIR)))
|
||||||
|
|
||||||
|
install-bin-libexec: $(BINLIBEXECLIST)
|
||||||
|
$(foreach f,$(BINLIBEXECLIST),$(call INSTALL_EXEC,$f,$(PKGLIBEXECDIR)))
|
||||||
|
|
||||||
install-config: $(CONFIG)
|
install-config: $(CONFIG)
|
||||||
$(QUIET_INST)install --mode 0644 -D $(CONFIG) $(DESTDIR)/$(CONFIG_PATH)
|
$(QUIET_INST)install --mode 0644 -D $(CONFIG) $(DESTDIR)/$(CONFIG_PATH)
|
||||||
|
|
||||||
@ -420,7 +434,7 @@ install-completions:
|
|||||||
$(QUIET_INST)install --mode 0644 -D $(BASH_COMPLETIONS) $(DESTDIR)/$(BASH_COMPLETIONSDIR)/$(notdir $(BASH_COMPLETIONS));
|
$(QUIET_INST)install --mode 0644 -D $(BASH_COMPLETIONS) $(DESTDIR)/$(BASH_COMPLETIONSDIR)/$(notdir $(BASH_COMPLETIONS));
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(QUIET_CLEAN)rm -f $(TARGET) $(CONFIG) $(GENERATED_GO_FILES) $(GENERATED_FILES) $(COLLECT_SCRIPT)
|
$(QUIET_CLEAN)rm -f $(TARGET) $(NETMON_TARGET) $(CONFIG) $(GENERATED_GO_FILES) $(GENERATED_FILES) $(COLLECT_SCRIPT)
|
||||||
|
|
||||||
show-usage: show-header
|
show-usage: show-header
|
||||||
@printf "• Overview:\n"
|
@printf "• Overview:\n"
|
||||||
@ -483,6 +497,8 @@ show-summary: show-header
|
|||||||
@printf "\tbinaries to install :\n"
|
@printf "\tbinaries to install :\n"
|
||||||
@printf \
|
@printf \
|
||||||
"$(foreach b,$(sort $(BINLIST)),$(shell printf "\\t - $(shell readlink -m $(DESTDIR)/$(BINDIR)/$(b))\\\n"))"
|
"$(foreach b,$(sort $(BINLIST)),$(shell printf "\\t - $(shell readlink -m $(DESTDIR)/$(BINDIR)/$(b))\\\n"))"
|
||||||
|
@printf \
|
||||||
|
"$(foreach b,$(sort $(BINLIBEXECLIST)),$(shell printf "\\t - $(shell readlink -m $(DESTDIR)/$(PKGLIBEXECDIR)/$(b))\\\n"))"
|
||||||
@printf \
|
@printf \
|
||||||
"$(foreach s,$(sort $(SCRIPTS)),$(shell printf "\\t - $(shell readlink -m $(DESTDIR)/$(BINDIR)/$(s))\\\n"))"
|
"$(foreach s,$(sort $(SCRIPTS)),$(shell printf "\\t - $(shell readlink -m $(DESTDIR)/$(BINDIR)/$(s))\\\n"))"
|
||||||
@printf "\tconfig to install (CONFIG) : %s\n" $(CONFIG)
|
@printf "\tconfig to install (CONFIG) : %s\n" $(CONFIG)
|
||||||
|
@ -60,8 +60,7 @@ type Route struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
netmonName = "kata-netmon"
|
netmonName = "kata-netmon"
|
||||||
netmonVersion = "0.0.1"
|
|
||||||
|
|
||||||
kataCmd = "kata-network"
|
kataCmd = "kata-network"
|
||||||
kataCLIAddIfaceCmd = "add-iface"
|
kataCLIAddIfaceCmd = "add-iface"
|
||||||
@ -83,6 +82,9 @@ const (
|
|||||||
storageFilePerm = os.FileMode(0640)
|
storageFilePerm = os.FileMode(0640)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// version is the netmon version. This variable is populated at build time.
|
||||||
|
var version = "unknown"
|
||||||
|
|
||||||
type netmonParams struct {
|
type netmonParams struct {
|
||||||
sandboxID string
|
sandboxID string
|
||||||
runtimePath string
|
runtimePath string
|
||||||
@ -110,7 +112,7 @@ type netmon struct {
|
|||||||
var netmonLog = logrus.New()
|
var netmonLog = logrus.New()
|
||||||
|
|
||||||
func printVersion() {
|
func printVersion() {
|
||||||
fmt.Printf("%s version %s\n", netmonName, netmonVersion)
|
fmt.Printf("%s version %s\n", netmonName, version)
|
||||||
}
|
}
|
||||||
|
|
||||||
const componentDescription = `is a network monitoring process that is intended to be started in the
|
const componentDescription = `is a network monitoring process that is intended to be started in the
|
||||||
|
Loading…
Reference in New Issue
Block a user