diff options
Diffstat (limited to 'src/lib/Makefile')
-rw-r--r-- | src/lib/Makefile | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/src/lib/Makefile b/src/lib/Makefile index e1068c1..8683ee1 100644 --- a/src/lib/Makefile +++ b/src/lib/Makefile @@ -1,10 +1,41 @@ -libre_execdir=$(bindir) -libre_datadir=$(libexecdir)/libretools -include ../../common.mk +include ../../common-devtools.mk +pkglibexecdir=$(libexecdir)/libretools + +# Copy from devtools ################################################# + +copy: common.sh.in + +common.sh.in: $(devtoolsdir)/lib/common.sh ; cp $< $@ + +# Build ############################################################## + +build: common.sh + +lib/common.sh: %: %.in %.top Makefile + @echo "GEN $@" + @{ \ + cat "$*.top" && \ + echo 'if [[ -z $${_INCLUDE_COMMON_SH:-} ]]; then' && \ + echo '_INCLUDE_COMMON_SH=true' && \ + cat "$*.in" && \ + echo 'fi'; } > "$@" + +# Install ############################################################ + +executables = $(wildcard libre*) +libraries = $(wildcard *.sh) + +# relative path to `/` from $(bindir) rootdir=$(shell sed -r 's|^/||;s|[^/]+|..|g'<<<$(bindir)) -$(DESTDIR)$(libre_execdir)/%: % - install -Dm755 '$<' '$(DESTDIR)$(libre_datadir)/$(@F)' +install: \ + $(addprefix $(DESTDIR)$(bindir)/,$(executables)) \ + $(addprefix $(DESTDIR)$(pkglibexecdir)/,$(executables) $(libraries)) + +$(DESTDIR)$(bindir)/%: % install -d '$(@D)' - ln -sf '$(rootdir)$(libre_datadir)/$(@F)' "$@" + ln -sf '$(rootdir)$(pkglibexecdir)/$(@F)' "$@" + +$(DESTDIR)$(pkglibexecdir)/%: % + install -Dm755 '$<' '$@' |