| 1 | # |
|---|
| 2 | # Makefile for simulation scripts. |
|---|
| 3 | # |
|---|
| 4 | # Copyright (C) 1998 Kevin Lai |
|---|
| 5 | # |
|---|
| 6 | # This program is free software; you can redistribute it and/or modify |
|---|
| 7 | # it under the terms of the GNU General Public License as published by |
|---|
| 8 | # the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | # (at your option) any later version. |
|---|
| 10 | # |
|---|
| 11 | # This program is distributed in the hope that it will be useful, |
|---|
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | # GNU General Public License for more details. |
|---|
| 15 | # |
|---|
| 16 | # You should have received a copy of the GNU General Public License |
|---|
| 17 | # along with this program; if not, write to the Free Software |
|---|
| 18 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 19 | # |
|---|
| 20 | |
|---|
| 21 | PYTHON ?= python |
|---|
| 22 | |
|---|
| 23 | CHECKOPTIONS = -Q \ |
|---|
| 24 | --tuple --var --initattr --unreachable \ |
|---|
| 25 | --changetypes --no-deprecated \ |
|---|
| 26 | --no-argsused |
|---|
| 27 | PACKAGES = \ |
|---|
| 28 | tycoon_aucd \ |
|---|
| 29 | tycoon_aucd_xen3 \ |
|---|
| 30 | tycoon_aucd_plnm3 \ |
|---|
| 31 | tycoon_sls |
|---|
| 32 | |
|---|
| 33 | DISTVERSION = $(shell $(PYTHON) src/KL/version.py distribution_version) |
|---|
| 34 | |
|---|
| 35 | ARCHS = \ |
|---|
| 36 | i386 \ |
|---|
| 37 | x86_64 |
|---|
| 38 | |
|---|
| 39 | INSTALLDIR = ~tycoon/public_html/dl/$(DISTVERSION) |
|---|
| 40 | CREATEREPO = createrepo |
|---|
| 41 | |
|---|
| 42 | DISTRIBUTION = fedora_core_3 |
|---|
| 43 | |
|---|
| 44 | VERSIONS = $(shell $(PYTHON) src/KL/version.py all) |
|---|
| 45 | |
|---|
| 46 | MAIN = $(shell basename `pwd`) |
|---|
| 47 | |
|---|
| 48 | check: |
|---|
| 49 | find . \( -name '*.py' \) -exec pychecker $(CHECKOPTIONS) {} \; -print |
|---|
| 50 | |
|---|
| 51 | clean: |
|---|
| 52 | find . \( -name '.#*' -o -name '*.pyc' -o -name '*.pyo' -o -name '*.class' -o -name '*~' -o -name '.coverage' -o -name '*.rej' -o -name '*.orig' \) -exec rm {} \; -print |
|---|
| 53 | /bin/rm -f src/Tycoon/__version__.py |
|---|
| 54 | cd src/bank; make clean |
|---|
| 55 | cd src/KL; make clean |
|---|
| 56 | cd doc; make clean |
|---|
| 57 | |
|---|
| 58 | dist_clean: clean |
|---|
| 59 | find . \( -name '*.prof' -o -name 'screenlog.*' -o -name '*,cover' \) -exec rm {} \; -print |
|---|
| 60 | /bin/rm -fr build dist MANIFEST $(MAIN).zip *.rpm setup.py setup.cfg |
|---|
| 61 | cd src/KL; make dist_clean |
|---|
| 62 | for package in $(PACKAGES) ; do \ |
|---|
| 63 | cd packaging/$(DISTRIBUTION)/$$package; \ |
|---|
| 64 | make dist_clean; \ |
|---|
| 65 | cd ../../..; \ |
|---|
| 66 | done |
|---|
| 67 | |
|---|
| 68 | rpm: dist_clean |
|---|
| 69 | $(PYTHON) src/KL/Macro.py setup.py.template setup.py $$ $(VERSIONS); \ |
|---|
| 70 | $(PYTHON) src/KL/Macro.py setup.cfg.template setup.cfg $$ $(VERSIONS); \ |
|---|
| 71 | $(PYTHON) setup.py bdist_rpm --fix-python |
|---|
| 72 | /bin/rm -f tycoon*noarch.rpm |
|---|
| 73 | mv dist/tycoon*noarch.rpm . |
|---|
| 74 | # rpm --addsign *.rpm |
|---|
| 75 | |
|---|
| 76 | sub_rpms: |
|---|
| 77 | for package in $(PACKAGES) ; do \ |
|---|
| 78 | $(PYTHON) src/KL/Macro.py packaging/$(DISTRIBUTION)/$$package/setup.py.template packaging/$(DISTRIBUTION)/$$package/setup.py $$ $(VERSIONS); \ |
|---|
| 79 | $(PYTHON) src/KL/Macro.py packaging/$(DISTRIBUTION)/$$package/setup.cfg.template packaging/$(DISTRIBUTION)/$$package/setup.cfg $$ $(VERSIONS); \ |
|---|
| 80 | cd packaging/$(DISTRIBUTION)/$$package; \ |
|---|
| 81 | make rpm; \ |
|---|
| 82 | cd ../../..; \ |
|---|
| 83 | mv packaging/$(DISTRIBUTION)/$$package/dist/tycoon*noarch.rpm .; \ |
|---|
| 84 | done |
|---|
| 85 | # rpm --addsign *.rpm |
|---|
| 86 | |
|---|
| 87 | kl_rpm: |
|---|
| 88 | cd src/KL; make rpm |
|---|
| 89 | /bin/rm -f KL*noarch.rpm |
|---|
| 90 | mv src/KL/dist/KL*noarch.rpm . |
|---|
| 91 | |
|---|
| 92 | all_rpm: rpm kl_rpm sub_rpms |
|---|
| 93 | |
|---|
| 94 | install: all_rpm |
|---|
| 95 | for arch in $(ARCHS) ; do \ |
|---|
| 96 | for package in $(PACKAGES) ; do \ |
|---|
| 97 | sudo -u tycoon rm -f $(INSTALLDIR)/$$arch/$$package*; \ |
|---|
| 98 | done; \ |
|---|
| 99 | sudo -u tycoon rm -f $(INSTALLDIR)/$$arch/tycoon-*; \ |
|---|
| 100 | sudo -u tycoon rm -f $(INSTALLDIR)/$$arch/KL*; \ |
|---|
| 101 | sudo -u tycoon mkdir $(INSTALLDIR); \ |
|---|
| 102 | sudo -u tycoon mkdir $(INSTALLDIR)/$$arch; \ |
|---|
| 103 | sudo -u tycoon cp *.rpm $(INSTALLDIR)/$$arch; \ |
|---|
| 104 | sudo -u tycoon $(CREATEREPO) $(INSTALLDIR)/$$arch; \ |
|---|
| 105 | done |
|---|
| 106 | |
|---|
| 107 | remote_install: all_rpm |
|---|
| 108 | for arch in $(ARCHS) ; do \ |
|---|
| 109 | for package in $(PACKAGES) ; do \ |
|---|
| 110 | ~/bin/tycoon_admin_ssh.sh tycoon@tycoon-dev.hpl.hp.com rm -f $(INSTALLDIR)/$$arch/$$package*; \ |
|---|
| 111 | done; \ |
|---|
| 112 | ~/bin/tycoon_admin_ssh.sh tycoon@tycoon-dev.hpl.hp.com rm -f $(INSTALLDIR)/$$arch/tycoon-*; \ |
|---|
| 113 | ~/bin/tycoon_admin_ssh.sh tycoon@tycoon-dev.hpl.hp.com rm -f $(INSTALLDIR)/$$arch/KL*; \ |
|---|
| 114 | ~/bin/tycoon_admin_ssh.sh tycoon@tycoon-dev.hpl.hp.com mkdir $(INSTALLDIR); \ |
|---|
| 115 | ~/bin/tycoon_admin_ssh.sh tycoon@tycoon-dev.hpl.hp.com mkdir $(INSTALLDIR)/$$arch; \ |
|---|
| 116 | ~/bin/tycoon_admin_scp.sh *.rpm tycoon@tycoon-dev.hpl.hp.com:$(INSTALLDIR)/$$arch; \ |
|---|
| 117 | ~/bin/tycoon_admin_ssh.sh tycoon@tycoon-dev.hpl.hp.com createrepo $(INSTALLDIR)/$$arch; \ |
|---|
| 118 | done |
|---|
| 119 | |
|---|
| 120 | |
|---|
| 121 | |
|---|
| 122 | sync: clean |
|---|
| 123 | rsync -azv --copy-unsafe-links --delete --exclude CVS/ -e "ssh -p 22 -o StrictHostKeyChecking=no" . root@tycoon:tycoon |
|---|
| 124 | |
|---|
| 125 | zip: |
|---|
| 126 | /bin/rm -f $(MAIN).zip |
|---|
| 127 | cd .. ; zip -r $(MAIN) $(MAIN) -x "*/keys/*"; mv $(MAIN).zip $(MAIN) |
|---|