Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use DESTDIR for install prefix #200

Merged
merged 1 commit into from
Feb 19, 2020
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
19 changes: 10 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ PAM_NAME := pam_$(NAME)
#
# BIN: The locaton where binaries will be built. Default: ./bin
# INSTALL: The tool used to install binaries. Default: sudo install
# DESTDIR: The location for the fscrypt binary. Default: /usr/local/bin
# 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
#
# MOUNT: The filesystem where our tests are run. Default: /mnt/fscrypt_mount
Expand Down Expand Up @@ -148,27 +149,27 @@ coverage.out: $(BIN)/gocovmerge $(COVERAGE_FILES)
install: install-bin install-pam

PREFIX := /usr/local
DESTDIR := $(PREFIX)/bin
BINDIR := $(PREFIX)/bin

install-bin: $(BIN)/$(NAME)
install -d $(DESTDIR)
install $< $(DESTDIR)
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 $(PAM_MODULE_DIR)
install $(PAM_MODULE) $(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 $(PAM_CONFIG_DIR)
install $(PAM_CONFIG) $(PAM_CONFIG_DIR)/$(NAME)
install -d $(DESTDIR)/$(PAM_CONFIG_DIR)
install $(PAM_CONFIG) $(DESTDIR)/$(PAM_CONFIG_DIR)/$(NAME)

uninstall:
rm -f $(DESTDIR)/$(NAME) $(PAM_INSTALL_PATH) $(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