File:  [LON-CAPA] / loncom / build / Makefile
Revision 1.77: download - view: text, annotated - select for diffs
Mon Mar 4 06:50:43 2002 UTC (22 years, 4 months ago) by harris41
Branches: MAIN
CVS tags: HEAD
turning on testing of the web layer for the 'test' target

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

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