1# 2# Makefile for docx2txt 3# 4 5BINDIR ?= /usr/local/bin 6CONFIGDIR ?= /etc 7 8INSTALL = $(shell which install 2>/dev/null) 9ifeq ($(INSTALL),) 10$(error "Need 'install' to install docx2txt") 11endif 12 13PERL = $(shell which perl 2>/dev/null) 14ifeq ($(PERL),) 15$(warning "*** Make sure 'perl' is installed and is in your PATH, before running the installed script. ***") 16endif 17 18BINFILES = docx2txt.sh docx2txt.pl 19CONFIGFILE = docx2txt.config 20 21.PHONY: install installbin installconfig 22 23install: installbin installconfig 24 25installbin: $(BINFILES) 26 @echo "Installing script files [$(BINFILES)] in \"$(BINDIR)\" .." 27 @[ -d "$(BINDIR)" ] || mkdir -p "$(BINDIR)" 28 $(INSTALL) -m 755 $^ "$(BINDIR)" 29ifneq ($(PERL),) 30 @echo "Setting systemConfigDir to [$(CONFIGDIR)] in \"$(BINDIR)/docx2txt.pl\" .." 31 $(PERL) -pi -e "s%\"/etc\";%\"$(CONFIGDIR)\";%" "$(BINDIR)/docx2txt.pl"\ 32 && rm -f "$(BINDIR)/docx2txt.pl.bak" 33else 34 @echo "*** Set systemConfigDir to \"$(CONFIGDIR)\" in \"$(BINDIR)/docx2txt.pl\"." 35endif 36 37installconfig: $(CONFIGFILE) 38 @echo "Installing config file [$(CONFIGFILE)] in \"$(CONFIGDIR)\" .." 39 @[ -d "$(CONFIGDIR)" ] || mkdir -p "$(CONFIGDIR)" 40 $(INSTALL) -m 755 $^ "$(CONFIGDIR)" 41