2010-01-16 01:11:44 +00:00
|
|
|
include ../vars.mk
|
|
|
|
|
2011-07-14 11:24:00 +00:00
|
|
|
SCRIPTS = chroot-helper doinst-helper getdeps-helper
|
|
|
|
MOUNT_BIN = capmount
|
|
|
|
UMOUNT_BIN = capumount
|
|
|
|
CHROOT_BIN = capchroot
|
2010-04-26 12:15:49 +00:00
|
|
|
BINS = $(CHROOT_BIN) $(MOUNT_BIN) $(UMOUNT_BIN)
|
|
|
|
WFLAGS = -Wall -Werror
|
|
|
|
LDFLAGS = -lcap
|
|
|
|
|
|
|
|
ifdef IN_CHROOT
|
|
|
|
BINS =
|
|
|
|
endif
|
2010-01-16 01:11:44 +00:00
|
|
|
|
|
|
|
.PHONY: all
|
2010-04-26 12:15:49 +00:00
|
|
|
all: $(BINS)
|
2011-07-14 11:24:00 +00:00
|
|
|
for bin in $(SCRIPTS); do \
|
2010-01-16 01:11:44 +00: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 12:15:49 +00:00
|
|
|
-e "s|@@XBPS_INSTALL_LIBEXECDIR@@|$(LIBEXECDIR)|g" \
|
2010-01-16 01:11:44 +00:00
|
|
|
$$bin.sh.in > $$bin; \
|
|
|
|
done
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2011-07-14 11:24:00 +00:00
|
|
|
-rm -f $(BINS) $(SCRIPTS)
|
2010-01-16 01:11:44 +00:00
|
|
|
|
|
|
|
.PHONY: install
|
|
|
|
install: all
|
|
|
|
install -d $(DESTDIR)$(LIBEXECDIR)
|
2011-07-14 11:24:00 +00:00
|
|
|
for bin in $(SCRIPTS); do \
|
2010-04-26 12:15:49 +00:00
|
|
|
install -m755 $$bin $(DESTDIR)$(LIBEXECDIR); \
|
2010-01-16 01:11:44 +00:00
|
|
|
done
|
2010-04-26 12:15:49 +00: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 01:11:44 +00:00
|
|
|
|
|
|
|
.PHONY: uninstall
|
|
|
|
uninstall:
|
2011-07-14 11:24:00 +00:00
|
|
|
for bin in $(BINS) $(SCRIPTS); do \
|
2010-01-16 01:11:44 +00:00
|
|
|
rm -f $(DESTDIR)$(LIBEXECDIR)/$$bin; \
|
|
|
|
done
|
2010-04-26 12:15:49 +00: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 $@
|