2010-01-16 02:11:44 +01:00
|
|
|
include ../vars.mk
|
|
|
|
|
2011-07-14 12:53:52 +02:00
|
|
|
SH_BINS = xbps-src-chroot-helper xbps-src-doinst-helper xbps-src-getdeps-helper
|
2010-04-26 14:15:49 +02:00
|
|
|
MOUNT_BIN = xbps-src-chroot-capmount
|
|
|
|
UMOUNT_BIN = xbps-src-chroot-capumount
|
|
|
|
CHROOT_BIN = xbps-src-capchroot
|
|
|
|
BINS = $(CHROOT_BIN) $(MOUNT_BIN) $(UMOUNT_BIN)
|
|
|
|
WFLAGS = -Wall -Werror
|
|
|
|
LDFLAGS = -lcap
|
|
|
|
|
|
|
|
ifdef IN_CHROOT
|
|
|
|
BINS =
|
|
|
|
endif
|
2010-01-16 02:11:44 +01:00
|
|
|
|
|
|
|
.PHONY: all
|
2010-04-26 14:15:49 +02:00
|
|
|
all: $(BINS)
|
|
|
|
for bin in $(SH_BINS); do \
|
2010-01-16 02:11:44 +01:00
|
|
|
sed -e "s|@@XBPS_INSTALL_PREFIX@@|$(PREFIX)|g" \
|
|
|
|
-e "s|@@XBPS_INSTALL_ETCDIR@@|$(ETCDIR)|g" \
|
|
|
|
-e "s|@@XBPS_INSTALL_SHAREDIR@@|$(SHAREDIR)|g" \
|
|
|
|
-e "s|@@XBPS_INSTALL_SBINDIR@@|$(SBINDIR)|g" \
|
2010-04-26 14:15:49 +02:00
|
|
|
-e "s|@@XBPS_INSTALL_LIBEXECDIR@@|$(LIBEXECDIR)|g" \
|
2010-01-16 02:11:44 +01:00
|
|
|
$$bin.sh.in > $$bin; \
|
|
|
|
done
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2010-04-26 14:15:49 +02:00
|
|
|
-rm -f $(BINS) $(SH_BINS)
|
2010-01-16 02:11:44 +01:00
|
|
|
|
|
|
|
.PHONY: install
|
|
|
|
install: all
|
|
|
|
install -d $(DESTDIR)$(LIBEXECDIR)
|
2010-04-26 14:15:49 +02:00
|
|
|
for bin in $(SH_BINS); do \
|
|
|
|
install -m755 $$bin $(DESTDIR)$(LIBEXECDIR); \
|
2010-01-16 02:11:44 +01:00
|
|
|
done
|
2010-04-26 14:15:49 +02:00
|
|
|
ifdef BINS
|
|
|
|
install -m755 $(MOUNT_BIN) $(DESTDIR)$(LIBEXECDIR)
|
|
|
|
setcap cap_sys_admin=ep $(DESTDIR)$(LIBEXECDIR)/$(MOUNT_BIN)
|
|
|
|
install -m755 $(UMOUNT_BIN) $(DESTDIR)$(LIBEXECDIR)
|
|
|
|
setcap cap_sys_admin=ep $(DESTDIR)$(LIBEXECDIR)/$(UMOUNT_BIN)
|
|
|
|
install -m755 $(CHROOT_BIN) $(DESTDIR)$(LIBEXECDIR)
|
|
|
|
setcap cap_sys_chroot=ep $(DESTDIR)$(LIBEXECDIR)/$(CHROOT_BIN)
|
|
|
|
endif
|
2010-01-16 02:11:44 +01:00
|
|
|
|
|
|
|
.PHONY: uninstall
|
|
|
|
uninstall:
|
2010-04-26 14:15:49 +02:00
|
|
|
for bin in $(BINS) $(SH_BINS); do \
|
2010-01-16 02:11:44 +01:00
|
|
|
rm -f $(DESTDIR)$(LIBEXECDIR)/$$bin; \
|
|
|
|
done
|
2010-04-26 14:15:49 +02:00
|
|
|
|
|
|
|
$(MOUNT_BIN):
|
|
|
|
$(CC) $(WFLAGS) $(LDFLAGS) mount.c -o $@
|
|
|
|
|
|
|
|
$(UMOUNT_BIN):
|
|
|
|
$(CC) $(WFLAGS) $(LDFLAGS) umount.c -o $@
|
|
|
|
|
|
|
|
$(CHROOT_BIN):
|
|
|
|
$(CC) $(WFLAGS) $(LDFLAGS) chroot.c -o $@
|