don't hardcode /usr/share paths
Add a defines.mk file defining the standard default layout for installation (PREFIX, DATAROOTDIR, LIBDIR etc.). Add a $(JSDIR) variable and use env!("JSDIR") in place of the hardcoded /usr/share/javascript/proxmox-backup path. Have defines.mk include an *optional* local.mak to override JSDIR to www/ during local development. Add `make install` targets and remove debian/install. Note that service files are now in $libdir/proxmox-backup/ as there's usually no point in starting them from the command line, so /usr/sbin makes no sense. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
47
Makefile
47
Makefile
@ -1,14 +1,31 @@
|
||||
PACKAGE=proxmox-backup
|
||||
PKGVER=0.1
|
||||
PKGREL=1
|
||||
include defines.mk
|
||||
|
||||
ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
|
||||
GITVERSION:=$(shell git rev-parse HEAD)
|
||||
|
||||
# Binaries usable by users
|
||||
USR_BIN := \
|
||||
proxmox-backup-client \
|
||||
catar
|
||||
|
||||
# Binaries usable by admins
|
||||
USR_SBIN := proxmox-backup-manager
|
||||
|
||||
# Binaries for services:
|
||||
SERVICE_BIN := \
|
||||
proxmox-backup-api \
|
||||
proxmox-backup-proxy
|
||||
|
||||
COMPILEDIR := target/release
|
||||
COMPILED_BINS := \
|
||||
$(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN))
|
||||
|
||||
export PROXMOX_PKG_VERSION=${PKGVER}
|
||||
export PROXMOX_PKG_RELEASE=${PKGREL}
|
||||
export PROXMOX_PKG_REPOID=${GITVERSION}
|
||||
|
||||
export PROXMOX_JSDIR := $(JSDIR)
|
||||
|
||||
DEB=${PACKAGE}_${PKGVER}-${PKGREL}_${ARCH}.deb
|
||||
|
||||
DESTDIR=
|
||||
@ -24,15 +41,15 @@ deb ${DEB}:
|
||||
rm -rf build
|
||||
# build here to cache results
|
||||
cargo build --release
|
||||
make -C www
|
||||
rsync -a debian Cargo.lock Cargo.toml src www target build
|
||||
$(MAKE) -C www
|
||||
rsync -a debian Cargo.toml src www etc target build
|
||||
cd build; dpkg-buildpackage -b -us -uc
|
||||
|
||||
|
||||
distclean: clean
|
||||
|
||||
clean:
|
||||
make -C www clean
|
||||
$(MAKE) -C www clean
|
||||
cargo clean
|
||||
rm -rf *.deb *.buildinfo *.changes build
|
||||
find . -name '*~' -exec rm {} ';'
|
||||
@ -40,3 +57,21 @@ clean:
|
||||
.PHONY: dinstall
|
||||
dinstall: ${DEB}
|
||||
dpkg -i ${DEB}
|
||||
|
||||
.PHONY: build-release
|
||||
build-release:
|
||||
cargo build --release
|
||||
|
||||
$(COMPILED_BINS): build-release
|
||||
|
||||
install: $(COMPILED_BINS)
|
||||
install -dm755 $(DESTDIR)$(BINDIR)
|
||||
$(foreach i,$(USR_BIN), \
|
||||
install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ;)
|
||||
install -dm755 $(DESTDIR)$(SBINDIR)
|
||||
$(foreach i,$(USR_SBIN), \
|
||||
install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(SBINDIR)/ ;)
|
||||
install -dm755 $(DESTDIR)$(LIBDIR)/proxmox-backup
|
||||
$(foreach i,$(SERVICE_BIN), \
|
||||
install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBDIR)/proxmox-backup/ ;)
|
||||
$(MAKE) -C www install
|
||||
|
Reference in New Issue
Block a user