Annotation of db/prgsrc/Makefile, revision 1.98

1.84      boris       1: HOSTNAME=$(shell hostname)
                      2: ifeq ($(HOSTNAME),bilbo)
                      3: ROOT=/home/znatoki
                      4: endif
1.6       boris       5: ifndef ROOT
1.83      boris       6: ROOT = $(HOME)
1.6       boris       7: endif
1.1       boris       8: PERL = perl
                      9: TMPSAV = /tmp
                     10: PMODE = 775
                     11: LMODE = 664
1.83      boris      12: KULICHKI=chgk-db-boris@ledorub.chgk.info
1.80      boris      13: RSYNC = rsync -ruvptCe ssh --delete --progress 
1.16      boris      14: SCP=scp
1.83      boris      15: DESTSRCDIR=~chgk-db/public_html/dimrub/src/
1.23      roma7      16: SRCDIR=../baza
1.48      roma7      17: DICTDIR=../dict
1.40      boris      18: IMAGEDIR=$(SRCDIR)/images
1.93      boris      19: SOUNDDIR=$(SRCDIR)/sounds
1.83      boris      20: DESTIMAGEDIR=~chgk-db/public_html/images/db
1.40      boris      21: INSTALLIMAGEDIR=$(ROOT)/public_html/images/db
1.93      boris      22: DESTSOUNDDIR=~chgk-db/public_html/sounds/db
                     23: INSTALLSOUNDDIR=$(ROOT)/public_html/sounds/db
1.83      boris      24: DESTPRGSRC=~chgk-db/db/prgsrc
                     25: DESTCGIBIN=~chgk-db/public_html/cgi-bin
1.1       boris      26: DUMPDIR=../dump
1.17      boris      27: DESTDUMPDIR=/var/tmp/
1.98    ! boris      28: TABLES= Questions Tournaments word2question nf nests Authors \
        !            29:  P2Q equalto People P2T
1.38      roma7      30: INDEXWRITER= rubash@yandex.ru, roma7@zaba.ru
1.34      boris      31: #INDEXWRITER= boris
                     32: AUTHORCHECKER = roma7@zaba.ru
                     33: #AUTHORCHECKER = boris
                     34: DELIVERER = roma7@zaba.ru, boris
1.35      boris      35: #DELIVERER = boris
1.34      boris      36: UPDATELOG = $(DUMPDIR)/update.log
                     37: UAUTHORS=$(DUMPDIR)/uauthors
                     38: UNSORTED=$(DUMPDIR)/unsorted
1.89      boris      39: RSPARAMS= 2000 150
1.39      boris      40: TIMESTAMP= $(DUMPDIR)/timestamp
1.1       boris      41: 
                     42: DBSCRIPTS = mkdb.pl \
                     43:            updatem.pl \
                     44:            updatedb.pl \
                     45:            changecities.pl\
                     46:            createindex.pl\
                     47:            updateindex.pl \
1.8       boris      48:            addlinks.pl \
1.9       boris      49:            deletefiles.pl\
1.10      boris      50:            renamefile.pl \
1.11      boris      51:            makecheck.pl\
                     52:            mkRS.pl\
1.14      boris      53:            delRS.pl\
1.11      boris      54:            updateRS.pl\
                     55:            updateRS1.pl\
1.15      boris      56:            updateRS2.pl\
                     57:            updateRS3.pl\
1.11      boris      58:            dumpRS.pl\
1.45      roma7      59:            findequal.pl\
1.11      boris      60:            dumpin2out.pl\
                     61:            dump2dump.pl\
                     62:            checkPBS.pl\
1.34      boris      63:            loaddump.pl \
1.57      boris      64:            makeauthors.pl\
1.96      roma7      65:            makeeditors.pl\
1.98    ! boris      66:            makepeople.pl\
1.77      boris      67:            chronicles.pl\
1.78      boris      68:            stats.pl \
                     69:            validate.pl
1.11      boris      70: 
                     71: LIBS = chgkfiles.pm \
1.10      boris      72:            common.pl\
                     73:            chgk.cnf\
