2013-09-22 14:26:57 +00:00
|
|
|
VERS=5.5
|
2013-09-29 08:23:28 +00:00
|
|
|
DATE=2013-09-29
|
2012-10-27 16:23:09 +00:00
|
|
|
|
|
|
|
RELATIVE_PATH=YES
|
|
|
|
BINDIR=/opt/fhem
|
|
|
|
MODDIR=$(BINDIR)
|
|
|
|
VARDIR=$(BINDIR)/log
|
|
|
|
MANDIR=$(BINDIR)/docs
|
|
|
|
ETCDIR=$(BINDIR)
|
2013-09-22 14:26:57 +00:00
|
|
|
DEMODIR=$(BINDIR)
|
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)
|
2013-09-22 14:26:57 +00:00
|
|
|
RDEMODIR=$(ROOT)$(DEMODIR)
|
2010-08-02 12:47:55 +00:00
|
|
|
|
2012-05-21 15:47:03 +00:00
|
|
|
# Destination Directories
|
2013-09-22 14:26:57 +00:00
|
|
|
DEST=$(RETCDIR) $(RBINDIR) $(RMODDIR) $(RMANDIR) $(RVARDIR) $(RDEMODIR)
|
2012-05-21 15:47:03 +00:00
|
|
|
|
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"
|
2014-09-24 06:02:51 +00:00
|
|
|
@echo " synology - to create an spk file"
|
2012-09-18 13:10:51 +00:00
|
|
|
@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-10-27 16:23:09 +00:00
|
|
|
@echo "- fixing permissions in fhem.cfg"
|
2012-12-29 07:45:56 +00:00
|
|
|
perl contrib/commandref_join.pl
|
2014-04-07 15:52:51 +00:00
|
|
|
@find FHEM configDB.pm docs www contrib -type f -print | xargs chmod 644
|
2012-09-18 13:10:51 +00:00
|
|
|
@cp fhem.cfg fhem.cfg.install
|
2012-10-27 16:23:09 +00:00
|
|
|
@-if [ "$(RELATIVE_PATH)" != YES ]; then\
|
|
|
|
perl -pi -e 's,modpath \.,modpath $(MODDIR),' fhem.cfg.install; \
|
|
|
|
perl -pi -e 's,([^h]) \./log,$$1 $(VARDIR),' fhem.cfg.install; \
|
|
|
|
fi;
|
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)
|
2014-04-07 15:52:51 +00:00
|
|
|
@cp -rp FHEM docs www contrib configDB.pm $(RMODDIR)
|
2013-09-29 11:23:30 +00:00
|
|
|
@cp -rp README_DEMO.txt demolog fhem.cfg.demo $(RDEMODIR)
|
2012-09-18 13:10:51 +00:00
|
|
|
@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
|
2013-09-22 14:26:57 +00:00
|
|
|
@find $(RMODDIR) -name svn-commit\* -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 \
|
2013-09-22 14:26:57 +00:00
|
|
|
$(RETCDIR)/fhem* $(RBINDIR)/fhem* $(RDOCDIR)\
|
|
|
|
$(RMODDIR) $(RMANDIR)/fhem* $(RVARDIR)
|
2012-05-21 15:47:03 +00:00
|
|
|
|
|
|
|
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\
|
2013-09-22 14:26:57 +00:00
|
|
|
demolog fhem.cfg.demo README_DEMO.txt\
|
2014-04-07 15:52:51 +00:00
|
|
|
FHEM configDB.pm contrib docs www webfrontend .f
|
2012-09-18 14:11:49 +00:00
|
|
|
mkdir .f/log
|
2013-08-25 11:49:30 +00:00
|
|
|
touch .f/log/empty_file.txt
|
2012-12-29 07:45:56 +00:00
|
|
|
(cd .f; perl contrib/commandref_join.pl)
|
2012-09-18 13:10:51 +00:00
|
|
|
find .f -name .svn -print | xargs rm -rf
|
2013-09-22 14:26:57 +00:00
|
|
|
find .f -name svn-commit\* -print | xargs rm -rf
|
2012-09-18 13:10:51 +00:00
|
|
|
find .f -name \*.orig -print | xargs rm -f
|
|
|
|
find .f -name .#\* -print | xargs rm -f
|
2013-08-25 11:49:30 +00:00
|
|
|
find .f -type f -print | grep -v Makefile | grep -v SWAP |\
|
2010-08-02 12:47:55 +00:00
|
|
|
xargs perl -pi -e 's/=VERS=/$(VERS)/g;s/=DATE=/$(DATE)/g'
|
2013-09-22 14:26:57 +00:00
|
|
|
rm -rf .f/www/SVGcache
|
2012-09-18 13:10:51 +00:00
|
|
|
mv .f $(DESTDIR)
|
2013-09-29 08:23:28 +00:00
|
|
|
tar cf - $(DESTDIR) | gzip -9 > $(DESTDIR).tar.gz
|
2012-09-18 13:10:51 +00:00
|
|
|
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)
|
2014-09-24 05:45:10 +00:00
|
|
|
|
|
|
|
synology:
|
|
|
|
rm -f contrib/Synology/package.tgz
|
|
|
|
rm -f $(DESTDIR).spk
|
|
|
|
sed -ie 's/\.\/log/\/var\/log/g' fhem.cfg
|
|
|
|
sed -ie 's/modpath \./modpath \/var\/packages\/FHEM\/target/g' fhem.cfg
|
|
|
|
sed -ie 's/version=".*"/version="$(DESTDIR)"/g' contrib/Synology/INFO
|
|
|
|
tar -vpczf contrib/Synology/package.tgz * --exclude "contrib/Synology"
|
|
|
|
cd contrib/Synology && tar -vcf ../../$(DESTDIR).spk *
|