2010-08-02 12:47:55 +00:00
|
|
|
BINDIR=/usr/bin
|
|
|
|
MODDIR=/usr/share/fhem
|
2008-07-28 12:33:29 +00:00
|
|
|
VARDIR=/var/log/fhem
|
2010-08-02 12:47:55 +00:00
|
|
|
MANDIR=/usr/share/man/man1
|
|
|
|
ETCDIR=/etc
|
2007-01-30 12:47:36 +00:00
|
|
|
|
2010-08-02 12:47:55 +00:00
|
|
|
# Used for .deb package creation
|
|
|
|
RBINDIR=$(ROOT)$(BINDIR)
|
|
|
|
RMODDIR=$(ROOT)$(MODDIR)
|
|
|
|
RVARDIR=$(ROOT)$(VARDIR)
|
|
|
|
RMANDIR=$(ROOT)$(MANDIR)
|
|
|
|
RETCDIR=$(ROOT)$(ETCDIR)
|
|
|
|
|
2012-05-21 15:47:03 +00:00
|
|
|
# Destination Directories
|
2012-09-18 13:10:51 +00:00
|
|
|
DEST=$(RETCDIR) $(RBINDIR) $(RMODDIR) $(RMANDIR) $(RVARDIR)
|
2012-05-21 15:47:03 +00:00
|
|
|
|
2011-12-28 19:21:19 +00:00
|
|
|
VERS=5.2
|
2011-12-31 13:31:58 +00:00
|
|
|
DATE=2011-12-31
|
2010-08-02 12:47:55 +00:00
|
|
|
DESTDIR=fhem-$(VERS)
|
2007-01-30 12:47:36 +00:00
|
|
|
|
|
|
|
all:
|
2012-05-21 15:47:03 +00:00
|
|
|
@echo "Use 'make <target>', where <target> is"
|
2012-09-18 13:10:51 +00:00
|
|
|
@echo " install - to install fhem"
|
|
|
|
@echo " dist - to create a .tar.gz file"
|
|
|
|
@echo " deb - to create a .deb file"
|
|
|
|
@echo " fb7390 - to create an AVM Fritz!Box 7390 imagefile"
|
|
|
|
@echo " fb7270 - to create a zip file for the AVM Fritz!Box 7270"
|
2012-05-21 15:47:03 +00:00
|
|
|
@echo " backup - to backup current installation of fhem"
|
2012-09-18 13:10:51 +00:00
|
|
|
@echo " uninstall - to uninstall fhem (with backup)"
|
2012-05-21 15:47:03 +00:00
|
|
|
@echo "Check Makefile for default installation paths!"
|
2007-01-30 12:47:36 +00:00
|
|
|
|
2012-09-18 13:10:51 +00:00
|
|
|
install:
|
|
|
|
@echo "- creating directories"
|
2012-05-21 15:47:03 +00:00
|
|
|
@-$(foreach DIR,$(DEST), if [ ! -e $(DIR) ]; then mkdir -p $(DIR); fi; )
|
2012-09-18 13:10:51 +00:00
|
|
|
@echo "- fixing permissions / path in fhem.cfg"
|
|
|
|
@find FHEM docs www contrib -type f -print | xargs chmod 644
|
|
|
|
@cp fhem.cfg fhem.cfg.install
|
|
|
|
@perl -pi -e 's,modpath \.,modpath $(MODDIR),' fhem.cfg.install
|
|
|
|
@perl -pi -e 's,([^h]) \./log,$$1 $(VARDIR),' fhem.cfg.install
|
2012-05-21 15:47:03 +00:00
|
|
|
@-if [ -e $(RETCDIR)/fhem.cfg ]; then \
|
|
|
|
echo "- move existing configuration to fhem.cfg.`date "+%Y-%m-%d_%H:%M:%S"`"; \
|
|
|
|
mv $(RETCDIR)/fhem.cfg $(RETCDIR)/fhem.cfg.`date "+%Y-%m-%d_%H:%M:%S"`; fi;
|
2012-09-18 13:10:51 +00:00
|
|
|
@echo "- copying files"
|
|
|
|
@cp fhem.cfg.install $(RETCDIR)/fhem.cfg
|
|
|
|
@rm fhem.cfg.install
|
|
|
|
@cp fhem.pl $(RBINDIR)
|
|
|
|
@cp -rp FHEM docs www contrib $(RMODDIR)
|
|
|
|
@cp docs/fhem.man $(RMANDIR)/fhem.pl.1
|
|
|
|
@gzip -f -9 $(RMANDIR)/fhem.pl.1
|
|
|
|
@echo "- cleanup: removing .svn leftovers"
|
|
|
|
@find $(RMODDIR) -name .svn -print | xargs rm -rf
|
2012-05-21 15:47:03 +00:00
|
|
|
@echo
|
|
|
|
@echo "Installation of fhem completed!"
|
|
|
|
@echo
|
2012-09-18 13:10:51 +00:00
|
|
|
@echo "Start fhem with"
|
|
|
|
@echo " perl $(BINDIR)/fhem.pl $(ETCDIR)/fhem.cfg"
|
2012-05-21 15:47:03 +00:00
|
|
|
@echo
|
|
|
|
|
|
|
|
backup:
|
|
|
|
@echo
|
2012-09-18 13:10:51 +00:00
|
|
|
@echo "Saving fhem to the .backup directory in the current directory"
|
2012-05-21 15:47:03 +00:00
|
|
|
@-if [ ! -e .backup ]; then mkdir .backup; fi;
|
|
|
|
@tar czf .backup/fhem-backup_`date +%y%m%d%H%M`.tar.gz \
|
|
|
|
$(RETCDIR)/fhem* $(RBINDIR)/fhem* $(RDOCDIR) $(RMODDIR) $(RMANDIR)/fhem* $(RVARDIR)
|
|
|
|
|
|
|
|
uninstall:backup
|
|
|
|
@echo
|
|
|
|
@echo "Remove fhem installation..."
|
|
|
|
rm -rf $(RETCDIR)/fhem.cfg
|
|
|
|
rm -rf $(RBINDIR)/fhem.pl
|
|
|
|
rm -rf $(RMODDIR)
|
|
|
|
rm -rf $(RMANDIR)/fhem.pl.*
|
|
|
|
rm -rf $(RVARDIR)
|
|
|
|
@echo done
|
|
|
|
@echo
|
|
|
|
|
2007-01-30 12:47:36 +00:00
|
|
|
dist:
|
2012-09-18 13:10:51 +00:00
|
|
|
mkdir .f
|
2012-09-18 14:11:49 +00:00
|
|
|
cp -r fhem.pl fhem.cfg CHANGED HISTORY Makefile README.SVN\
|
|
|
|
FHEM contrib docs www webfrontend .f
|
|
|
|
mkdir .f/log
|
2012-09-18 13:10:51 +00:00
|
|
|
find .f -name .svn -print | xargs rm -rf
|
|
|
|
find .f -name \*.orig -print | xargs rm -f
|
|
|
|
find .f -name .#\* -print | xargs rm -f
|
|
|
|
find .f -type f -print | grep -v Makefile |\
|
2010-08-02 12:47:55 +00:00
|
|
|
xargs perl -pi -e 's/=VERS=/$(VERS)/g;s/=DATE=/$(DATE)/g'
|
2012-09-18 13:10:51 +00:00
|
|
|
mv .f $(DESTDIR)
|
|
|
|
tar cf - $(DESTDIR) | gzip > $(DESTDIR).tar.gz
|
|
|
|
mv $(DESTDIR)/docs/*.html .
|
|
|
|
rm -rf $(DESTDIR)
|
2012-05-21 15:47:03 +00:00
|
|
|
|
|
|
|
dist-clean:
|
2012-09-18 13:10:51 +00:00
|
|
|
rm -rf *.html $(DESTDIR).tar.gz
|
2010-08-02 12:47:55 +00:00
|
|
|
|
|
|
|
deb:
|
2012-05-21 15:47:03 +00:00
|
|
|
@echo $(PWD)
|
2012-09-18 13:10:51 +00:00
|
|
|
rm -rf .f
|
2010-08-02 12:47:55 +00:00
|
|
|
make ROOT=`pwd`/.f install
|
2012-09-18 13:10:51 +00:00
|
|
|
cp -r contrib/DEBIAN .f
|
|
|
|
rm -rf .f/$(MODDIR)/contrib/FB7*/var
|
|
|
|
rm -rf .f/$(MODDIR)/contrib/FB7*/*.image
|
|
|
|
rm -rf .f/$(MODDIR)/contrib/FB7*/*.zip
|
|
|
|
find .f -name .svn -print | xargs rm -rf
|
|
|
|
find .f -name \*.orig -print | xargs rm -f
|
|
|
|
find .f -name .#\* -print | xargs rm -f
|
|
|
|
find .f -type f -print | grep -v Makefile |\
|
2007-01-30 12:47:36 +00:00
|
|
|
xargs perl -pi -e 's/=VERS=/$(VERS)/g;s/=DATE=/$(DATE)/g'
|
2012-09-18 13:10:51 +00:00
|
|
|
find .f -type f | xargs chmod 644
|
|
|
|
find .f -type d | xargs chmod 755
|
|
|
|
chmod 755 `cat contrib/executables`
|
|
|
|
chown -R root:root .f
|
|
|
|
mv .f $(DESTDIR)
|
|
|
|
dpkg-deb --build $(DESTDIR)
|
|
|
|
rm -rf $(DESTDIR)
|
2011-07-07 07:02:50 +00:00
|
|
|
|
|
|
|
fb7390:
|
2012-09-18 14:11:49 +00:00
|
|
|
cd contrib/FB7390 && sh ./makeimage $(DESTDIR)
|
2012-01-03 13:55:00 +00:00
|
|
|
|
|
|
|
fb7270:
|
|
|
|
cd contrib/FB7270 && ./makeimage $(DESTDIR)
|