Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ PAM_NAME := pam_$(NAME)

###### Makefile Command Line Flags ######
#
# BIN: The locaton where binaries will be built. Default: ./bin
# INSTALL: The tool used to install binaries. Default: sudo install
# DESTDIR: Prefix for all install paths Default: ""
# BINDIR: The location for the fscrypt binary. Default: /usr/local/bin
# PAM_MODULE_DIR: The location for pam_fscrypt.so. Default: /lib/security
# BIN: The location where binaries will be built. Default: bin
# DESTDIR: Installation destination directory. Default: ""
# PREFIX: Installation path prefix. Default: /usr/local
# BINDIR: Where to install the fscrypt binary. Default: $(PREFIX)/bin
# PAM_MODULE_DIR: Where to install pam_fscrypt.so. Default: $(PREFIX)/lib/security
# PAM_CONFIG_DIR: Where to install Ubuntu PAM config. Default: $(PREFIX)/share/pam-configs
#
# MOUNT: The filesystem where our tests are run. Default: /mnt/fscrypt_mount
# Ex: make test-setup MOUNT=/foo/bar
Expand Down Expand Up @@ -152,24 +153,26 @@ PREFIX := /usr/local
BINDIR := $(PREFIX)/bin

install-bin: $(BIN)/$(NAME)
install -d $(DESTDIR)/$(BINDIR)
install $< $(DESTDIR)/$(BINDIR)
install -d $(DESTDIR)$(BINDIR)
install $< $(DESTDIR)$(BINDIR)

PAM_MODULE_DIR := $(PREFIX)/lib/security
PAM_INSTALL_PATH := $(PAM_MODULE_DIR)/$(PAM_NAME).so
PAM_CONFIG := $(BIN)/config
PAM_CONFIG_DIR := $(PREFIX)/share/pam-configs

install-pam: $(PAM_MODULE)
install -d $(DESTDIR)/$(PAM_MODULE_DIR)
install $(PAM_MODULE) $(DESTDIR)/$(PAM_MODULE_DIR)
install -d $(DESTDIR)$(PAM_MODULE_DIR)
install $(PAM_MODULE) $(DESTDIR)$(PAM_MODULE_DIR)

m4 --define=PAM_INSTALL_PATH=$(PAM_INSTALL_PATH) < $(PAM_NAME)/config > $(PAM_CONFIG)
install -d $(DESTDIR)/$(PAM_CONFIG_DIR)
install $(PAM_CONFIG) $(DESTDIR)/$(PAM_CONFIG_DIR)/$(NAME)
install -d $(DESTDIR)$(PAM_CONFIG_DIR)
install $(PAM_CONFIG) $(DESTDIR)$(PAM_CONFIG_DIR)/$(NAME)

uninstall:
rm -f $(DESTDIR)/$(BINDIR)/$(NAME) $(DESTDIR)/$(PAM_INSTALL_PATH) $(DESTDIR)/$(PAM_CONFIG_DIR)/$(NAME)
rm -f $(DESTDIR)$(BINDIR)/$(NAME) \
$(DESTDIR)$(PAM_INSTALL_PATH) \
$(DESTDIR)$(PAM_CONFIG_DIR)/$(NAME)

#### Tool Building Commands ####
TOOLS := $(addprefix $(BIN)/,protoc golint protoc-gen-go goimports staticcheck gocovmerge misspell)
Expand Down