#!/usr/bin/make -f # rvs Makefile # version 0.7.0 # Copyright (C) 2009 Luke Shumaker # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # Originally written by Luke Shumaker . # Variables ######################################################## RM = rm -f CP = cp SED = sed INSTALL = install MKDIR = $(INSTALL) -d #mkdir -p INSTALL_PROGRAM = $(INSTALL) INSTALL_DATA = $(INSTALL) -m 644 TOUCH = touch export RM CP SED INSTALL MKDIR INSTALL_PROGRAM INSTALL_DATA SHELL = @SHELL@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ rvsdir = @rvsdir@/rvs srcdir = @srcdir@ export SHELL rvsdir srcdir plugins = $(patsubst $(srcdir)/plugins/%,%,\ $(shell find $(srcdir)/plugins/* -maxdepth 0 -type d)) # phony targets #################################################### make-plugins = $(addprefix p-,$(plugins)) install-plugins = $(addprefix install-p-,$(plugins)) remove-plugins = $(addprefix remove-p-,$(plugins)) all-plugins = $(make-plugins) $(install-plugins) $(remove-plugins) all : rvs $(make-plugins) #.PHONY : install uninstall clean distclean $(all-plugins) .PHONY : install uninstall clean distclean .SUFFIXES : # targets ########################################################## $(rvsdir)/plugins : $(MKDIR) $(dir $@) $(TOUCH) $@ # install/clean/remove ############################################# install : $(bindir)/rvs $(rvsdir)/plugins $(install-plugins) clean : distclean : clean $(RM) var.sed $(RM) Makefile uninstall : $(RM) $(prefix)/$(bindir)/rvs $(RM) -r $(rvsdir) # implicit rules ################################################### # 'build' shell scripts b := @ % : $(srcdir)/%.sh $(MKDIR) $(dir $@) $(SED) -e 's/$bSHELL@/$(subst /,\/,$(SHELL) )/g' \ -e 's/$brvsdir@/$(subst /,\/,$(rvsdir))/g' <$< > $@ # install $(bindir)/% : % $(MKDIR) $(dir $@) $(INSTALL_PROGRAM) $< $@ # make plugins p-% : plugins/% plugins/%/Makefile $(srcdir)/plugins/% $(MAKE) -C $< # install plugins install-p-% : plugins/% plugins/%/Makefile $(srcdir)/plugins/% p-% $(MAKE) -C $< install # uninstall plugins uninstall-p-% : plugins/% plugins/%/Makefile $(MAKE) -C $< uninstall