File:  [LON-CAPA] / loncom / build / Makefile
Revision 1.73: download - view: text, annotated - select for diffs
Fri Mar 1 19:58:13 2002 UTC (22 years, 3 months ago) by harris41
Branches: MAIN
CVS tags: HEAD
minor fix to instructions... WARNINGS file is no longer "output below"

    1: # The LearningOnline Network with CAPA
    2: 
    3: # Scott Harrison
    4: # $Id: Makefile,v 1.73 2002/03/01 19:58:13 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 of web layers is not yet implemented."
   68: 
   69: TEST_hosts_tab:
   70: 	@echo "Testing hosts.tab"
   71: 	@if (test -h ../hosts.tab); then \
   72: 		echo "there is a defined link; assume okay"; \
   73: 	else echo "**** ERROR **** hosts.tab not defined!" && \
   74: 	     echo -n "You need to do one of the following within your " && \
   75: 	     echo "CVS repository" && \
   76: 	     echo "   1) cd ../; ln -s production_hosts.tab hosts.tab" && \
   77: 	     echo "   2) cd ../; ln -s development_hosts.tab hosts.tab" && \
   78: 	     echo "or 3) cd ../; ln -s rawhide_hosts.tab hosts.tab" && \
   79: 	     echo "(you most likely want option #1, production_hosts.tab)" && \
   80: 	     exit 1; \
   81: 	fi
   82: 
   83: NET_hosts_tab:
   84: 	make TIMESTAMP=`date +"%s"` METAMTARGET="TRANSPORT" \
   85: 	MTARGET="hosts_tab" HOSTNAME="$(HOSTNAME)" lpmladm
   86: 
   87: hosts_tab: TEST_hosts_tab
   88: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
   89: 	perl xfml_parse.pl ../../doc/loncapafiles/valid_hosts.xfml | \
   90: 	perl lpml_parse.pl install $(CATEGORY) $(DIST) "$(SOURCE)" \
   91: 	"$(TARGET)" > Makefile.install
   92: 	make -f Makefile.install directories
   93: 	make -f Makefile.install files
   94: 	@echo "If hosts.tab has changed, restart httpd and loncontrol:"
   95: 	@echo "   /etc/rc.d/init.d/httpd restart"
   96: 	@echo "   /etc/rc.d/init.d/loncontrol restart"
   97: 
   98: lpmladm:
   99: 	@if (test $(METAMTARGET) = "TRANSPORT"); then \
  100: 		echo "Transporting to $(HOSTNAME)"; \
  101: 		sudo make DIST=$(DIST) CATEGORY=$(CATEGORY) \
  102: 		SOURCE="$(SOURCE)" \
  103: 		TARGET="lpmladm.$(TIMESTAMP)" \
  104: 		NORESTORECONF="$(NORESTORECONF)" "$(MTARGET)"; \
  105: 		cd lpmladm.$(TIMESTAMP); \
  106: 		sudo tar czvf ../tarball$(TIMESTAMP).tar.gz .; \
  107: 		cd ..; scp tarball$(TIMESTAMP).tar.gz \
  108: 		lpmladm@$(HOSTNAME):~/tarball$(TIMESTAMP).tar.gz; \
  109: 		ssh lpmladm@$(HOSTNAME) sudo mv tarball$(TIMESTAMP).tar.gz /; \
  110: 		ssh lpmladm@$(HOSTNAME) sudo tar -x -z -v -C / \
  111: 		-p --same-owner -f \
  112: 		/tarball$(TIMESTAMP).tar.gz; \
  113: 		ssh lpmladm@$(HOSTNAME) sudo rm -f \
  114: 		/tarball$(TIMESTAMP).tar.gz; \
  115: 	elif (test $(METAMTARGET) = "LAUNCH"); then \
  116: 		echo "Launching process on $(HOSTNAME)"; \
  117: 		LAUNCHSAVE=$(OUTSTREAM) $(SAVE); \
  118: 		make DIST=$(DIST) CATEGORY=$(CATEGORY) SOURCE="$(SOURCE)" \
  119: 		TARGET="$(TARGET)" NORESTORECONF="$(NORESTORECONF)" \
  120: 		LAUNCH="$(LAUNCHSAVE)" "$(MTARGET)"; \
  121: 		scp $(SAVE) lpmladm@$(HOSTNAME):~/$(SAVE); \
  122: 		ssh lpmladm@$(HOSTNAME) sudo perl $(SAVE); \
  123: 		ssh lpmladm@$(HOSTNAME) sudo rm -f $(SAVE); \
  124: 	else \
  125: 		echo "**** ERROR **** Incorrect METAMTARGET"; \
  126: 	fi
  127: 
  128: HTML:
  129: 	install -d HTML
  130: 	cp ../../doc/loncapafiles/*.gif HTML
  131: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
  132: 	perl lpml_parse.pl html development default ../.. '' > HTML/index.html
  133: 
  134: status:
  135: 	install -d HTML
  136: 	cp ../../doc/loncapafiles/*.gif HTML
  137: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
  138: 	perl lpml_parse.pl html $(CATEGORY) $(DIST) "../.." "" | \
  139: 	perl lpml_html_posteval.pl > \
  140: 	HTML/filestatus.html
  141: 
  142: statuspost: status
  143: 	cp ../../doc/loncapafiles/*.gif $(TARGET)/home/httpd/html/lon-status
  144: 	cp HTML/filestatus.html \
  145: 	$(TARGET)/home/httpd/html/lon-status/filestatus.html
  146: 
  147: rpmstatus:
  148: 	install -d RPMSTATUS
  149: 	rpm -qa --queryformat \
  150: 	'%{NAME}\t%{VERSION}\t%{RELEASE}\t%{BUILDTIME}\n' | sort > \
  151: 	RPMSTATUS/current.tmp
  152: 	cat ../../doc/otherfiles/cd_rpms.txt > RPMSTATUS/standard.tmp
  153: 	cat ../../doc/otherfiles/rpm_list.txt > RPMSTATUS/expected.tmp
  154: 	perl rpmparse.pl RPMSTATUS/standard.tmp RPMSTATUS/current.tmp \
  155: 	RPMSTATUS/expected.tmp > RPMSTATUS/rpmstatus.html
  156: 
  157: rpmstatuspost: rpmstatus
  158: 	cp RPMSTATUS/rpmstatus.html /home/httpd/html/lon-status/rpmstatus.html
  159: 
  160: configinstall: Makefile.configinstall
  161: 	make -f Makefile.configinstall SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
  162: 	configfiles
  163: 	if (test "0" = $(NORESTORECONF)); then \
  164: 	perl loncaparestoreconfigurations suffix .lpmlnew; fi
  165: 
  166: Makefile.configinstall: ../../doc/loncapafiles/loncapafiles.lpml lpml_parse.pl
  167: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
  168: 	perl lpml_parse.pl configinstall $(CATEGORY) $(DIST) "$(SOURCE)" \
  169: 	"$(TARGET)" > Makefile.configinstall
  170: 
  171: warningnote:
  172: 	@if (test -s WARNINGS); then \
  173: 		W=`grep -c '\*\*\*\* WARNING' WARNINGS`; \
  174: 		E=`grep -c '\*\*\*\* ERROR' WARNINGS`; \
  175: 		N=`grep -c '\*\*\*\* NOTE' WARNINGS`; \
  176: 		echo "--->  $$W WARNINGS ENCOUNTERED!       "; \
  177: 		echo "--->  $$E ERRORS ENCOUNTERED!         "; \
  178: 		echo "--->  $$N NOTES ENCOUNTERED!          "; \
  179: 		echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
  180: 		echo "!!!!  Please read the WARNINGS file !!!!"; \
  181: 		echo "!!!!   to make sure everything is   !!!!"; \
  182: 		echo "!!!!    correct and taken care of   !!!!"; \
  183: 		echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
  184: 	fi
  185: 
  186: NET_webserverconf:
  187: 	make TIMESTAMP=`date +"%s"` METAMTARGET="LAUNCH" \
  188: 	MTARGET="webserverconf" HOSTNAME="$(HOSTNAME)" lpmladm
  189: 
  190: webserverconf:
  191: 	cat ../../doc/loncapafiles/webserver.piml | \
  192: 	perl piml_parse.pl $(CATEGORY) $(DIST) "$(TARGET)" $(LAUNCH)
  193: 
  194: postinstall:
  195: 	make webserverconf
  196: 
  197: install: TEST_hosts_tab Makefile.install Makefile
  198: 	echo -n "" > WARNINGS
  199: 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
  200: 	directories
  201: 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" files
  202: 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" links
  203: 	make SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
  204: 	NORESTORECONF="$(NORESTORECONF)" configinstall
  205: 	make postinstall
  206: 	make warningnote
  207: 
  208: Makefile.install: ../../doc/loncapafiles/loncapafiles.lpml lpml_parse.pl
  209: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
  210: 	perl lpml_parse.pl install $(CATEGORY) $(DIST) "$(SOURCE)" \
  211: 	"$(TARGET)" > Makefile.install
  212: 
  213: build: Makefile.build pod2html.sh pod2man.sh
  214: 	echo -n "" > WARNINGS
  215: 	make -f Makefile.build all
  216: 	make warningnote
  217: 
  218: Makefile.build: ../../doc/loncapafiles/loncapafiles.lpml lpml_parse.pl
  219: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
  220: 	perl lpml_parse.pl build $(CATEGORY) $(DIST) "../.." "" > \
  221: 	Makefile.build
  222: 
  223: RPM: BinaryRoot base_rpm_file_list
  224: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
  225: 	perl lpml_parse.pl make_rpm $(CATEGORY) $(DIST) $(SOURCE) $(TARGET) \
  226: 	> base_customizerpm.xml
  227: 	cat base_rpm_file_list.txt | perl make_rpm.pl base 3.2 '' '' \
  228: 	BinaryRoot base_customizerpm.xml
  229: 
  230: setup_RPM:
  231: 	echo "SetupBinaryRoot/etc/passwd" > setup_rpm_file_list.txt
  232: 	echo "SetupBinaryRoot/etc/group" >> setup_rpm_file_list.txt
  233: 	echo "SetupBinaryRoot/etc/hosts.deny" >> setup_rpm_file_list.txt
  234: 	echo "SetupBinaryRoot/home/www" >> setup_rpm_file_list.txt
  235: 	echo "SetupBinaryRoot/etc/pam.d/passwd" >> setup_rpm_file_list.txt
  236: 	echo "SetupBinaryRoot/etc/pam.d/login" >> setup_rpm_file_list.txt
  237: 	perl setup_rpm_binaryroot.pl
  238: 	cat setup_rpm_file_list.txt | perl make_rpm.pl setup 3.2 '' '' \
  239: 	SetupBinaryRoot customizerpm.xml
  240: 
  241: DPKG:
  242: 	make TARGET='LON-CAPA-base' NORESTORECONF='1' install
  243: 	@echo "You will next need to follow instructions at:"
  244: 	@echo "http://people.debian.org/~jaldhar/make_package1.html"
  245: 	@echo "A directory with a snapshot of the debian package files"
  246: 	@echo "is LON-CAPA-base."
  247: 
  248: base_rpm_file_list:
  249: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
  250: 	perl lpml_parse.pl rpm_file_list $(CATEGORY) $(DIST) $(SOURCE) \
  251: 	'BinaryRoot' | sort > base_rpm_file_list.txt
  252: 
  253: BinaryRoot: base_rpm_file_list
  254: 	make TARGET='BinaryRoot' NORESTORECONF='1' install
  255: 
  256: loncapaconfig:
  257: 	rm -Rf LoncapaconfigRoot
  258: 	install -d LoncapaconfigRoot/usr/src/
  259: 	install -d LoncapaconfigRoot/usr/lib/python1.5/site-packages
  260: 	install /usr/lib/python1.5/site-packages/kudzumodule.so \
  261: 	LoncapaconfigRoot/usr/lib/python1.5/site-packages/kudzumodule.so
  262: 	cd LoncapaconfigRoot/usr/src; cp -pR /mnt/drive/loncapaconfig .
  263: 	install -d LoncapaconfigRoot/usr/sbin
  264: 	@echo -e "#!/bin/sh\ncd /usr/src/loncapaconfig/usr/bin; \
  265: 	./loncapaconfig\n" > LoncapaconfigRoot/usr/sbin/loncapaconfig
  266: 	chmod u+x LoncapaconfigRoot/usr/sbin/loncapaconfig
  267: 	find LoncapaconfigRoot -type d | xargs chmod o-wxr
  268: 	find LoncapaconfigRoot -type f | xargs chmod o-wxr
  269: 	find LoncapaconfigRoot/ -type d | grep 'src/lon' > \
  270: 	loncapaconfig_file_list.txt
  271: 	find LoncapaconfigRoot/ -type d | grep \
  272: 	'^LoncapaconfigRoot/usr/lib/python1.5/site-packages' >> \
  273: 	loncapaconfig_file_list.txt
  274: 	find LoncapaconfigRoot/ -type f >> loncapaconfig_file_list.txt
  275: 	cat loncapaconfig_file_list.txt | perl make_rpm.pl loncapaconfig 3.1 \
  276: 	'' '' LoncapaconfigRoot
  277: 	cp LON-CAPA-loncapaconfig-3.1-1.i386.rpm \
  278: 	/mnt/drive/install.lon-capa.org/3.1/currentcdsource/RedHat/RPMS/.
  279: 
  280: # Generates CVS:loncom/build/docs; root location of install.lon-capa.org
  281: doc:
  282: 	install -d docs
  283: 	install -m 0755 -d docs/icons
  284: 	install -m 0644 ../../doc/icons/[^C][^V]* docs/icons
  285: 	install -m 0755 -d docs/reconfig
  286: 	perl doc_template.pl ../../doc/templates/template.html \
  287: 		../../doc/build/reconfig.html > docs/reconfig/index.html
  288: 	install -m 0755 -d docs/reconfig/confexamples
  289: 	install -m 0644 ../../doc/build/confexamples/[^C][^V]* \
  290: 		docs/reconfig/confexamples
  291: 	perl doc_template.pl ../../doc/templates/template.html \
  292: 		../../doc/build/installindex.html > docs/index.html
  293: 	install -m 0755 -d docs/license
  294: 	perl doc_template.pl ../../doc/templates/template.html \
  295: 		../../doc/build/license.html > docs/license/index.html
  296: 	install -m 0755 -d docs/contact
  297: 	perl doc_template.pl ../../doc/templates/template.html \
  298: 		../../doc/build/contact.html > docs/contact/index.html
  299: 	install -m 0755 -d docs/faq
  300: 	perl doc_template.pl ../../doc/templates/template.html \
  301: 		../../doc/build/faq.html > docs/faq/index.html
  302: 	install -m 0755 -d docs/downloads
  303: 	perl doc_template.pl ../../doc/templates/template.html \
  304: 		../../doc/build/download.html > docs/downloads/index.html
  305: 	install -m 0755 -d docs/install
  306: 	perl doc_template.pl ../../doc/templates/template.html \
  307: 		../../doc/build/install.html > docs/install/index.html
  308: 	install -m 0755 -d docs/upgrade
  309: 	perl doc_template.pl ../../doc/templates/template.html \
  310: 		../../doc/build/upgrade.html > docs/upgrade/index.html
  311: 	cd docs; tar czvpf ../docs.tar.gz .
  312: 
  313: documentation_tree: cvsreport
  314: 	install -d docs
  315: 	install ../../doc/build/cvsreport.html docs/cvsreport.html
  316: 	install ../../doc/build/doc.html docs/index.html
  317: 	install -d docs/hardware
  318: 	install ../../doc/hardware/hardware.html docs/hardware/hardware.html
  319: 	install -d docs/3.1
  320: 	install ../../doc/build/install.html docs/3.1/index.html
  321: 	install ../../doc/build/instructions_with_cd.html \
  322: 	docs/3.1/instructions_with_cd.html
  323: 	install ../../doc/build/libraryserverconfiguration.gif \
  324: 	docs/3.1/libraryserverconfiguration.gif
  325: 	install ../../doc/build/librarysystemsettings.gif \
  326: 	docs/3.1/librarysystemsettings.gif
  327: 	install -d docs/cvsupgrade
  328: 	install ../../doc/build/cvsupgrade.html docs/cvsupgrade/index.html
  329: 	install -d docs/upgrade
  330: 	install ../../doc/build/upgrade.html docs/upgrade/index.html
  331: 	install -d docs/reconfig
  332: 	install ../../doc/build/reconfig.html docs/reconfig/index.html
  333: 	install -d docs/3.1/otherfiles
  334: 	install ../../doc/otherfiles/rpm_list.txt \
  335: 	docs/3.1/otherfiles/rpm_list.txt
  336: 	install ../../doc/build/loncapanetwork.html docs/loncapanetwork.html
  337: 	install ../../doc/build/loncapanfs.html docs/loncapanfs.html
  338: 	install ../../doc/build/loncapaappleshares.html \
  339: 	docs/loncapaappleshares.html
  340: 	install ../../doc/build/loncapasqldatabase.html \
  341: 	docs/loncapasqldatabase.html
  342: 	install ../../doc/build/loncapapasswords.html \
  343: 	docs/loncapapasswords.html
  344: 	install ../../doc/build/loncapapasswordauthentication.html \
  345: 	docs/loncapapasswordauthentication.html
  346: 	install ../../doc/build/loncapatimesync.html docs/loncapatimesync.html
  347: 	install ../../doc/build/loncapamathequivalency.html \
  348: 	docs/loncapamathequivalency.html
  349: 	tar czvf install.lon-capa.org_docs.tar.gz docs
  350: 	rm -Rf docs
  351: 
  352: cvsreport:
  353: 
  354: clean:
  355: 	rm -Rf HTML
  356: 	rm -f Makefile.build
  357: 	rm -f Makefile.install
  358: 	rm -f Makefile.configinstall
  359: 	rm -Rf BinaryRoot
  360: 	rm -Rf SetupBinaryRoot
  361: 	rm -Rf LON-CAPA-base
  362: 	rm -f base_rpm_file_list.txt
  363: 	rm -f base_customizerpm.xml
  364: 	rm -f setup_rpm_file_list.txt
  365: 	rm -f docs.tar.gz
  366: 	rm -Rf docs
  367: 	rm -f program.pl*
  368: 	rm -Rf lpmladm.*
  369: 	make -f Makefile.cvs clean

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