Annotation of loncom/build/Makefile, revision 1.76

1.48      harris41    1: # The LearningOnline Network with CAPA
                      2: 
1.1       harris41    3: # Scott Harrison
1.76    ! harris41    4: # $Id: Makefile,v 1.75 2002/03/03 04:30:00 harris41 Exp $
1.1       harris41    5: 
1.38      harris41    6: DIST="default"
1.39      harris41    7: CATEGORY="development"
1.51      harris41    8: SOURCE="../.."
                      9: TARGET=""
1.55      harris41   10: NORESTORECONF="0"
1.66      harris41   11: HOSTNAME=""
                     12: LAUNCH=| perl
                     13: OUTSTREAM=>
                     14: SAVE=program.pl.$(TIMESTAMP)
                     15: LAUNCHSAVE=$(OUTSTREAM) $(SAVE)
                     16: METAMTARGET=""
                     17: MTARGET=""
1.12      harris41   18: 
1.53      harris41   19: help: 
1.52      harris41   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"
1.54      harris41   40: 	@echo "documentation_tree: compiles a documentation tree from the "
                     41:         @echo "                    CVS:doc directory"
1.52      harris41   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"
1.55      harris41   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"
1.1       harris41   54: 
1.52      harris41   55: test: TEST_lpml_scripts TEST_system_dependencies TEST_web_layer
1.41      harris41   56: 	@echo "ALL SYSTEM DEPENDENCY TESTS SUCCESSFUL"
                     57: 
                     58: TEST_system_dependencies:
1.52      harris41   59: 	@echo "TESTING SYSTEM DEPENDENCIES"
1.41      harris41   60: 	cd system_dependencies; make
1.44      harris41   61: 
                     62: TEST_lpml_scripts:
1.52      harris41   63: 	@echo "TESTING LPML INSTALLATION CODE"
1.44      harris41   64: 	cd ../test; perl filecomparetest.pl
1.41      harris41   65: 
1.52      harris41   66: TEST_web_layer:
                     67: 	@echo "Testing of web layers is not yet implemented."
1.2       harris41   68: 
1.63      harris41   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
1.64      harris41   82: 
1.66      harris41   83: NET_hosts_tab:
                     84: 	make TIMESTAMP=`date +"%s"` METAMTARGET="TRANSPORT" \
                     85: 	MTARGET="hosts_tab" HOSTNAME="$(HOSTNAME)" lpmladm
                     86: 
