diff options
Diffstat (limited to 'plugins/repo/Makefile.orig')
-rw-r--r-- | plugins/repo/Makefile.orig | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/plugins/repo/Makefile.orig b/plugins/repo/Makefile.orig index 00ffc5f..e4114be 100644 --- a/plugins/repo/Makefile.orig +++ b/plugins/repo/Makefile.orig @@ -13,6 +13,7 @@ name = repo # Variables ######################################################## RM ?= rm -f CP ?= cp +SED ?= sed INSTALL = install MKDIR ?= $(INSTALL) -d #mkdir -p INSTALL_PROGRAM ?= $(INSTALL) @@ -22,10 +23,11 @@ SHELL ?= @SHELL@ rvsdir ?= @rvsdir@/rvs srcdir ?= @srcdir@ -libdir = $(rvsdir)/$(name) +libdir = $(rvsdir)/$(name) reldir = plugins/$(name) -VPATH = $(srcdir)/$(reldir) +mysrcdir = $(srcdir)/$(reldir) +VPATH = $(mysrcdir) # phony targets #################################################### all : $(name) @@ -33,30 +35,42 @@ all : $(name) .SUFFIXES : # targets ########################################################## -srcFiles = $(filter-out %/Makefile.orig,$(shell find $(VPATH)/ -type f)) -shFiles = $(patsubst $(VPATH)/%,%,$(basename $(filter %.sh,$(srcFiles)))) +srcFiles = $(filter-out %/Makefile.orig,$(shell find $(mysrcdir)/ -type f)) -$(name) : $(shFiles) -#$(name) : +shSrcFiles = $(filter %.sh,$(srcFiles)) +shOutFiles = $(patsubst $(mysrcdir)/%,%,$(basename $(shSrcFiles))) +shExeFiles = $(patsubst %,$(libdir)/%, $(shOutFiles) ) +$(name) : $(shOutFiles) -# install/clean/remove ############################################# +# (un)install ###################################################### -#install : +install : $(shExeFiles) + echo $(name) >> $(rvsdir)/plugins + +uninstall : + $(RM) -r $(libdir) + $(SED) -i "/^$(name)$/ d" $(rvsdir)/plugins + +# clean ############################################################ clean : - $(RM) -r ./* - $(RM) Makefile + $(RM) $(shOutFiles) -remove : - $(RM) -r $(libdir) +distclean : clean + $(RM) Makefile # implicit rules ################################################### -# 'build' shell scripts -% : %.sh +b := @ +# build shell scripts +% : $(mysrcdir)/%.sh + $(MKDIR) $(dir $@) + $(SED) 's/$bSHELL@/$(subst /,\/,$(SHELL))/g' <$< > $@ +# workaround... idk why it doesn't match `lib/' +lib/% : $(mysrcdir)/lib/%.sh $(MKDIR) $(dir $@) - $(CP) $< $@ + $(SED) 's/$bSHELL@/$(subst /,\/,$(SHELL))/g' <$< > $@ # install $(libdir)/% : % |