Skip to content

Commit

Permalink
Merge pull request #1184 from Luap99/Makefile
Browse files Browse the repository at this point in the history
Makefile: several fixes
  • Loading branch information
openshift-merge-bot[bot] authored Feb 20, 2025
2 parents 60bf9a1 + f990a78 commit 57c637f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
2 changes: 0 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,8 @@ success_task:
API_URL_BASE: "https://api.cirrus-ci.com/v1/artifact/build/${CIRRUS_BUILD_ID}"
EXP_BINS: >-
netavark
netavark.debug
netavark.info
netavark.aarch64-unknown-linux-gnu
netavark.debug.aarch64-unknown-linux-gnu
netavark.info.aarch64-unknown-linux-gnu
clone_script: *noop
bin_cache: *ro_bin_cache
Expand Down
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ CARGO ?= cargo
CARGO_TARGET_DIR ?= targets
export CARGO_TARGET_DIR # 'cargo' is sensitive to this env. var. value.

SOURCES = src/** Cargo.toml Cargo.lock

ifdef debug
$(info debug is $(debug))
# These affect both $(CARGO_TARGET_DIR) layout and contents
Expand All @@ -41,7 +43,7 @@ else
endif

.PHONY: all
all: build
all: build docs

bin:
mkdir -p $@
Expand All @@ -50,12 +52,13 @@ $(CARGO_TARGET_DIR):
mkdir -p $@

.PHONY: build
build: build_netavark build_proxy_client
build: bin/netavark

.PHONY: build_netavark
build_netavark: bin $(CARGO_TARGET_DIR)
bin/netavark: $(SOURCES) bin $(CARGO_TARGET_DIR)
$(CARGO) build $(release)
cp $(CARGO_TARGET_DIR)/$(profile)/netavark bin/netavark$(if $(debug),.debug,)
cp $(CARGO_TARGET_DIR)/$(profile)/netavark bin/netavark
cp $(CARGO_TARGET_DIR)/$(profile)/netavark-dhcp-proxy-client bin/netavark-dhcp-proxy-client


.PHONY: examples
examples: bin $(CARGO_TARGET_DIR)
Expand Down Expand Up @@ -104,10 +107,12 @@ install: $(NV_UNIT_FILES)

.PHONY: uninstall
uninstall:
$(MAKE) -C docs uninstall
rm -f $(DESTDIR)$(LIBEXECPODMAN)/netavark
rm -f $(PREFIX)/share/man/man1/netavark*.1
rm -f ${DESTDIR}${SYSTEMDDIR}/netavark-dhcp-proxy.service
rm -f ${DESTDIR}${SYSTEMDDIR}/netavark-dhcp-proxy.socket
rm -f ${DESTDIR}${SYSTEMDDIR}/netavark-firewalld-reload.service

.PHONY: test
test: unit integration
Expand Down Expand Up @@ -152,8 +157,3 @@ mock-rpm:
.PHONY: help
help:
@echo "usage: make $(prog) [debug=1]"

.PHONY: build_proxy_client
build_proxy_client: bin $(CARGO_TARGET_DIR)
$(CARGO) build --bin netavark-dhcp-proxy-client $(release)
cp $(CARGO_TARGET_DIR)/$(profile)/netavark-dhcp-proxy-client bin/netavark-dhcp-proxy-client$(if $(debug),.debug,)
2 changes: 1 addition & 1 deletion contrib/cirrus/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ _run_noarg() {
_run_build() {
# Assume we're on a fast VM, compile everything needed by the
# rest of CI since subsequent tasks may have limited resources.
make all debug=1
make build_unit # reuses some debug binaries
make all # optimized/non-debug binaries
make examples # build the examples binaries needed by the integration tests
# This will get scooped up and become part of the artifact archive.
# Identify where the binary came from to benefit downstream consumers.
cat | tee bin/netavark.info << EOF
Expand Down
9 changes: 7 additions & 2 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@ docs: $(patsubst %.md,%,$(wildcard *.[0-9].md))
$(GO) install github.com/cpuguy83/go-md2man/v2@latest

.PHONY: install
install:
install: docs
install -d ${DESTDIR}/${MANDIR}/man1
install -m 0644 *.1 ${DESTDIR}/${MANDIR}/man1
install -d ${DESTDIR}/${MANDIR}/man7
install -m 0644 *.7 ${DESTDIR}/${MANDIR}/man7

.PHONY: uninstall
uninstall:
rm -f ${DESTDIR}/${MANDIR}/man1/*.1
rm -f ${DESTDIR}/${MANDIR}/man7/*.7

.PHONY: clean
clean:
$(RM) *.1
$(RM) *.1 *.7

0 comments on commit 57c637f

Please sign in to comment.