1.64      harris41   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
1.66      harris41   92: 	make -f Makefile.install directories
1.64      harris41   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: 
1.66      harris41   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: 
1.3       harris41  128: HTML:
                    129: 	install -d HTML
                    130: 	cp ../../doc/loncapafiles/*.gif HTML
1.55      harris41  131: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
                    132: 	perl lpml_parse.pl html development default ../.. '' > HTML/index.html
1.3       harris41  133: 
1.8       harris41  134: status:
1.7       harris41  135: 	install -d HTML
                    136: 	cp ../../doc/loncapafiles/*.gif HTML
1.39      harris41  137: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
1.49      harris41  138: 	perl lpml_parse.pl html $(CATEGORY) $(DIST) "../.." "" | \
                    139: 	perl lpml_html_posteval.pl > \
1.39      harris41  140: 	HTML/filestatus.html
1.48      harris41  141: 
1.22      harris41  142: statuspost: status
1.52      harris41  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
1.22      harris41  146: 
1.33      harris41  147: rpmstatus:
                    148: 	install -d RPMSTATUS
1.52      harris41  149: 	rpm -qa --queryformat \
                    150: 	'%{NAME}\t%{VERSION}\t%{RELEASE}\t%{BUILDTIME}\n' | sort > \
                    151: 	RPMSTATUS/current.tmp
1.34      harris41  152: 	cat ../../doc/otherfiles/cd_rpms.txt > RPMSTATUS/standard.tmp
1.36      harris41  153: 	cat ../../doc/otherfiles/rpm_list.txt > RPMSTATUS/expected.tmp
1.52      harris41  154: 	perl rpmparse.pl RPMSTATUS/standard.tmp RPMSTATUS/current.tmp \
                    155: 	RPMSTATUS/expected.tmp > RPMSTATUS/rpmstatus.html
1.33      harris41  156: 
                    157: rpmstatuspost: rpmstatus
                    158: 	cp RPMSTATUS/rpmstatus.html /home/httpd/html/lon-status/rpmstatus.html
                    159: 
1.37      albertel  160: configinstall: Makefile.configinstall
1.55      harris41  161: 	make -f Makefile.configinstall SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
                    162: 	configfiles
                    163: 	if (test "0" = $(NORESTORECONF)); then \
                    164: 	perl loncaparestoreconfigurations suffix .lpmlnew; fi
1.9       harris41  165: 
1.40      harris41  166: Makefile.configinstall: ../../doc/loncapafiles/loncapafiles.lpml lpml_parse.pl
                    167: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
1.55      harris41  168: 	perl lpml_parse.pl configinstall $(CATEGORY) $(DIST) "$(SOURCE)" \
                    169: 	"$(TARGET)" > Makefile.configinstall
1.37      albertel  170: 
1.45      harris41  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
1.65      harris41  185: 
1.66      harris41  186: NET_webserverconf:
                    187: 	make TIMESTAMP=`date +"%s"` METAMTARGET="LAUNCH" \
                    188: 	MTARGET="webserverconf" HOSTNAME="$(HOSTNAME)" lpmladm
                    189: 
1.65      harris41  190: webserverconf:
                    191: 	cat ../../doc/loncapafiles/webserver.piml | \
1.66      harris41  192: 	perl piml_parse.pl $(CATEGORY) $(DIST) "$(TARGET)" $(LAUNCH)
1.65      harris41  193: 
1.75      harris41  194: sanitycheck:
                    195: 	cat ../../doc/loncapafiles/sanitycheck.piml | \
1.76    ! harris41  196: 	perl piml_parse.pl $(CATEGORY) $(DIST) "$(TARGET)" $(LAUNCH) | \
        !           197: 	tee -a WARNINGS
1.75      harris41  198: 
1.65      harris41  199: postinstall:
                    200: 	make webserverconf
1.75      harris41  201: 	make sanitycheck
1.45      harris41  202: 
1.63      harris41  203: install: TEST_hosts_tab Makefile.install Makefile
1.46      harris41  204: 	echo -n "" > WARNINGS
1.52      harris41  205: 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
                    206: 	directories
1.51      harris41  207: 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" files
                    208: 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" links
1.55      harris41  209: 	make SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
                    210: 	NORESTORECONF="$(NORESTORECONF)" configinstall
1.72      harris41  211: 	make postinstall
1.45      harris41  212: 	make warningnote
1.76    ! harris41  213: 	echo "You can run 'make test' to see if your system is ready to go!"
1.4       harris41  214: 
1.38      harris41  215: Makefile.install: ../../doc/loncapafiles/loncapafiles.lpml lpml_parse.pl
                    216: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
1.52      harris41  217: 	perl lpml_parse.pl install $(CATEGORY) $(DIST) "$(SOURCE)" \
                    218: 	"$(TARGET)" > Makefile.install
1.37      albertel  219: 
1.50      harris41  220: build: Makefile.build pod2html.sh pod2man.sh
1.46      harris41  221: 	echo -n "" > WARNINGS
1.37      albertel  222: 	make -f Makefile.build all
1.45      harris41  223: 	make warningnote
1.37      albertel  224: 
1.39      harris41  225: Makefile.build: ../../doc/loncapafiles/loncapafiles.lpml lpml_parse.pl
                    226: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
                    227: 	perl lpml_parse.pl build $(CATEGORY) $(DIST) "../.." "" > \
                    228: 	Makefile.build
1.8       harris41  229: 
1.55      harris41  230: RPM: BinaryRoot base_rpm_file_list
1.63      harris41  231: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
                    232: 	perl lpml_parse.pl make_rpm $(CATEGORY) $(DIST) $(SOURCE) $(TARGET) \
                    233: 	> base_customizerpm.xml
1.55      harris41  234: 	cat base_rpm_file_list.txt | perl make_rpm.pl base 3.2 '' '' \
                    235: 	BinaryRoot base_customizerpm.xml
                    236: 
1.59      harris41  237: setup_RPM:
1.55      harris41  238: 	echo "SetupBinaryRoot/etc/passwd" > setup_rpm_file_list.txt
                    239: 	echo "SetupBinaryRoot/etc/group" >> setup_rpm_file_list.txt
                    240: 	echo "SetupBinaryRoot/etc/hosts.deny" >> setup_rpm_file_list.txt
                    241: 	echo "SetupBinaryRoot/home/www" >> setup_rpm_file_list.txt
                    242: 	echo "SetupBinaryRoot/etc/pam.d/passwd" >> setup_rpm_file_list.txt
                    243: 	echo "SetupBinaryRoot/etc/pam.d/login" >> setup_rpm_file_list.txt
                    244: 	perl setup_rpm_binaryroot.pl
                    245: 	cat setup_rpm_file_list.txt | perl make_rpm.pl setup 3.2 '' '' \
                    246: 	SetupBinaryRoot customizerpm.xml
1.60      harris41  247: 
                    248: DPKG:
                    249: 	make TARGET='LON-CAPA-base' NORESTORECONF='1' install
                    250: 	@echo "You will next need to follow instructions at:"
                    251: 	@echo "http://people.debian.org/~jaldhar/make_package1.html"
                    252: 	@echo "A directory with a snapshot of the debian package files"
                    253: 	@echo "is LON-CAPA-base."
1.55      harris41  254: 
                    255: base_rpm_file_list:
                    256: 	cat ../../doc/loncapafiles/loncapafiles.lpml | \
                    257: 	perl lpml_parse.pl rpm_file_list $(CATEGORY) $(DIST) $(SOURCE) \
                    258: 	'BinaryRoot' | sort > base_rpm_file_list.txt
1.6       harris41  259: 
1.55      harris41  260: BinaryRoot: base_rpm_file_list
                    261: 	make TARGET='BinaryRoot' NORESTORECONF='1' install
1.23      harris41  262: 
1.62      harris41  263: # Generates CVS:loncom/build/docs; root location of install.lon-capa.org
                    264: doc:
                    265: 	install -d docs
                    266: 	install -m 0755 -d docs/icons
                    267: 	install -m 0644 ../../doc/icons/[^C][^V]* docs/icons
                    268: 	install -m 0755 -d docs/reconfig
                    269: 	perl doc_template.pl ../../doc/templates/template.html \
                    270: 		../../doc/build/reconfig.html > docs/reconfig/index.html
                    271: 	install -m 0755 -d docs/reconfig/confexamples
                    272: 	install -m 0644 ../../doc/build/confexamples/[^C][^V]* \
                    273: 		docs/reconfig/confexamples
1.67      harris41  274: 	perl doc_template.pl ../../doc/templates/template.html \
                    275: 		../../doc/build/installindex.html > docs/index.html
                    276: 	install -m 0755 -d docs/license
                    277: 	perl doc_template.pl ../../doc/templates/template.html \
                    278: 		../../doc/build/license.html > docs/license/index.html
                    279: 	install -m 0755 -d docs/contact
                    280: 	perl doc_template.pl ../../doc/templates/template.html \
                    281: 		../../doc/build/contact.html > docs/contact/index.html
1.68      harris41  282: 	install -m 0755 -d docs/faq
                    283: 	perl doc_template.pl ../../doc/templates/template.html \
                    284: 		../../doc/build/faq.html > docs/faq/index.html
1.69      harris41  285: 	install -m 0755 -d docs/downloads
                    286: 	perl doc_template.pl ../../doc/templates/template.html \
                    287: 		../../doc/build/download.html > docs/downloads/index.html
                    288: 	install -m 0755 -d docs/install
                    289: 	perl doc_template.pl ../../doc/templates/template.html \
                    290: 		../../doc/build/install.html > docs/install/index.html
                    291: 	install -m 0755 -d docs/upgrade
                    292: 	perl doc_template.pl ../../doc/templates/template.html \
                    293: 		../../doc/build/upgrade.html > docs/upgrade/index.html
1.62      harris41  294: 	cd docs; tar czvpf ../docs.tar.gz .
                    295: 
1.54      harris41  296: documentation_tree: cvsreport
1.26      harris41  297: 	install -d docs
1.31      harris41  298: 	install ../../doc/build/cvsreport.html docs/cvsreport.html
1.26      harris41  299: 	install ../../doc/build/doc.html docs/index.html
                    300: 	install -d docs/hardware
1.27      harris41  301: 	install ../../doc/hardware/hardware.html docs/hardware/hardware.html
1.26      harris41  302: 	install -d docs/3.1
                    303: 	install ../../doc/build/install.html docs/3.1/index.html
1.52      harris41  304: 	install ../../doc/build/instructions_with_cd.html \
                    305: 	docs/3.1/instructions_with_cd.html
                    306: 	install ../../doc/build/libraryserverconfiguration.gif \
                    307: 	docs/3.1/libraryserverconfiguration.gif
                    308: 	install ../../doc/build/librarysystemsettings.gif \
                    309: 	docs/3.1/librarysystemsettings.gif
1.35      harris41  310: 	install -d docs/cvsupgrade
                    311: 	install ../../doc/build/cvsupgrade.html docs/cvsupgrade/index.html
1.26      harris41  312: 	install -d docs/upgrade
1.35      harris41  313: 	install ../../doc/build/upgrade.html docs/upgrade/index.html
1.26      harris41  314: 	install -d docs/reconfig
                    315: 	install ../../doc/build/reconfig.html docs/reconfig/index.html
1.27      harris41  316: 	install -d docs/3.1/otherfiles
1.52      harris41  317: 	install ../../doc/otherfiles/rpm_list.txt \
                    318: 	docs/3.1/otherfiles/rpm_list.txt
1.27      harris41  319: 	install ../../doc/build/loncapanetwork.html docs/loncapanetwork.html
                    320: 	install ../../doc/build/loncapanfs.html docs/loncapanfs.html
1.52      harris41  321: 	install ../../doc/build/loncapaappleshares.html \
                    322: 	docs/loncapaappleshares.html
                    323: 	install ../../doc/build/loncapasqldatabase.html \
                    324: 	docs/loncapasqldatabase.html
                    325: 	install ../../doc/build/loncapapasswords.html \
                    326: 	docs/loncapapasswords.html
                    327: 	install ../../doc/build/loncapapasswordauthentication.html \
                    328: 	docs/loncapapasswordauthentication.html
1.28      harris41  329: 	install ../../doc/build/loncapatimesync.html docs/loncapatimesync.html
1.52      harris41  330: 	install ../../doc/build/loncapamathequivalency.html \
                    331: 	docs/loncapamathequivalency.html
1.27      harris41  332: 	tar czvf install.lon-capa.org_docs.tar.gz docs
                    333: 	rm -Rf docs
1.26      harris41  334: 
1.30      harris41  335: cvsreport:
1.52      harris41  336: 
1.1       harris41  337: clean:
1.3       harris41  338: 	rm -Rf HTML
1.8       harris41  339: 	rm -f Makefile.build
                    340: 	rm -f Makefile.install
1.57      harris41  341: 	rm -f Makefile.configinstall
1.55      harris41  342: 	rm -Rf BinaryRoot
                    343: 	rm -Rf SetupBinaryRoot
1.62      harris41  344: 	rm -Rf LON-CAPA-base
1.56      harris41  345: 	rm -f base_rpm_file_list.txt
1.58      harris41  346: 	rm -f base_customizerpm.xml
1.56      harris41  347: 	rm -f setup_rpm_file_list.txt
1.62      harris41  348: 	rm -f docs.tar.gz
                    349: 	rm -Rf docs
1.66      harris41  350: 	rm -f program.pl*
                    351: 	rm -Rf lpmladm.*
1.67      harris41  352: 	make -f Makefile.cvs clean

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