Skip to content

Commit

Permalink
Makefile install interface
Browse files Browse the repository at this point in the history
Signed-off-by: Cristian Le <[email protected]>
  • Loading branch information
LecrisUT committed Apr 2, 2024
1 parent fdbbd79 commit 4475b74
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Makefile
Expand Up @@ -14,6 +14,14 @@ ifndef PKGDOCDIR
export PKGDOCDIR := $(DESTDIR)/share/doc/$(PKGNAME)/
endif

# Command aliases for homebrew and non-gnu compatibilities
ifndef GETOPT_CMD
export GETOPT_CMD := getopt
endif
ifndef READLINK_CMD
export READLINK_CMD := readlink
endif

SUBDIRS := src

build:
Expand Down
10 changes: 10 additions & 0 deletions src/Makefile
Expand Up @@ -44,6 +44,12 @@ MODULES=journal.sh\
FILES=$(MODULES) beakerlib.sh
DEFDOCS=dictionary.vim docsman

define portable_sed
# See comment inside https://unix.stackexchange.com/a/92907
sed -e $(1) $(2) > $(2).tmp
mv $(2).tmp $(2)
endef

.PHONY: install clean test

ya.sh:
Expand All @@ -65,6 +71,10 @@ install: build
install -p profiling.sh $(DESTDIR)/share/beakerlib
install -p -m 644 dictionary.vim $(DESTDIR)/share/beakerlib

# Patch installed beakerlib.sh
@$(call portable_sed, "s|declare -r __INTERNAL_GETOPT_CMD=\"getopt\"|declare -r __INTERNAL_GETOPT_CMD=\"${GETOPT_CMD}\"|", $(DESTDIR)/share/beakerlib/beakerlib.sh)
@$(call portable_sed, "s|declare -r __INTERNAL_READLINK_CMD=\"readlink\"|declare -r __INTERNAL_READLINK_CMD=\"${READLINK_CMD}\"|", $(DESTDIR)/share/beakerlib/beakerlib.sh)

install -p -m 644 xslt-templates/* $(DESTDIR)/share/beakerlib/xslt-templates

install -p -m 644 vim/ftdetect/beakerlib.vim $(DESTDIR)/share/vim/vimfiles/after/ftdetect
Expand Down

0 comments on commit 4475b74

Please sign in to comment.