Refactor Makefile config / Defaults.mk
Makefile has included a Defaults.mk file to store variable configuration from one run for implicit inclusion in future runs, but the creation of this file has been automatic and opaque, and the state of it managed by a series of PHONY targets (e.g., config, genconfig, rm_config). This commit refactors config to name its files explicitly (so they can be more properly monitored by make) and makes the generation of Defaults.mk explicit so that its behavior is more obvious. Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
@@ -7,8 +7,7 @@ RUN zypper -n install --no-recommends git go1.18 libgpgme-devel &&\
|
|||||||
COPY . /warewulf-src
|
COPY . /warewulf-src
|
||||||
|
|
||||||
RUN cd /warewulf-src &&\
|
RUN cd /warewulf-src &&\
|
||||||
make contclean &&\
|
make contclean Defaults.mk \
|
||||||
make genconfig \
|
|
||||||
PREFIX=/usr \
|
PREFIX=/usr \
|
||||||
BINDIRa=/usr/bin \
|
BINDIRa=/usr/bin \
|
||||||
SYSCONFDIR=/etc \
|
SYSCONFDIR=/etc \
|
||||||
|
|||||||
25
Makefile
25
Makefile
@@ -27,18 +27,16 @@ endif
|
|||||||
$(TOOLS_DIR):
|
$(TOOLS_DIR):
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
config:
|
.PHONY: config
|
||||||
printf " $(foreach V,$(VARLIST),$V := $(strip $($V))\n)" > Defaults.mk
|
config: etc/wwapic.conf \
|
||||||
find . -type f -name "*.in" -not -path "./vendor/*" \
|
etc/wwapid.conf \
|
||||||
-exec sh -c 'sed -ne "$(foreach V,$(VARLIST),s,@$V@,$(strip $($V)),g;)p" $${0} > $${0%.in}' {} \;
|
etc/wwapird.conf \
|
||||||
touch config
|
include/systemd/warewulfd.service \
|
||||||
|
internal/pkg/config/buildconfig.go \
|
||||||
|
warewulf.spec
|
||||||
|
|
||||||
.PHONY: rm_config
|
%: %.in
|
||||||
rm_config:
|
sed -ne "$(foreach V,$(VARLIST),s,@$V@,$(strip $($V)),g;)p" $@.in >$@
|
||||||
rm -f config
|
|
||||||
|
|
||||||
.PHONY: genconfig
|
|
||||||
genconfig: rm_config config
|
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: setup_tools
|
lint: setup_tools
|
||||||
@@ -183,11 +181,10 @@ wwapird:
|
|||||||
|
|
||||||
.PHONY: contclean
|
.PHONY: contclean
|
||||||
contclean:
|
contclean:
|
||||||
|
rm -f Defaults.mk
|
||||||
rm -f $(WAREWULF)-$(VERSION).tar.gz
|
rm -f $(WAREWULF)-$(VERSION).tar.gz
|
||||||
rm -f bash_completion
|
rm -f bash_completion
|
||||||
rm -f config
|
rm -f config_defaults
|
||||||
rm -f config_defaults
|
|
||||||
rm -f Defaults.mk
|
|
||||||
rm -f etc/wwapi{c,d,rd}.conf
|
rm -f etc/wwapi{c,d,rd}.conf
|
||||||
rm -f etc/wwapi{c,d,rd}.config
|
rm -f etc/wwapi{c,d,rd}.config
|
||||||
rm -f include/systemd/warewulfd.service
|
rm -f include/systemd/warewulfd.service
|
||||||
|
|||||||
@@ -97,3 +97,6 @@ export GOPROXY
|
|||||||
|
|
||||||
# built tags needed for wwbuild binary
|
# built tags needed for wwbuild binary
|
||||||
WW_GO_BUILD_TAGS := containers_image_openpgp containers_image_ostree
|
WW_GO_BUILD_TAGS := containers_image_openpgp containers_image_ostree
|
||||||
|
|
||||||
|
Defaults.mk:
|
||||||
|
printf " $(foreach V,$(VARLIST),$V := $(strip $($V))\n)" >Defaults.mk
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ Vagrantfile
|
|||||||
git clone https://github.com/hpcng/warewulf.git
|
git clone https://github.com/hpcng/warewulf.git
|
||||||
cd warewulf
|
cd warewulf
|
||||||
git checkout v4.4.0
|
git checkout v4.4.0
|
||||||
make genconfig \
|
make clean Defaults.mk \
|
||||||
PREFIX=/usr \
|
PREFIX=/usr \
|
||||||
BINDIR=/usr/bin \
|
BINDIR=/usr/bin \
|
||||||
SYSCONFDIR=/etc \
|
SYSCONFDIR=/etc \
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ Install Warewulf and dependencies
|
|||||||
|
|
||||||
git clone https://github.com/hpcng/warewulf.git
|
git clone https://github.com/hpcng/warewulf.git
|
||||||
cd warewulf
|
cd warewulf
|
||||||
make genconfig \
|
make clean Defaults.mk \
|
||||||
PREFIX=/usr \
|
PREFIX=/usr \
|
||||||
BINDIR=/usr/bin \
|
BINDIR=/usr/bin \
|
||||||
SYSCONFDIR=/etc \
|
SYSCONFDIR=/etc \
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Install Warewulf and dependencies
|
|||||||
|
|
||||||
git clone https://github.com/hpcng/warewulf.git
|
git clone https://github.com/hpcng/warewulf.git
|
||||||
cd warewulf
|
cd warewulf
|
||||||
make genconfig \
|
make clean Defaults.mk \
|
||||||
PREFIX=/usr \
|
PREFIX=/usr \
|
||||||
BINDIR=/usr/bin \
|
BINDIR=/usr/bin \
|
||||||
SYSCONFDIR=/etc \
|
SYSCONFDIR=/etc \
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Install Warewulf and dependencies
|
|||||||
|
|
||||||
git clone https://github.com/hpcng/warewulf.git
|
git clone https://github.com/hpcng/warewulf.git
|
||||||
cd warewulf
|
cd warewulf
|
||||||
PREFIX=/usr SYSCONFDIR=/etc TFTPDIR=/srv/tftproot LOCALSTATEDIR=/var/lib make genconfig
|
PREFIX=/usr SYSCONFDIR=/etc TFTPDIR=/srv/tftproot LOCALSTATEDIR=/var/lib make clean Defaults.mk
|
||||||
make all
|
make all
|
||||||
sudo make install
|
sudo make install
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ system for large clusters of bare metal and/or virtual systems.
|
|||||||
%build
|
%build
|
||||||
%{?with_offline:OFFLINE_BUILD=1}
|
%{?with_offline:OFFLINE_BUILD=1}
|
||||||
# Install to sharedstatedir by redirecting LOCALSTATEDIR
|
# Install to sharedstatedir by redirecting LOCALSTATEDIR
|
||||||
make genconfig \
|
make Defaults.mk \
|
||||||
PREFIX=%{_prefix} \
|
PREFIX=%{_prefix} \
|
||||||
BINDIR=%{_bindir} \
|
BINDIR=%{_bindir} \
|
||||||
SYSCONFDIR=%{_sysconfdir} \
|
SYSCONFDIR=%{_sysconfdir} \
|
||||||
@@ -92,7 +92,8 @@ make
|
|||||||
|
|
||||||
%install
|
%install
|
||||||
export NO_BRP_STALE_LINK_ERROR=yes
|
export NO_BRP_STALE_LINK_ERROR=yes
|
||||||
make install DESTDIR=%{buildroot}
|
make install \
|
||||||
|
DESTDIR=%{buildroot}
|
||||||
|
|
||||||
|
|
||||||
%pre
|
%pre
|
||||||
|
|||||||
Reference in New Issue
Block a user