#This file is part of SECONDO. # #Copyright (C) 2004, University in Hagen, Department of Computer Science, #Database Systems for New Applications. # #SECONDO is free software; you can redistribute it and/or modify #it under the terms of the GNU General Public License as published by #the Free Software Foundation; either version 2 of the License, or #(at your option) any later version. # #SECONDO is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #GNU General Public License for more details. # #You should have received a copy of the GNU General Public License #along with SECONDO; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ######################################################################## # # makefile.cm - rules for CM and deployment related tasks # ######################################################################### # some direcories used to build tar.gz files for # Secondo sources or installation kits pref := SECONDO_INSTALLATION_KIT net := $(SECONDO_INST_KIT_ROOT)/$(pref) # local directory for tar archives ifndef tempdir tempdir := /tmp/make-$(USER) endif shrc := $(shell if [ ! -d $(tempdir) ]; then if ! mkdir -p $(tempdir); then echo "false"; fi fi) ifeq ($(shrc),false) $(error Could not create directory $(tempdir)!) endif # files which are used to indicate # if some special targets need to be maked tsdk := $(tempdir)/sdk_dist tnew := $(tempdir)/sdk_changed tupd := $(tempdir)/show_update_msg # run some shell commands shrc := $(shell rm -f $(tupd)) shrc := $(shell if [ ! -e $(tsdk) ]; then touch $(tsdk); fi) shrc := $(shell if [ ! -e $(tnew) ]; then touch $(tnew); fi) # Rules for copying configuration scripts SCRIPT_DIR := ./CM-Scripts SCRIPT_FILES_CMD := libutil.sh \ profile \ bashrc_example \ secondorc \ secondo.aliases \ secondo.setroot \ secondo.config.linux \ secondo.config.win32 \ secondo.config.mac_osx SDK_SCRIPTS_CMD := $(addprefix $(SECONDO_SDK)/, $(SCRIPT_FILES_CMD)) INST_KIT_SCRIPTS := $(addprefix $(net)/scripts/, $(SCRIPT_FILES_CMD) ) ALL_INST_KIT_SCRIPTS := $(net)/installsdk $(INST_KIT_SCRIPTS) # Files located at the web server websrv := $(SECONDO_WEBSRV_ROOT)/files lin_guide := Linux-Installation-Guide.pdf win_guide := Windows-Installation-Guide.pdf osx_guide := Mac-OSX-Installation-Guide.pdf sdk_guide := SDK_SETUP.pdf lin_sdk := mac-osx-sdk.tar.gz osx_sdk := linux-sdk.tar.gz win_sdk := win32-sdk.zip iso_sdk := secondo-cd.iso.zip INST_GUIDES := $(addprefix $(websrv)/, $(lin_guide) $(win_guide) $(osx_guide) $(sdk_guide)) INST_KITS := $(addprefix $(websrv)/, $(lin_sdk) $(win_sdk) $(osx_sdk)) INST_KITS_TMP := $(addprefix $(tempdir)/, $(lin_sdk) $(win_sdk) $(osx_sdk)) WIN_SRC := secondo-$(tag)-CP1252.zip LIN_SRC := secondo-$(tag)-LAT1.tar.gz SRC_FILES := $(WIN_SRC) $(LIN_SRC) .PHONY: update-environment update-environment: show-separator remove-old-apps remove-old-config $(SDK_SCRIPTS_CMD) show-update-msg UPDATE_MSG := "\n\ Configuration Setup has been updated. If you have made changes\n\ in one of the files above please transfer them into the new versions.\n\ A backup copy ending with .backup will be kept.\n\n\ Afterwards please execute the command\n\ source \$SECONDO_SDK/secondorc or close this shell \n\ and start a new one.\n\n\ Make can't do this for you since all commands started within\n\ make are processed in a new subshell, hence the environment\n\ of your current running shell will not be modified.\n" VPATH := $(SCRIPT_DIR) $(SECONDO_SDK)/%: % @touch $(tupd) @cp $@ $@.backup @cp $< $@ @echo " updating" $@ $(net)/scripts/%: % cp $< $@ $(net)/%: % cp $< $@ $(net)/installsdk: installsdk cp $< $@ chmod 755 $@ .PHONY: show-update-msg show-update-msg: @if [ -e $(tupd) ]; then echo $(UPDATE_MSG); \ else echo " ... are up to date.\n"; fi .PHONY: show-separator show-separator: @echo; echo " *** Bash environment setup files *** "; echo # update the installation kit .PHONY: inst-kit inst-kit: checkrootdir $(tnew) $(tsdk) # special target which only updates script files .PHONY: checkrootdir sdk-scripts sdk-scripts: $(tnew) $(tnew): $(ALL_INST_KIT_SCRIPTS) touch $@ # special target which create new secondo source archives .PHONY: src-dist src-dist: src-archives touch $(tnew) # create new installation kits .PHONY: sdk-tars sdk-tars: $(INST_KITS_TMP) .PHONY: sdk-cd sdk-cd: $(tempdir)/secondo-cd.iso.zip vpath %-Installation-Guide.pdf $(net) vpath %.zip $(tempdir) vpath %.gz $(tempdir) # copy to web server .PHONY: copy2web copy2web: checkrootdir $(INST_GUIDES) $(INST_KITS) $(websrv)/%-Installation-Guide.pdf: %-Installation-Guide.pdf cp $< $@ $(websrv)/%.zip: %.zip cp $< $@ $(websrv)/%.gz: %.gz cp $< $@ # check if a root for the secondo SDK tools is present .PHONY: checkrootdir checkrootdir: ifndef SECONDO_INST_KIT_ROOT @echo; echo "Error: SECONDO_INST_KIT_ROOT not defined!"; echo; exit 1 else @if [ ! -e $(net) ]; then \ echo; echo "Directory net=\"$(net)\" does not exist!"; echo; exit 2; fi endif $(tempdir)/linux-sdk.tar.gz: $(tnew) rm -f $@ tar -C $(SECONDO_INST_KIT_ROOT) -cvzf $@ \ $(pref)/$(lin_guide) $(pref)/$(sdk_guide) $(pref)/installsdk $(pref)/linux $(pref)/scripts --exclude $(pref)/linux/j2sdk* $(tempdir)/mac-osx-sdk.tar.gz: $(tnew) rm -f $@ tar -C $(SECONDO_INST_KIT_ROOT) -cvzf $@ \ $(pref)/$(osx_guide) $(pref)/$(sdk_guide) $(pref)/installsdk $(pref)/linux $(pref)/mac_osx $(pref)/scripts --exclude $(pref)/linux/j2sdk* $(tempdir)/win32-sdk.zip: $(tnew) rm -f $@ cd $(SECONDO_INST_KIT_ROOT) && zip -9 -r $@ \ $(pref)/$(win_guide) $(pref)/$(sdk_guide) $(pref)/MSYS-* $(pref)/installsdk \ $(pref)/win32/prolog $(pref)/win32/mingw $(pref)/win32/non-gnu $(pref)/win32/gnu $(pref)/scripts # create a iso image with Rockridge and Joliet extensions .PHONY: isoimage isoimage: $(tempdir)/secondo-cd.iso.zip $(tempdir)/secondo-cd.iso.zip: $(tempdir)/secondo-cd.iso rm -rf $@ zip -9 $@ $< $(tempdir)/secondo-cd.iso: $(tnew) rm -rf $@ mkisofs -J -r -iso-level 2 -graft-points -o $@ /=$(net) .PHONY: doc-dist doc-dist: $(net)/documentation rm -f $(tempdir)/secondo-$@.zip cd $(net) && zip -9 -r $(tempdir)/secondo-$@.zip documentation OLD_APPS := bin/SecondoTTYBDB \ bin/SecondoMonitorBDB \ bin/SecondoServerBDB \ bin/TestRunner \ bin/TestRunnerApp \ Optimizer/SecondoPL \ Optimizer/SecondoPLCS \ .PHONY: remove-old-apps remove-old-apps: rm -f $(OLD_APPS) .PHONY: remove-old-config remove-old-config: rm -f bin/SecondoConfig.ini Optimizer/SecondoConfig.ini ## rules for building a demo version SECONDO_DEMO = ./sec-demo/secondo DEMO_MAN := Documents/SecondoManual.pdf ifeq ($(platform),win32) DEMO_DEPS := $(PL_LIB_DIR)/*dll \ $(PL_LIB_DIR)/pthreadVC*dll \ $(JPL_JAR) \ $(SECONDO_SDK)/auxtools/bin/libgsl*dll \ $(SECONDO_SDK)/auxtools/bin/jpeg*dll else DEMO_DLL := $(PL_LIB_DIR)/libpl* \ $(SECONDO_SDK)/auxtools/lib/libgsl*dll \ $(SECONDO_SDK)/bdb/lib/libdb_cxx* endif TPC := Tools/Generators/TPC-H TPC_GEN = $(TPC)/dbgen.exe $(TPC)/dists.dss $(TPC)/secondo/restore_objs vpath Secondo% bin .PHONY: demo demo: mkdemodir cp_deps cp_files .PHONY: mkdemodir mkdemodir: rm -rf $(SECONDO_DEMO) mkdir -p $(SECONDO_DEMO)/bin mkdir -p $(SECONDO_DEMO)/Optimizer .PHONY: cp_deps cp_deps: $(DEMO_MAN) $(DEMO_DEPS) $(TPC_GEN) make -C Tools/Generators/TPC-H cp $^ $(SECONDO_DEMO)/bin cp $(PL_LIB_DIR)/../boot32.prc $(SECONDO_DEMO) cp -R $(PL_LIB_DIR)/../boot $(SECONDO_DEMO) cp -R $(PL_LIB_DIR)/../library $(SECONDO_DEMO) .PHONY: cp_files cp_files: cp -R Optimizer $(SECONDO_DEMO) cp -R bin $(SECONDO_DEMO) cp CM-Scripts/initdemo.sh $(SECONDO_DEMO) .PHONY: demo2 demo2: cp_gui demo .PHONY: cp_gui cp_gui: mkdir -p $(SECONDO_DEMO)/Javagui cp -R Javagui/Demo/* $(SECONDO_DEMO)/Javagui .PHONY: tar_demo tar_demo: cd ./sec-demo; tar -cvzf ../sec-demo.tgz \ --exclude-from ../opt_demo.exclude \ --exclude-from ../bin_demo.exclude * srcprefix := secondo define checkTag @if [ -z "$(tag)" ]; then echo; echo "Error: Variable \"tag\" not set! "; echo; exit 1; fi endef define checkDir @if [ -d $(srcprefix) ]; then echo ; echo "Error: subdirectory $(srcprefix) already present! "; echo;exit 1; fi endef .PHONY: tag-version tag-version: $(checkTag) cvs -Q tag -F $(tag) fileList := $(tempdir)/_SRC_FILE_LIST .PHONY: public-linux public-linux: rmList mkLat1 .PHONY: public-version public-version: rmList mkLat1 mkcp1252 .PHONY: cp-sources cp-sources: cp $(LIN_SRC) $(net) cp $(WIN_SRC) $(net) .PHONY: src-archive src-archive: cvs -Q export -rHEAD -dsecondo secondo tar -czf secondo.tgz secondo .PHONY: mkLat1 mkLat1: $(fileList) rm -rf $(SRC_FILES) tar -czf $(LIN_SRC) -T $< .PHONY: mkcp1252 mkcp1252: $(fileList) # a list of file endings which need not to be recoded find $(srcprefix) ! \( \ -type d \ -or -name "*.bmp" \ -or -name "*.book" \ -or -name "*.canvas" \ -or -name "*.dll" \ -or -name "*.eps" \ -or -name "*.fig" \ -or -name "*.fm" \ -or -name "*.gz" \ -or -name "*.gif" \ -or -name "*.tgz" \ -or -name "*.jar" \ -or -name "*.zar" \ -or -name "*.jpg" \ -or -name "*.pdf" \ -or -name "*.png" \ -or -name "*.sxd" \ -or -name "*.sxc" \ -or -name "*.xls" \ -or -name "*.sda" \ -or -name "*.vsd" \ -or -name "*.zip" \ -or -name "*.icns" \ -or -path "*javazoom*" \ -or -path "*TPC-D*" \ \) \ -exec recode lat1..cp1252 {} \; cat $< | zip -9 -r $(WIN_SRC) -@ > /dev/null .PHONY: rmList rmList: $(checkDir) rm -f $(fileList) $(fileList): $(srcprefix)/makefile CM-Scripts/mkpublic.sh nonpublic.filelist $@ $(srcprefix) $(srcprefix)/makefile: $(checkTag) cvs -Q export -r$(tag) -d$(srcprefix) secondo # store modified files in a tar archive .PHONY: showdiff showdiff: cvs -nq update | grep "^. " /tmp/cvs.list: cvs -nq update | grep "^. " > $@ /tmp/tar.list: /tmp/cvs.list cat $< | sed 's/. //' > $@ # you may need to setup ~/.cvsignore in order # to prevent storing generated stuff .PHONY: backup backup: removeLists backup.tgz .PHONY: removeLists removeLists: rm -f /tmp/tar.list rm -f /tmp/cvs.list backup.tgz: /tmp/tar.list rm -f $@ tar -cvzf $@ -T $< .PHONY: cscope cscope: cscope.files cscope -bq -i $< cscope.files: find . -iname "*.cpp" -or -iname "*.c" \ -or -iname "*.y" \ -or -iname "*.l" \ -or -iname "*.h" \ -or -iname "makefile*" > $@ .PHONY: backup-all backup-all: dir=$${PWD##*/}; tar -czf $$dir.tgz --exclude-from exclude.pat -C.. $$dir .PHONY: sync-test sync-test: ifdef syncdir rsync -nvau --exclude-from exclude.pat * $$syncdir else echo "Error: Variable syncdir undefined!" endif .PHONY: sync-now sync-now: ifdef syncdir rsync -au --exclude-from exclude.pat * $$syncdir else echo "Error: Variable syncdir undefined!" endif .PHONY: showtags showtags: cvs log -h makefile .PHONY: showpubtags showpubtags: cvs log -h makefile | grep public .PHONY: changelog changelog: ChangeLog updateChgLog ../secondo-src/Documents/ChangeLog ChangeLog: ifdef to ifdef from cvs -Q update -dP cvs tag public-$(to) cvs2cl.pl --delta public-$(from):public-$(to) endif endif .PHONY: updateChgLog updateChgLog: Documents/ChangeLog Documents/ChangeLog: ChangeLog mv Documents/ChangeLog ChangeLog.old cat ChangeLog ChangeLog.old > Documents/ChangeLog ../secondo-src/Documents/ChangeLog: Documents/ChangeLog cp $< ../secondo-src/Documents # todo: write a shell script which recurses into sub directories and builds # a complete list of new directories and new files. .PHONY: newfiles newfiles: cvs -nq update | grep "^? " | sed 's#? ##' > newfiles.txt .PHONY: addfiles addfiles: cvs add $(cat newfiles.txt) # pattern rule for creating an tar ball %.tar.gz : % tar -czf $@ $<