summaryrefslogtreecommitdiff
path: root/plugins/plugin.mk.in
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/plugin.mk.in')
-rw-r--r--plugins/plugin.mk.in53
1 files changed, 32 insertions, 21 deletions
diff --git a/plugins/plugin.mk.in b/plugins/plugin.mk.in
index 6980538..8af5fcc 100644
--- a/plugins/plugin.mk.in
+++ b/plugins/plugin.mk.in
@@ -18,37 +18,51 @@ include info.mk # this contains the actuall name/version for the plugin
# along with this program; see the file COPYING.
# If not, see <http://www.gnu.org/licenses>.
+sysconfdir ?= @sysconfdir@
+BINDIR ?= @BINDIR@
+TMPDIR ?= @TMPDIR@
+LIBDIR ?= @LIBDIR@
+ETCDIR ?= @ETCDIR@
+dirs += $(sysconfdir) $(BINDIR) $(TMPDIR) $(LIBDIR) $(ETCDIR)
+
rvs = @name@
id = $(name)-$(ver)
# phony targets ####################################################
all : $(name)
-.PHONY : $(name) install uninstall clean distclean dist
+.PHONY : $(name) install uninstall clean distclean
.SUFFIXES :
# build ############################################################
-mysrcdir = $(srcdir)/plugins/$(name)
-myoutdir = out
+$(info srcdir:$(srcdir))
-srcFiles = $(filter-out %/Makefile.in,$(shell find $(mysrcdir)/ -type f))
+srcFiles = $(filter-out %/Makefile.in,$(shell find $(srcdir)/ -type f))
shSrcFiles = $(filter %.sh,$(srcFiles))
-shOutFiles = $(patsubst $(mysrcdir)/%,$(myoutdir)/%,$(basename $(shSrcFiles)))
+shOutFiles = $(patsubst $(srcdir)/%,%,$(basename $(shSrcFiles)))
-$(name) : $(myoutdir) $(shOutFiles) $(myoutdir)/plugin.conf
-
-$(myoutdir)/plugin.conf : $(mysrcdir)/plugin.conf.in
- $(INSTALL_DATA) $< $@
- $(SED) -i \
- -e 's/$bname@/$(subst /,\/,$(name))/g' \
- -e 's/$bver@/$(subst /,\/,$(ver))/g' \
- $@
+outFiles = $(shOutFiles)
+outBin = $(addprefix bin-,$(notdir $(filter bin/%,$(outFiles))))
+outEtc = $(addprefix $(ETCDIR)/$(name),$(notdir $(filter etc/%,$(outFiles))))
+outLib = $(addprefix $(LIBDIR)/$(name),$(notdir $(filter lib/%,$(outFiles))))
+$(name) : $(myoutdir) $(shOutFiles)
# (un)install ######################################################
-install : all
- $(RVS) install $(name)-$(ver) $(myoutdir)
+install : $(outBin) $(outEtc) $(outLib)
+
+unbin-% : bin/%
+ $(RVS) uninstall $(notdir $<) $(name)
+
+bin-% : bin/%
+ $(RVS) install $< $(notdir $<) $(name) $(priority)
+
+$(ECTDIR)/$(name)/% : etc/%
+ $(CP) $< $@
+
+$(LIBDIR)/$(name)/% : lib/%
+ $(CP) $< $@
uninstall :
$(RVS) uninstall $(name)
@@ -58,14 +72,14 @@ uninstall :
clean :
distclean : clean
- $(RM) Makefile
- $(RM) -r out
+ find ./ -name Makefile -exec $(RM) '{}' \;
+ find ./ -name '*.mk' -exec $(RM) '{}' \;
# implicit rules ###################################################
b := @
# build shell scripts
-$(myoutdir)/% : $(mysrcdir)/%.sh $(myoutdir)
+% : %.sh
$(INSTALL_PROGRAM) $< $@
$(SED) -i \
-e 's/$bSHELL@/$(subst /,\/,$(SHELL))/g' \
@@ -73,6 +87,3 @@ $(myoutdir)/% : $(mysrcdir)/%.sh $(myoutdir)
-e 's/$bID@/$(subst /,\/,$(id))/g' \
$@
-$(DESTDIR)$(libexecdir)/$(rvs) $(myoutdir) :
- $(MKDIR) $@
-