#-------------------------------------------------------------------- #to make Mentor executable #-------------------------------------------------------------------- #variable checking #devbase est fait sur le nom de dieux goth #Odin,Gaus,Donar,Volla,Phol ORIG?="montreal" ifeq ("$(ORIG)","mercier") export DEVBASE=odin endif ifeq ("$(ORIG)","longueuil") export DEVBASE=gaus endif #defining devbase DEVDIR=`(cd /home/safe ; pwd)`/safetst/$(DEVBASE) #-------------------------------------------------------------------- dev : fclean chkmake @ $(MAKE) $(NCPU) -s fdebug devprod : fclean chkmake @ $(MAKE) $(NCPU) -s fprod chkmake : Makefile.inc Makefile @ $(MAKE) -s fclean @ touch chkmake fclean : clean @ for i in $(PRIVDIRS) ; \ do \ echo "Doing now \"$$i clean\"" ; \ $(MAKE) -s -C $$i clean ; \ done @ rm -fr $(RPMDIR)/SOURCES/$(APLR)*.tgz \ $(APPNAME)*.src.rpm \ $(APPNAME)*.*.x86_64.rpm \ $(APPNAME)*.*.i386.rpm fdebug : @ $(MAKE) -s debug @ for i in $(PRIVDIRS) ; \ do \ echo "Doing: $$i debug" ; \ $(MAKE) -s -C $$i debug ; \ done fprod : @ $(MAKE) -s prod @ for i in $(PRIVDIRS) ; \ do \ echo "Doing: $$i prod" ; \ $(MAKE) -s -C $$i prod ; \ done #-------------------------------------------------------------------- #to test application localy vzboot : dev @ $(MAKE) ACTION="boot cont" vzgotry vzgotry : - exec app/$(APPNAME) -b $(DEVDIR) -v -f -d9 $(ACTION) #-------------------------------------------------------------------- #to save the current distribution sauve : fclean @ echo "starting RCS process" @ support/sauver $(SRC) @ for i in $(ALLDIRS) ; \ do \ $(MAKE) -s -C $$i $@ ; \ done @ echo "RCS process completed" #-------------------------------------------------------------------- #creation d'un band de test devbase : @ ( \ if [ -z $(DEVBASE) ] ; then \ echo "DEVBASE environment variable is missing" ; \ else \ echo "Starting to build devbase \"$(DEVBASE)\"" ;\ $(MAKE) -s devil ; \ fi \ ) devil : @ $(MAKE) -s fclean fdebug @ echo "Creating \"$(DEVBASE)\" test executable"; @ ( \ if [ -d $(DEVDIR) ] ; then \ rm -fr $(DEVDIR)/* ; \ else \ mkdir $(DEVDIR) ; \ fi ; \ ) @ #creating basic prexisting system directory @ mkdir -p \ $(DEVDIR)/$(VZDIR)/cont/.oldroot \ $(DEVDIR)/$(VZDIR)/cont/rootfs \ $(DEVDIR)/usr/bin \ $(DEVDIR)/var/tmp \ $(DEVDIR)/var/lock/$(APPNAME) \ $(DEVDIR)/tmp @ echo "\"$(DEVBASE)\" now ready" #-------------------------------------------------------------------- #to make a full distribution distrib : fclean rpm $(MAKE) dorpm_distrib #-------------------------------------------------------------------- #to test application xtest : rpm @ ssh -q -Y -t $(XTSTSYS) sudo \ rm -f ~safe/rpmbuild/RPMS/i586/$(APPNAME)*.i586.rpm @ ssh -q -Y -t $(XTSTSYS) sudo \ rm -f ~safe/$(APPNAME)*.src.rpm @ scp -q $(APPNAME)*.src.rpm $(XTSTSYS): @ ssh -Y -t $(XTSTSYS) \ "rpmbuild --rebuild $(APPNAME)*.src.rpm" @ ssh -Y -t $(XTSTSYS) sudo \ rpm -Uhv ~safe/rpmbuild/RPMS/i586/$(APPNAME)*.i586.rpm test : binary @ ssh safe@$(TSTSYS).safe.ca \ "rm -fr $(APPNAME)-*.x86_64.rpm" @ scp -q \ $(RPMDIR)/RPMS/x86_64/$(APPNAME)-*.x86_64.rpm \ safe@$(TSTSYS).safe.ca: @ ssh -Y -t safe@$(TSTSYS).safe.ca sudo \ rpm -Uhv ~safe/$(APPNAME)-*.x86_64.rpm binary : rpm @ echo "Making RPM binary" @ rm -fr $(RPMDIR)/RPMS/x86_64/$(APPNAME)-*.x86_64.rpm @ rm -fr $(APPNAME)-*.x86_64.rpm @ rpm --quiet -Uhv $(APLR)*.src.rpm > /dev/null @ rpmbuild \ --ba \ --quiet \ --rebuild \ $(RPMDIR)/SPECS/$(APPNAME).spec @ cp $(RPMDIR)/RPMS/x86_64/$(APPNAME)-*.x86_64.rpm . @ echo "RPM binary completed" rpmlint : binary @ rpmlint $(APPNAME)-*.x86_64.rpm release : binary @ ssh $(FTPSITE).safe.ca \ mkdir -p /var/ftp/pub/linux/vzgot/archives @ ssh $(FTPSITE).safe.ca \ mv /var/ftp/pub/linux/vzgot/*.rpm \ /var/ftp/pub/linux/vzgot/archives @ scp -p support/{README,QUICK-START} \ $(APPNAME)-*.rpm \ $(FTPSITE).safe.ca:/var/ftp/pub/linux/vzgot @ grep -v '^[#.*]' Changes | \ ssh $(FTPSITE).safe.ca \ "cat - > /var/ftp/pub/linux/vzgot/Changes" #-------------------------------------------------------------------- #to make the RPM SRC file rpm : @ echo "Making RPM src" @ $(MAKE) -s vztar @ rm -fr \ $(RPMDIR)/SOURCES/$(APLR)*.tgz \ $(APPNAME)*.src.rpm @ mv $(APLR).tgz $(RPMDIR)/SOURCES @ rpmbuild -bs \ --quiet \ --define "_topdir /home/jmp/RPM" \ support/$(APPNAME).spec > /dev/null 2>&1 @ mv $(RPMDIR)/SRPMS/$(APLR)*.src.rpm . @ echo "RPM src completed" vztar : @ rm -fr $(APLR).tgz @ mkdir -p \ $(APLR)/conf \ $(APLR)/lib \ $(APLR)/app \ $(APLR)/cgroup.d \ $(APLR)/etc \ $(APLR)/etc/sysconfig \ $(APLR)/etc/snmp \ $(APLR)/shell @ #copying version, build_date and info file @ date > $(APLR)/$(APLR).build_date @ #adding RPM data @ cp -ap RPM $(APLR) @ #adding group information @ cp -ap cgroup.d/devices.* $(APLR)/cgroup.d @ #adding application sources @ cp -a lib/{*.c,*.h} $(APLR)/lib @ cp -a app/*.c $(APLR)/app @ cp -a shell/vzgot.* $(APLR)/shell @ #adding configuration file @ cp -a support/vzgot_config $(APLR)/conf @ cp -a support/vzgot_list $(APLR)/conf @ cp -a support/redhat_init.sh $(APLR)/conf @ cp -a support/{README,QUICK-START} $(APLR) @ grep -v '^[#.*]' Changes > $(APLR)/Changes @ cp -a etc/{users,groups,sudoers} $(APLR)/etc @ cp -a etc/{resolv.conf,shadow} $(APLR)/etc @ cp -a etc/iptables $(APLR)/etc/sysconfig @ cp -a etc/snmpd.conf $(APLR)/etc/snmp @ #adding construction file @ cp -a Makefile.inc $(APLR)/Makefile @ @ cp -a lib/Makefile.inc $(APLR)/lib/Makefile @ @ cp -a app/Makefile.inc $(APLR)/app/Makefile @ tar zcf $(APLR).tgz $(APLR) @ rm -fr $(APLR) #-------------------------------------------------------------------- togit : fclean @ git add . @ git clean -f -q @ echo "Ready for \"git commit -a\"" #-------------------------------------------------------------------- SRC = \ Changes \ Makefile.inc ALLDIRS = \ $(SUBDIRS) \ etc cgroup.d shell support PROG= $(APPNAME) VZDIR=/var/lib/vzgot #-------------------------------------------------------------------- include ./Makefile.inc include /etc/saferepo/Makefile.dorpm #-------------------------------------------------------------------- #rpm definitions RPMDIR = ~/RPM TSTSYS = Sorel XTSTSYS = 192.219.254.58 FTPSITE = ftploc #==================================================================== .PHONY: sauve binary rpm rpmlint chkmake togit #--------------------------------------------------------------------