diff options
Diffstat (limited to '')
| -rw-r--r-- | Makefile | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..65b8d54 --- /dev/null +++ b/Makefile @@ -0,0 +1,63 @@ +.POSIX: + +all: + +CONFIGFILE = config.mk +include $(CONFIGFILE) + +include mk/gasroot-gtk2=$(INCLUDE_GTK2).mk +include mk/gasroot-gtk3=$(INCLUDE_GTK3).mk + +BIN =\ + $(BIN_GTK2)\ + $(BIN_GTK3)\ + gasroot-setuid + +OBJ = common.o $(BIN:=.o) +HDR = common.h arg.h + +SUDOCMD = @: +# developers will set this to "sudo" or similar + +all: $(BIN) +common: gasroot-setuid +$(OBJ): $(HDR) +$(BIN): common.o + +.c.o: + $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS) -D'PATH_TO_SETUID="$(PATH_TO_SETUID)"' + +gasroot-setuid: gasroot-setuid.o + $(CC) -o $@ $@.o common.o $(LDFLAGS) $(LDFLAGS_SETUID) + $(SUDOCMD) sh -c 'chown 0:wheel gasroot-setuid && chmod 4750 gasroot-setuid' + +install-common: gasroot-setuid + mkdir -p -- "$(DESTDIR)$(PREFIX)/bin" + mkdir -p -- "$(DESTDIR)$(PREFIX)$(LIBEXECDIR)" + mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man8/" + cp -- gasroot.8 "$(DESTDIR)$(MANPREFIX)/man8/" + cp -- gasroot-setuid "$(DESTDIR)$(PREFIX)$(LIBEXECDIR)/" + +install: install-common + test -f "$(DESTDIR)$(PREFIX)/bin/$(DEFAULT_GASROOT)" + test ! -d "$(DESTDIR)$(PREFIX)/bin/gasroot" + ln -sf -- $(DEFAULT_GASROOT) "$(DESTDIR)$(PREFIX)/bin/gasroot" + +post-install: + chown -- '0:wheel' "$(DESTDIR)$(PREFIX)$(LIBEXECDIR)/gasroot-setuid" + chmod -- 4750 "$(DESTDIR)$(PREFIX)$(LIBEXECDIR)/gasroot-setuid" + +uninstall: + -rm -f -- "$(DESTDIR)$(PREFIX)/bin/gasroot" + -rm -f -- "$(DESTDIR)$(PREFIX)$(LIBEXECDIR)/gasroot-setuid" + -rmdir -- "$(DESTDIR)$(PREFIX)$(LIBEXECDIR)" + -rm -f -- "$(DESTDIR)$(MANPREFIX)/man8/gasroot.8" + +clean: + -rm -f -- *.o *.a *.lo *.su *.so *.so.* *.gch *.gcov *.gcno *.gcda + -rm -f -- gasroot gasroot-setuid gasroot-gtk2 gasroot-gtk3 + +.SUFFIXES: +.SUFFIXES: .o .c + +.PHONY: all install install-common post-install uninstall clean |
