File:  [LON-CAPA] / loncom / build / Makefile
Revision 1.79: download - view: text, annotated - select for diffs
Sun Apr 21 16:44:56 2002 UTC (22 years, 2 months ago) by harris41
Branches: MAIN
CVS tags: HEAD
supporting probing of distribution

    1: # The LearningOnline Network with CAPA
    2: 
    3: # Scott Harrison
    4: # $Id: Makefile,v 1.79 2002/04/21 16:44:56 harris41 Exp $
    5: 
    6: DISTPROBE=`perl ./distprobe`
    7: DIST=$(DISTPROBE)
    8: CATEGORY="development"
    9: SOURCE="../.."
   10: TARGET=""
   11: NORESTORECONF="0"
   12: HOSTNAME=""
   13: LAUNCH=| perl
   14: OUTSTREAM=>
   15: SAVE=program.pl.$(TIMESTAMP)
   16: LAUNCHSAVE=$(OUTSTREAM) $(SAVE)
   17: METAMTARGET=""
   18: MTARGET=""
   19: 
   20: help: 
   21: 	@echo "*** You need to specify a valid target ***"
   22: 	@echo "NOTE: You can specify options to your Makefile target."
   23: 	@echo "(option) DIST can be redhat7.1, debian, redhat6.2, or default"
   24: 	@echo "(option) CATEGORY can be runtime or development"
   25: 	@echo "(option) SOURCE is an absolute or relative directory path"
   26: 	@echo "(option) TARGET is an absolute or relative directory path"
   27: 	@echo "build: compile the CVS source tree"
   28: 	@echo "install: install from a compiled CVS source tree to a "
   29: 	@echo "         specified TARGET destination on the filesystem"
   30: 	@echo "test: test different parts of the LON-CAPA system (TEST_*)"
   31: 	@echo "TEST_lpml_scripts: make sure that the system can process "
   32: 	@echo "                   the Linux Packaging Markup Language"
   33: 	@echo "TEST_system_dependencies: make sure that all needed system "
   34: 	@echo "                          components are active and present "
   35: 	@echo "                          on the server such as perl modules"
   36: 	@echo "                          and the MySQL database"
   37: 	@echo "TEST_web_layer: mimic a login and various system actions on "
   38: 	@echo "                a LON-CAPA system"
   39: 	@echo "HTML: generate an HTML-formatted description of the LON-CAPA"
   40: 	@echo "      CVS files"
   41: 	@echo "documentation_tree: compiles a documentation tree from the "
   42:         @echo "                    CVS:doc directory"
   43: 	@echo "status: compare the TARGET filesystem with a compiled CVS "
   44: 	@echo "        source directory"
   45: 	@echo "statuspost: post the results of "make status" to "
   46: 	@echo "            TARGET/home/httpd/html/lon-status/filestatus.html"
   47: 	@echo "rpmstatus: compare the rpms on a system to defined lists "
   48: 	@echo "           CVS:doc/otherfiles/cd_rpms and "
   49: 	@echo "           CVS:doc/otherfiles/rpm_list.txt"
   50: 	@echo "rpmstatuspost: post the results of "make rpmstatus" to "
   51: 	@echo "            TARGET/home/httpd/html/lon-status/rpmstatus.html"
   52: 	@echo "RPM: build LON-CAPA-base RPM from CVS repository"
   53: 	@echo "setup_RPM: build LON-CAPA-setup RPM from CVS repository"
   54: 	@echo "           handy for CD-ROM generation"
   55: 
   56: test: TEST_lpml_scripts TEST_system_dependencies TEST_web_layer
   57: 	@echo "ALL SYSTEM DEPENDENCY TESTS SUCCESSFUL"
   58: 
   59: TEST_system_dependencies:
   60: 	@echo "TESTING SYSTEM DEPENDENCIES"
   61: 	cd system_dependencies; make
   62: 
   63: TEST_lpml_scripts:
   64: 	@echo "TESTING LPML INSTALLATION CODE"
   65: 	cd ../test; perl filecomparetest.pl
   66: 
   67: TEST_web_layer:
   68: 	@echo "TESTING WEB LAYER"
   69: 	cd weblayer_test; make
   70: 
   71: TEST_hosts_tab:
   72: 	@echo "Testing hosts.tab"
   73: 	@if (test -h ../hosts.tab); then \
   74: 		echo "there is a defined link; assume okay"; \
   75: 	else echo "**** ERROR **** hosts.tab not defined!" && \
   76: 	     echo -n "You need to do one of the following within your " && \
   77: 	     echo "CVS repository" && \
   78: 	     echo "   1) cd ../; ln -s production_hosts.tab hosts.tab" && \
   79: 	     echo "   2) cd ../; ln -s development_hosts.tab hosts.tab" && \
   80: 	     echo "or 3) cd ../; ln -s rawhide_hosts.tab hosts.tab" && \
   81: 	     echo "(you most likely want option #1, production_hosts.tab)" && \
   82: 	     exit 1; \
   83: 	fi
   84: 
   85: NET_hosts_tab:
   86: 	make TIMESTAMP=`date +"%s"` METAMTARGET="TRANSPORT" \
   87: 	MTARGET="hosts_tab" HOSTNAME="$(HOSTNAME)" lpmladm
   88: 
   89: hosts_tab: TEST_hosts_tab
   90: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
   91: 	perl xfml_parse.pl ../../doc/loncapafiles/valid_hosts.xfml | \
   92: 	perl lpml_parse.pl install $(CATEGORY) $(DIST) "$(SOURCE)" \
   93: 	"$(TARGET)" > Makefile.install
   94: 	make -f Makefile.install directories
   95: 	make -f Makefile.install files
   96: 	@echo "If hosts.tab has changed, restart httpd and loncontrol:"
   97: 	@echo "   /etc/rc.d/init.d/httpd restart"
   98: 	@echo "   /etc/rc.d/init.d/loncontrol restart"
   99: 
  100: lpmladm:
  101: 	@if (test $(METAMTARGET) = "TRANSPORT"); then \
  102: 		echo "Transporting to $(HOSTNAME)"; \
  103: 		sudo make DIST=$(DIST) CATEGORY=$(CATEGORY) \
  104: 		SOURCE="$(SOURCE)" \
  105: 		TARGET="lpmladm.$(TIMESTAMP)" \
  106: 		NORESTORECONF="$(NORESTORECONF)" "$(MTARGET)"; \
  107: 		cd lpmladm.$(TIMESTAMP); \
  108: 		sudo tar czvf ../tarball$(TIMESTAMP).tar.gz .; \
  109: 		cd ..; scp tarball$(TIMESTAMP).tar.gz \
  110: 		lpmladm@$(HOSTNAME):~/tarball$(TIMESTAMP).tar.gz; \
  111: 		ssh lpmladm@$(HOSTNAME) sudo mv tarball$(TIMESTAMP).tar.gz /; \
  112: 		ssh lpmladm@$(HOSTNAME) sudo tar -x -z -v -C / \
  113: 		-p --same-owner -f \
  114: 		/tarball$(TIMESTAMP).tar.gz; \
  115: 		ssh lpmladm@$(HOSTNAME) sudo rm -f \
  116: 		/tarball$(TIMESTAMP).tar.gz; \
  117: 	elif (test $(METAMTARGET) = "LAUNCH"); then \
  118: 		echo "Launching process on $(HOSTNAME)"; \
  119: 		LAUNCHSAVE=$(OUTSTREAM) $(SAVE); \
  120: 		make DIST=$(DIST) CATEGORY=$(CATEGORY) SOURCE="$(SOURCE)" \
  121: 		TARGET="$(TARGET)" NORESTORECONF="$(NORESTORECONF)" \
  122: 		LAUNCH="$(LAUNCHSAVE)" "$(MTARGET)"; \
  123: 		scp $(SAVE) lpmladm@$(HOSTNAME):~/$(SAVE); \
  124: 		ssh lpmladm@$(HOSTNAME) sudo perl $(SAVE); \
  125: 		ssh lpmladm@$(HOSTNAME) sudo rm -f $(SAVE); \
  126: 	else \
  127: 		echo "**** ERROR **** Incorrect METAMTARGET"; \
  128: 	fi
  129: 
  130: HTML:
  131: 	install -d HTML
  132: 	cp ../../doc/loncapafiles/*.gif HTML
  133: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
  134: 	perl lpml_parse.pl html development default ../.. '' > HTML/index.html
  135: 
  136: status:
  137: 	install -d HTML
  138: 	cp ../../doc/loncapafiles/*.gif HTML
  139: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
  140: 	perl lpml_parse.pl html $(CATEGORY) $(DIST) "../.." "" | \
  141: 	perl lpml_html_posteval.pl > \
  142: 	HTML/filestatus.html
  143: 
  144: statuspost: status
  145: 	cp ../../doc/loncapafiles/*.gif $(TARGET)/home/httpd/html/lon-status
  146: 	cp HTML/filestatus.html \
  147: 	$(TARGET)/home/httpd/html/lon-status/filestatus.html
  148: 
  149: rpmstatus:
  150: 	install -d RPMSTATUS
  151: 	rpm -qa --queryformat \
  152: 	'%{NAME}\t%{VERSION}\t%{RELEASE}\t%{BUILDTIME}\n' | sort > \
  153: 	RPMSTATUS/current.tmp
  154: 	cat ../../doc/otherfiles/cd_rpms.txt > RPMSTATUS/standard.tmp
  155: 	cat ../../doc/otherfiles/rpm_list.txt > RPMSTATUS/expected.tmp
  156: 	perl rpmparse.pl RPMSTATUS/standard.tmp RPMSTATUS/current.tmp \
  157: 	RPMSTATUS/expected.tmp > RPMSTATUS/rpmstatus.html
  158: 
  159: rpmstatuspost: rpmstatus
  160: 	cp RPMSTATUS/rpmstatus.html /home/httpd/html/lon-status/rpmstatus.html
  161: 
  162: configinstall: Makefile.configinstall
  163: 	make -f Makefile.configinstall SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
  164: 	configfiles
  165: 	if (test "0" = $(NORESTORECONF)); then \
  166: 	perl loncaparestoreconfigurations suffix .lpmlnew; fi
  167: 
  168: Makefile.configinstall: ../../doc/loncapafiles/loncapafiles.lpml lpml_parse.pl
  169: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
  170: 	perl lpml_parse.pl configinstall $(CATEGORY) $(DIST) "$(SOURCE)" \
  171: 	"$(TARGET)" > Makefile.configinstall
  172: 
  173: warningnote:
  174: 	@if (test -s WARNINGS); then \
  175: 		W=`grep -c '\*\*\*\* WARNING' WARNINGS`; \
  176: 		E=`grep -c '\*\*\*\* ERROR' WARNINGS`; \
  177: 		N=`grep -c '\*\*\*\* NOTE' WARNINGS`; \
  178: 		echo "--->  $$W WARNINGS ENCOUNTERED!       "; \
  179: 		echo "--->  $$E ERRORS ENCOUNTERED!         "; \
  180: 		echo "--->  $$N NOTES ENCOUNTERED!          "; \
  181: 		echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
  182: 		echo "!!!!  Please read the WARNINGS file !!!!"; \
  183: 		echo "!!!!   to make sure everything is   !!!!"; \
  184: 		echo "!!!!    correct and taken care of   !!!!"; \
  185: 		echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
  186: 	fi
  187: 
  188: NET_webserverconf:
  189: 	make TIMESTAMP=`date +"%s"` METAMTARGET="LAUNCH" \
  190: 	MTARGET="webserverconf" HOSTNAME="$(HOSTNAME)" lpmladm
  191: 
  192: webserverconf:
  193: 	cat ../../doc/loncapafiles/webserver.piml | \
  194: 	perl piml_parse.pl $(CATEGORY) $(DIST) "$(TARGET)" $(LAUNCH)
  195: 
  196: sanitycheck:
  197: 	cat ../../doc/loncapafiles/sanitycheck.piml | \
  198: 	perl piml_parse.pl $(CATEGORY) $(DIST) "$(TARGET)" $(LAUNCH) | \
  199: 	tee -a WARNINGS
  200: 
  201: postinstall:
  202: 	make webserverconf
  203: 	make sanitycheck
  204: 
  205: install: TEST_hosts_tab Makefile.install Makefile
  206: 	echo -n "" > WARNINGS
  207: 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
  208: 	directories
  209: 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" files
  210: 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" links
  211: 	make SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
  212: 	NORESTORECONF="$(NORESTORECONF)" configinstall
  213: 	make postinstall
  214: 	make warningnote
  215: 	echo "You can run 'make test' to see if your system is ready to go!"
  216: 
  217: Makefile.install: ../../doc/loncapafiles/loncapafiles.lpml lpml_parse.pl
  218: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
  219: 	perl lpml_parse.pl install $(CATEGORY) $(DIST) "$(SOURCE)" \
  220: 	"$(TARGET)" > Makefile.install
  221: 
  222: build: Makefile.build pod2html.sh pod2man.sh
  223: 	echo -n "" > WARNINGS
  224: 	make -f Makefile.build all
  225: 	make warningnote
  226: 
  227: Makefile.build: ../../doc/loncapafiles/loncapafiles.lpml lpml_parse.pl
  228: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
  229: 	perl lpml_parse.pl build $(CATEGORY) $(DIST) "$(SOURCE)" "$(TARGET)" \
  230: 	> Makefile.build
  231: 
  232: RPM: BinaryRoot base_rpm_file_list
  233: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
  234: 	perl lpml_parse.pl make_rpm $(CATEGORY) $(DIST) $(SOURCE) $(TARGET) \
  235: 	> base_customizerpm.xml
  236: 	cat base_rpm_file_list.txt | perl make_rpm.pl base 3.2 '' '' \
  237: 	BinaryRoot base_customizerpm.xml
  238: 
  239: setup_RPM:
  240: 	echo "SetupBinaryRoot/etc/passwd" > setup_rpm_file_list.txt
  241: 	echo "SetupBinaryRoot/etc/group" >> setup_rpm_file_list.txt
  242: 	echo "SetupBinaryRoot/etc/hosts.deny" >> setup_rpm_file_list.txt
  243: 	echo "SetupBinaryRoot/home/www" >> setup_rpm_file_list.txt
  244: 	echo "SetupBinaryRoot/etc/pam.d/passwd" >> setup_rpm_file_list.txt
  245: 	echo "SetupBinaryRoot/etc/pam.d/login" >> setup_rpm_file_list.txt
  246: 	perl setup_rpm_binaryroot.pl
  247: 	cat setup_rpm_file_list.txt | perl make_rpm.pl setup 3.2 '' '' \
  248: 	SetupBinaryRoot customizerpm.xml
  249: 
  250: DPKG:
  251: 	make TARGET='LON-CAPA-base' NORESTORECONF='1' install
  252: 	@echo "You will next need to follow instructions at:"
  253: 	@echo "http://people.debian.org/~jaldhar/make_package1.html"
  254: 	@echo "A directory with a snapshot of the debian package files"
  255: 	@echo "is LON-CAPA-base."
  256: 
  257: base_rpm_file_list:
  258: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
  259: 	perl lpml_parse.pl rpm_file_list $(CATEGORY) $(DIST) $(SOURCE) \
  260: 	'BinaryRoot' | sort > base_rpm_file_list.txt
  261: 
  262: BinaryRoot: base_rpm_file_list
  263: 	make TARGET='BinaryRoot' NORESTORECONF='1' install
  264: 
  265: # Generates CVS:loncom/build/docs; root location of install.lon-capa.org
  266: doc:
  267: 	install -d docs
  268: 	install -m 0755 -d docs/icons
  269: 	install -m 0644 ../../doc/icons/[^C][^V]* docs/icons
  270: 	install -m 0755 -d docs/reconfig
  271: 	perl doc_template.pl ../../doc/templates/template.html \
  272: 		../../doc/build/reconfig.html > docs/reconfig/index.html
  273: 	install -m 0755 -d docs/reconfig/confexamples
  274: 	install -m 0644 ../../doc/build/confexamples/[^C][^V]* \
  275: 		docs/reconfig/confexamples
  276: 	perl doc_template.pl ../../doc/templates/template.html \
  277: 		../../doc/build/installindex.html > docs/index.html
  278: 	install -m 0755 -d docs/license
  279: 	perl doc_template.pl ../../doc/templates/template.html \
  280: 		../../doc/build/license.html > docs/license/index.html
  281: 	install -m 0755 -d docs/contact
  282: 	perl doc_template.pl ../../doc/templates/template.html \
  283: 		../../doc/build/contact.html > docs/contact/index.html
  284: 	install -m 0755 -d docs/faq
  285: 	perl doc_template.pl ../../doc/templates/template.html \
  286: 		../../doc/build/faq.html > docs/faq/index.html
  287: 	install -m 0755 -d docs/downloads
  288: 	perl doc_template.pl ../../doc/templates/template.html \
  289: 		../../doc/build/download.html > docs/downloads/index.html
  290: 	install -m 0755 -d docs/install
  291: 	perl doc_template.pl ../../doc/templates/template.html \
  292: 		../../doc/build/install.html > docs/install/index.html
  293: 	install -m 0755 -d docs/upgrade
  294: 	perl doc_template.pl ../../doc/templates/template.html \
  295: 		../../doc/build/upgrade.html > docs/upgrade/index.html
  296: 	cd docs; tar czvpf ../docs.tar.gz .
  297: 
  298: documentation_tree: cvsreport
  299: 	install -d docs
  300: 	install ../../doc/build/cvsreport.html docs/cvsreport.html
  301: 	install ../../doc/build/doc.html docs/index.html
  302: 	install -d docs/hardware
  303: 	install ../../doc/hardware/hardware.html docs/hardware/hardware.html
  304: 	install -d docs/3.1
  305: 	install ../../doc/build/install.html docs/3.1/index.html
  306: 	install ../../doc/build/instructions_with_cd.html \
  307: 	docs/3.1/instructions_with_cd.html
  308: 	install ../../doc/build/libraryserverconfiguration.gif \
  309: 	docs/3.1/libraryserverconfiguration.gif
  310: 	install ../../doc/build/librarysystemsettings.gif \
  311: 	docs/3.1/librarysystemsettings.gif
  312: 	install -d docs/cvsupgrade
  313: 	install ../../doc/build/cvsupgrade.html docs/cvsupgrade/index.html
  314: 	install -d docs/upgrade
  315: 	install ../../doc/build/upgrade.html docs/upgrade/index.html
  316: 	install -d docs/reconfig
  317: 	install ../../doc/build/reconfig.html docs/reconfig/index.html
  318: 	install -d docs/3.1/otherfiles
  319: 	install ../../doc/otherfiles/rpm_list.txt \
  320: 	docs/3.1/otherfiles/rpm_list.txt
  321: 	install ../../doc/build/loncapanetwork.html docs/loncapanetwork.html
  322: 	install ../../doc/build/loncapanfs.html docs/loncapanfs.html
  323: 	install ../../doc/build/loncapaappleshares.html \
  324: 	docs/loncapaappleshares.html
  325: 	install ../../doc/build/loncapasqldatabase.html \
  326: 	docs/loncapasqldatabase.html
  327: 	install ../../doc/build/loncapapasswords.html \
  328: 	docs/loncapapasswords.html
  329: 	install ../../doc/build/loncapapasswordauthentication.html \
  330: 	docs/loncapapasswordauthentication.html
  331: 	install ../../doc/build/loncapatimesync.html docs/loncapatimesync.html
  332: 	install ../../doc/build/loncapamathequivalency.html \
  333: 	docs/loncapamathequivalency.html
  334: 	tar czvf install.lon-capa.org_docs.tar.gz docs
  335: 	rm -Rf docs
  336: 
  337: cvsreport:
  338: 
  339: clean:
  340: 	rm -Rf HTML
  341: 	rm -f Makefile.build
  342: 	rm -f Makefile.install
  343: 	rm -f Makefile.configinstall
  344: 	rm -Rf BinaryRoot
  345: 	rm -Rf SetupBinaryRoot
  346: 	rm -Rf LON-CAPA-base
  347: 	rm -f base_rpm_file_list.txt
  348: 	rm -f base_customizerpm.xml
  349: 	rm -f setup_rpm_file_list.txt
  350: 	rm -f docs.tar.gz
  351: 	rm -Rf docs
  352: 	rm -f program.pl*
  353: 	rm -Rf lpmladm.*
  354: 	make -f Makefile.cvs clean

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