1.11      boris      74:            dbchgk.pm\
                     75:             check.pl
1.10      boris      76: 
1.1       boris      77: 
1.70      boris      78: CGISCRIPTS = db.cgi\
1.92      boris      79:              dbdefs.pl \
                     80:              cw.pl
1.1       boris      81: 
1.12      boris      82: 
                     83: HTMLS = contribute.html \
                     84:        copyright.html \
                     85:        copyright_mozg.html \
                     86:        credits.html \
                     87:        dbmain.html \
                     88:        footer.html \
                     89:        guestbook.html \
                     90:        index.html \
                     91:        random.html \
                     92:        reklama.html \
1.58      boris      93:        reklama_bottom.html\
1.90      roma7      94:        dbxml.php\
1.12      boris      95:        search.html  
                     96: 
                     97: 
1.13      boris      98: 
1.1       boris      99: DBBIN = ../bin
                    100: MANDIR = ../man
1.10      boris     101: LIBDIR = ../lib
1.6       boris     102: CGIBIN = $(ROOT)/public_html/cgi-bin
1.13      boris     103: HTMLDIR = $(ROOT)/public_html/dimrub/db
1.1       boris     104: 
1.40      boris     105: TEXTS = $(wildcard $(SRCDIR)/*.txt) $(SRCDIR)/index
1.94      boris     106: IMAGES = $(wildcard $(IMAGEDIR)/*.gif) $(wildcard $(IMAGEDIR)/*.jpg)
                    107: SOUNDS = $(wildcard $(SOUNDDIR)/*.mp3) $(wildcard $(SOUNDDIR)/*.mid)
1.40      boris     108: IMAGENAMES= $(notdir $(IMAGES))
1.93      boris     109: SOUNDNAMES= $(notdir $(SOUNDS))
1.40      boris     110: 
                    111: 
                    112: 
1.10      boris     113: BININSTALL =    ${DBSCRIPTS:%=$(DBBIN)/%}
1.1       boris     114: CGIINSTALL =    ${CGISCRIPTS:%.cgi=$(CGIBIN)/%.cgi}
1.10      boris     115: LIBINSTALL =    ${LIBS:%=$(LIBDIR)/%}
1.13      boris     116: HTMLINSTALL =   ${HTMLS:%.html=$(HTMLDIR)/%.html}
1.40      boris     117: IMAGEINSTALL =  ${IMAGENAMES:%=$(INSTALLIMAGEDIR)/%}
1.93      boris     118: SOUNDINSTALL =  ${SOUNDNAMES:%=$(INSTALLSOUNDDIR)/%}
1.40      boris     119: 
1.84      boris     120: 
1.93      boris     121: all: $(LIBINSTALL) $(BININSTALL) $(CGIINSTALL) $(HTMLINSTALL) \
                    122:        $(IMAGEINSTALL) $(SOUNDINSTALL)
1.40      boris     123: 
1.10      boris     124: 
1.1       boris     125: 
1.39      boris     126: 
1.1       boris     127: 
1.11      boris     128: $(DBBIN)/%.pl:       %.pl
1.1       boris     129:        ${PERL} -c $<
                    130:        - pod2man --center "Internet Club DB" $< > $*.1
                    131:        - install -m $(LMODE) $*.1 $(MANDIR)/man1
1.10      boris     132:        - rm $*.1
1.1       boris     133:        if [ -f $@ ]; then mv $@ $(TMPSAV); fi
                    134:        cp $< $@
                    135:        chmod $(PMODE) $@
                    136:        if [ -f $(TMPSAV)/$(@F) ]; then rm -f $(TMPSAV)/$(@F); fi
1.33      boris     137: 
1.1       boris     138: $(CGIBIN)/%.cgi:       %.cgi
                    139:        ${PERL} -c $<
                    140:        - pod2man --center "Internet Club DB" $< > $*.1
                    141:        - install -m $(LMODE) $*.1 $(MANDIR)/man1
1.10      boris     142:        - rm $*.1       
1.1       boris     143:        if [ -f $@ ]; then mv $@ $(TMPSAV); fi
                    144:        cp $< $@
                    145:        chmod $(PMODE) $@
                    146:        if [ -f $(TMPSAV)/$(@F) ]; then rm -f $(TMPSAV)/$(@F); fi
                    147: 
                    148: 
1.10      boris     149: 
                    150: $(LIBDIR)/%.pm:       %.pm
                    151:        ${PERL} -c $<
                    152:        - pod2man --center "Internet Club DB" $< > $*.3
                    153:        - install -m $(LMODE) $*.3 $(MANDIR)/man3
                    154:        - rm $*.3
1.11      boris     155:        if [ -f $@ ]; then mv $@ $(TMPSAV); fi
                    156:        cp $< $@
                    157:        chmod $(LMODE) $@
                    158:        if [ -f $(TMPSAV)/$(@F) ]; then rm -f $(TMPSAV)/$(@F); fi
                    159: 
                    160: 
                    161: $(LIBDIR)/%.pl:       %.pl
                    162:        ${PERL} -c $<
                    163:        - pod2man --center "Internet Club DB" $< > $*.3
                    164:        - install -m $(LMODE) $*.3 $(MANDIR)/man3
                    165:        - rm $*.3
                    166:        if [ -f $@ ]; then mv $@ $(TMPSAV); fi
                    167:        cp $< $@
                    168:        chmod $(LMODE) $@
                    169:        if [ -f $(TMPSAV)/$(@F) ]; then rm -f $(TMPSAV)/$(@F); fi
                    170: 
                    171: 
                    172: $(LIBDIR)/%.cnf:       %.cnf
                    173:        ${PERL} -c $<
                    174:        - pod2man --center "Internet Club DB" $< > $*.5
                    175:        - install -m $(LMODE) $*.5 $(MANDIR)/man5
                    176:        - rm $*.5
1.10      boris     177:        if [ -f $@ ]; then mv $@ $(TMPSAV); fi
                    178:        cp $< $@
                    179:        chmod $(LMODE) $@
                    180:        if [ -f $(TMPSAV)/$(@F) ]; then rm -f $(TMPSAV)/$(@F); fi
                    181: 
                    182: 
1.12      boris     183: $(HTMLDIR)/%.html:       %.html
                    184:        cp $< $@
                    185: 
1.10      boris     186: 
1.40      boris     187: $(INSTALLIMAGEDIR)/%: $(IMAGEDIR)/%
                    188:        cp $< $@        
1.1       boris     189: 
1.93      boris     190: 
                    191: $(INSTALLSOUNDDIR)/%: $(SOUNDDIR)/%
                    192:        cp $< $@        
                    193: 
                    194: 
                    195: 
1.1       boris     196: srcdeliver:
                    197:        $(RSYNC) $(SRCDIR) $(KULICHKI):$(DESTSRCDIR)
                    198: 
                    199: 
1.40      boris     200: imagedeliver:
1.49      boris     201:        cvs update $(SRCDIR)
1.60      boris     202:        $(RSYNC) $(IMAGEDIR)/ $(KULICHKI):$(DESTIMAGEDIR)/
1.40      boris     203: 
1.93      boris     204: sounddeliver:
                    205:        cvs update $(SRCDIR)
                    206:        $(RSYNC) $(SOUNDDIR)/ $(KULICHKI):$(DESTSOUNDDIR)/
                    207: 
1.1       boris     208: prgdeliver:
                    209:        $(RSYNC) ./ $(KULICHKI):$(DESTPRGSRC)
                    210: 
1.93      boris     211: dbdeliver: imagedeliver sounddeliver
1.51      roma7     212:        echo "Starting delivering" | mail -s"Starting delivering" $(DELIVERER)
1.91      boris     213:        mysqldump   --default-character-set=koi8r --add-drop-table -u piataev chgk $(TABLES)  > $(DUMPDIR)/chgkdump
1.59      boris     214:        echo "delete from hash;" >> $(DUMPDIR)/chgkdump
1.95      roma7     215:        echo "CREATE FULLTEXT INDEX fti ON Questions (Question, Answer, PassCriteria, Comments);" >> $(DUMPDIR)/chgkdump
1.16      boris     216:        gzip $(DUMPDIR)/chgkdump
                    217:        $(SCP) $(DUMPDIR)/chgkdump.gz  $(KULICHKI):$(DESTDUMPDIR)
1.46      boris     218:        echo "Delivered" | mail -s"Database delivered" $(DELIVERER)
1.12      boris     219: 
1.24      roma7     220: update: 
1.50      boris     221:        cvs update
1.21      roma7     222:        cvs update $(SRCDIR)
1.48      roma7     223:        cvs update $(DICTDIR)
1.50      boris     224:        $(MAKE) all
1.39      boris     225:        $(MAKE) $(TIMESTAMP)
                    226: 
                    227: $(TIMESTAMP): $(TEXTS)
1.27      roma7     228:        mysql -upiataev chgk <delq.sql
1.36      boris     229:        $(DBBIN)/mkdb.pl
                    230:        $(DBBIN)/updateindex.pl -i$(SRCDIR)/index
                    231:        $(DBBIN)/updatedb.pl $(SRCDIR)/*.txt 2>&1 | tee $(UPDATELOG)
1.43      roma7     232:        $(DBBIN)/findequal.pl
1.96      roma7     233:        $(DBBIN)/makepeople.pl  
1.36      boris     234:        $(DBBIN)/makeauthors.pl
1.96      roma7     235:        $(DBBIN)/makeeditors.pl 
1.34      boris     236:        if [ -s $(UAUTHORS) ]; then  \
                    237:                mail -sUauthors $(AUTHORCHECKER) < $(UAUTHORS); \
                    238:        fi
                    239:        if [ -s $(UNSORTED) ]; then \
                    240:                mail -sUnsorted $(INDEXWRITER) <$(UNSORTED);\
                    241:         else \
1.36      boris     242:                $(DBBIN)/mkRS.pl; \
                    243:                $(DBBIN)/updateRS2.pl $(RSPARAMS);\
1.47      roma7     244:                echo "Ready to deliver" | mail -s"Ready to deliver" $(DELIVERER);\
1.34      boris     245:         fi
1.39      boris     246:        touch $(TIMESTAMP)
                    247: 
1.33      boris     248: 
                    249: authorsdeliver:
1.42      roma7     250:        mysqldump --add-drop-table -u piataev chgk Authors A2Q  equalto > $(DUMPDIR)/chgkdump.0
1.33      boris     251:        sed 's/TYPE=ISAM PACK_KEYS=1//g' $(DUMPDIR)/chgkdump.0 > $(DUMPDIR)/chgkdump
                    252:        gzip $(DUMPDIR)/chgkdump
                    253:        rm $(DUMPDIR)/chgkdump.0
                    254:        $(SCP) $(DUMPDIR)/chgkdump.gz  $(KULICHKI):$(DESTDUMPDIR)
                    255: 
1.52      boris     256: 
                    257: dbfill:
                    258:        echo "Starting filling Kulichki database" | mail -s"Starting dbfill" $(DELIVERER)
1.86      boris     259:        ssh $(KULICHKI) "export LANG=ru_RU.KOI8-R; \
                    260:        echo 'ВНИМАНИЕ! Идёт заливка Базы вопросов. \
1.55      boris     261:                                Результаты поиска в Базе могут быть неполны' \
1.73      boris     262:                > ~/public_html/dimrub/db/date;\
1.88      boris     263:                gunzip -c /var/tmp/chgkdump.gz | mysql -u piataev chgk;\
1.73      boris     264:                date > ~/public_html/dimrub/db/date"
1.74      boris     265:        echo "Finished filling Kulichki database" | mail -s"Finished dbfill" $(DELIVERER); \
1.77      boris     266:        $(DBBIN)/stats.pl >> $(SRCDIR)/fill.log; \
1.76      boris     267:        cvs commit  -m "Database filled" $(SRCDIR)
1.67      boris     268: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>