File:  [LON-CAPA] / loncom / build / Makefile
Revision 1.142: download - view: text, annotated - select for diffs
Mon Jan 20 17:39:00 2003 UTC (21 years, 5 months ago) by harris41
Branches: MAIN
CVS tags: HEAD
supporting a release number (in advance of rpm-based filesystem handling...
which will happen sometime soon I hope)

    1: # The LearningOnline Network with CAPA
    2: 
    3: # Scott Harrison, your friendly neighborhood volunteer
    4: # $Id: Makefile,v 1.142 2003/01/20 17:39:00 harris41 Exp $
    5: 
    6: # TYPICAL USAGE of this Makefile is primarily for two targets:
    7: # "make build" and "make install".
    8: # Many other targets and features are supported (see the initial
    9: # help targets).
   10: 
   11: # ======================================= Default settings for Makefile options
   12: DISTPROBE=`perl ./distprobe`
   13: DIST=$(DISTPROBE)
   14: CATEGORY="development"
   15: SOURCE=../..
   16: TARGET=""
   17: NORESTORECONF="0"
   18: HOSTNAME=""
   19: LAUNCH=| perl
   20: QUERYLAUNCH=> /tmp/loncapa_query.pl; perl /tmp/loncapa_query.pl
   21: OUTSTREAM=>
   22: SAVE=program.pl.$(TIMESTAMP)
   23: LAUNCHSAVE=$(OUTSTREAM) $(SAVE)
   24: METAMTARGET=""
   25: MTARGET=""
   26: VERSION=0.6.1
   27: # The current working definition for "RELEASE" is: changes not in the software,
   28: # but in the operating system dependent packaging of the software.  Thus, the
   29: # generic tarball releases do not need to have a release number specified.
   30: RELEASE=1 # As a general rule for now, this is always being set to "1".
   31: DIRTARGET=loncapa-$(VERSION)
   32: 
   33: # =============================================== Help targets for the Makefile
   34: # If 'make' is run without any arguments, the 'help' target is called since
   35: # it is the first target.
   36: help:
   37: 	@echo "*** You need to specify a valid target ***"
   38: 	@echo "To get a list of valid targets: \"make help_TARGETS\""
   39: 	@echo "To get a list of valid options: \"make help_OPTIONS\""
   40: 	@echo " "
   41: 	@echo "Typically invoked targets are:"
   42: 	@echo "    make build"
   43: 	@echo "    make install"
   44: 	@echo "    make test"
   45: 	@echo "    make clean"
   46: 
   47: help_OPTIONS:
   48: 	@echo "* ADJUSTABLE OPTIONS *"
   49: 	@echo "(option) DIST can be redhat7, debian, redhat6.2, or default"
   50: 	@echo "         You probably do not need to specify this; it is"
   51: 	@echo "         automatically probed for."
   52: 	@echo "(option) CATEGORY can be 'runtime' or 'development'; currently"
   53: 	@echo "         the 'development' setting is the most reliable;"
   54: 	@echo "         eventually, production machines should be using the"
   55: 	@echo "         'runtime' settings"
   56: 	@echo "(option) SOURCE is an absolute or relative directory path."
   57: 	@echo "         SOURCE corresponds to the root directory of the"
   58: 	@echo "         loncapa source release"
   59: 	@echo "(option) TARGET is an absolute or relative directory path."
   60: 	@echo "         This is where files will be installed on your system."
   61: 	@echo "         Typically, this should be set to nothing (which"
   62: 	@echo "         corresponds to the '/' root of the entire filesystem)."
   63: 	@echo "(option) NORESTORECONF, when set to a non-zero value, stops"
   64: 	@echo "         filesystem upgrades from overwriting existing "
   65: 	@echo "         configuration files.  Ordinarily, NORESTORECONF=0, "
   66: 	@echo "         because the existing configuration files are safely"
   67: 	@echo "         dealt with (or so one hopes... :) )."
   68: 	@echo "(option) HOSTNAME specifies the name of a remote server for"
   69: 	@echo "         which a NET_* Makefile target should be launched"
   70: 	@echo "(option) VERSION; especially useful for the 'tardist' target"
   71: 	@echo "         this tags the tarball file and internal directories"
   72: 	@echo "         with a specific version string (conventionally "
   73: 	@echo "         numeric)"
   74: 
   75: help_TARGETS:
   76: 	@echo "*** RUNNING TESTS TO ENSURE SOLID PERFORMANCE ***"
   77: 	@echo "test: test different parts of the LON-CAPA system (TEST_*)."
   78: 	@echo "      Makefile-dependent processes as well as horizontal and"
   79: 	@echo "      vertical aspects of the LON-CAPA system architecture"
   80: 	@echo "      are all tested."
   81: 	@echo "TEST_lpml_scripts: make sure that the system can process"
   82: 	@echo "                   the Linux Packaging Markup Language."
   83: 	@echo "                   This is neither horizontal or vertical"
   84: 	@echo "                   testing.  The idea is to make sure that"
   85: 	@echo "                   the installation software itself works"
   86: 	@echo "                   as expected."
   87: 	@echo "TEST_system_dependencies: make sure that all needed system "
   88: 	@echo "                          components are active and present "
   89: 	@echo "                          on the server such as perl modules"
   90: 	@echo "                          and the MySQL database"
   91: 	@echo "                          (horizontal testing)"
   92: 	@echo "TEST_web_layer: mimic a login and various vertical actions on "
   93: 	@echo "                a LON-CAPA system"
   94: 	@echo "TEST_hosts_tab: make sure that a loncapa/loncom/hosts.tab"
   95: 	@echo "                file is specified for installation"
   96: 	@echo "TEST_html2ps: test for the presence of html2ps which is needed"
   97: 	@echo "              for making a PDF compilation for pdfdoc"
   98: 	@echo "*** GENERAL TARGETS SUCH AS 'build' AND 'install' ***"
   99: 	@echo "build: compile the source tree"
  100: 	@echo "buildflag: a semaphore that helps educate the user to run"
  101: 	@echo "           'make build' first before running 'make install'"
  102: 	@echo "configinstall: install configuration files and restore with"
  103: 	@echo "               prior information"
  104: 	@echo "install: install from a ***compiled*** source tree"
  105: 	@echo "         (see make build) to a specified TARGET destination"
  106: 	@echo "         on the filesystem (default setting is TARGET=/)."
  107: 	@echo "rawinstall: just install files, links and directories without"
  108: 	@echo "            any bells or whistles (e.g. double-checking"
  109: 	@echo "            configurations, fine-tuning webserver, etc.)"
  110: 	@echo "hosts_tab: install the hosts.tab to the filesystem"
  111: 	@echo "webserverconf: fine-tune the web server configuration;"
  112: 	@echo "               make sure the proper 'Include' statements"
  113: 	@echo "               are appended to httpd.conf"
  114: 	@echo "vanillatar: generate top-level files such as README, UPDATE,"
  115: 	@echo "            CHECKRPMS, and TEST (needed by tardist)"
  116: 	@echo "tardist: build a tarball that will upgrade the software on a "
  117: 	@echo "         system"
  118: 	@echo "sanitycheck: probe for common errors and recommend fixes to"
  119: 	@echo "             the user"
  120: 	@echo "updatequery: solicit the user for machine configuration"
  121: 	@echo "             information; to be incorporated during an update"
  122: 	@echo "             procedure (via the UPDATE command)"
  123: 	@echo "postinstall: double-check things after installation"
  124: 	@echo "VERSION: tag the filesystem with version information inside"
  125: 	@echo "         /etc/loncapa-release"
  126: 	@echo "aboutVERSION: place version information inside about.html"
  127: 	@echo "*** Makefile.* TARGETS BUILT DYNAMICALLY FROM loncapafiles.lpml ***"
  128: 	@echo "Makefile.configinstall: generate a Makefile for configuration"
  129: 	@echo "                        files; built dynamically from"
  130: 	@echo "                        loncapafiles.lpml"
  131: 	@echo "Makefile.build: generate a Makefile for compiling"
  132: 	@echo "                files inside the source directory; "
  133: 	@echo "                Makefile.build is generated from"
  134: 	@echo "                loncapafiles.lpml"
  135: 	@echo "Makefile.install: generate a Makefile for installing"
  136: 	@echo "                  files; built dynamically from"
  137: 	@echo "                  loncapafiles.lpml"
  138: 	@echo "*** TARGETS FOR OPERATING ON FILESYSTEMS ACROSS THE NETWORK ***"
  139: 	@echo "lpmladm: coordinates username=lpmladm mediated secure shell"
  140: 	@echo "         processes; needed for the NET_* targets"
  141: 	@echo "NET_hosts_tab: install the hosts.tab to a filesystem elsewhere"
  142: 	@echo "               on the network"
  143: 	@echo "NET_webserverconf: fine-tune the web server configuration on a"
  144: 	@echo "                   filesystem elsewhere on the network"
  145: 	@echo "NET_rawinstall: launch the rawinstall target on a filesystem"
  146: 	@echo "                elsewhere on the network"
  147: 	@echo "*** TARGETS FOR MAKING LISTS (MANIFESTS) OF LON-CAPA FILES ***"
  148: 	@echo "MANIFEST_all: generate a list of all files to be included in"
  149: 	@echo "              the distributed tarball"
  150: 	@echo "MANIFEST_cvs: essentially a list of all CVS/Entries files used"
  151: 	@echo "              for 'time-checking' intelligence"
  152: 	@echo "MANIFEST_lpml: a list of all LON-CAPA files to be installed,"
  153: 	@echo "               compile from, used as building software, and"
  154: 	@echo "               testing"
  155: 	@echo "MANIFEST_vanillatar: 'README'-type top-level files that a user"
  156: 	@echo "                     of the distributed tarball would first"
  157: 	@echo "                     look at and work with"
  158: 	@echo "*** STATUS REPORT TARGETS ***"
  159: 	@echo "warningnote: analyze the WARNINGS file and produce a synopsis"
  160: 	@echo "             and recommended action to the user"
  161: 	@echo "HTML: generate an HTML-formatted description of the LON-CAPA"
  162: 	@echo "      source files"
  163: 	@echo "status: compare the TARGET filesystem with a compiled loncapa "
  164: 	@echo "        source directory"
  165: 	@echo "statuspost: post the results of "make status" to "
  166: 	@echo "            TARGET/home/httpd/html/lon-status/filestatus.html"
  167: 	@echo "rpmstatus: compare the rpms on a system to defined lists "
  168: 	@echo "           loncapa/doc/otherfiles/cd_rpms and "
  169: 	@echo "           loncapa/doc/otherfiles/rpm_list.txt"
  170: 	@echo "rpmstatuspost: post the results of 'make rpmstatus' to "
  171: 	@echo "            TARGET/home/httpd/html/lon-status/rpmstatus.html"
  172: 	@echo "*** ALTERNATIVE PACKAGING TARGETS ***"
  173: 	@echo "RPM: build LON-CAPA-base RPM from loncapa source repository"
  174: 	@echo "     (still under development)"
  175: 	@echo "DPKG: build a loncapa Debian package from loncapa source"
  176: 	@echo "      repository (still under development)"
  177: 	@echo "base_rpm_file_list: create a file listing to be used for"
  178: 	@echo "                    generating an RPM software package"
  179: 	@echo "BinaryRoot: create a BinaryRoot directory to be used for"
  180: 	@echo "            generating an RPM software package"
  181: 	@echo "*** MASTER DOCUMENTATION TARGETS ***"	
  182: 	@echo "doc: generate web-page documentation for install.lon-capa.org"
  183: 	@echo "     (and eventually for documentation on installed machines)"
  184: 	@echo "pdfdoc: make a PDF-formatted compilation of all installation"
  185: 	@echo "        documentation"
  186: 	@echo "*** KEEPING THINGS CLEAN ***"
  187: 	@echo "clean: remove any files that might (even by remote chance)"
  188: 	@echo "       interfere with rebuilding/recompiling software"
  189: 	@echo "reallyclean: remove all files that were generated during"
  190: 	@echo "             building or compilation of the software"
  191: 	@echo "uninstall: remove all directories that do not contain files"
  192: 	@echo "           from other software packages and that do not contain"
  193: 	@echo "           student and instructor data; NOTE THAT THIS IS"
  194: 	@echo "           INTERACTIVE--you will be given a final chance"
  195: 	@echo "           to look at what will and will not be deleted."
  196: 	@echo "           Still, be careful.  This is a very new target and is"
  197: 	@echo "           an alpha-level software feature for now."
  198: 	@echo "backup: rolls a tarball backup of all important student and "
  199: 	@echo "        instructor data (NOT YET IMPLEMENTED)"
  200: 	@echo "restore: reseeds a LON-CAPA server with tarball backups "
  201: 	@echo "         generated by \"make backup\" (NOT YET IMPLEMENTED)"
  202: 	@echo "*** A HELPFUL DEPENDENCY ***"
  203: 	@echo "alwaysrun: blank target that is a dependency for targets"
  204: 	@echo "           that should \"always run\""
  205: 
  206: # =========================== *** RUNNING TESTS TO ENSURE SOLID PERFORMANCE ***
  207: 
  208: test: TEST_lpml_scripts TEST_system_dependencies TEST_web_layer
  209: 	@echo "ALL SYSTEM DEPENDENCY TESTS SUCCESSFUL"
  210: 
  211: TEST_system_dependencies:
  212: 	@echo "TESTING SYSTEM DEPENDENCIES"
  213: 	cd system_dependencies; make
  214: 
  215: TEST_lpml_scripts:
  216: 	@echo "TESTING LPML INSTALLATION CODE"
  217: 	cd ../test; perl filecomparetest.pl
  218: 
  219: TEST_web_layer:
  220: 	@echo "TESTING WEB LAYER"
  221: 	cd weblayer_test; make
  222: 
  223: TEST_hosts_tab:
  224: 	@echo "Testing hosts.tab"
  225: 	@if (test -e ../hosts.tab); then \
  226: 		echo "there is a defined link or file; assume okay"; \
  227: 	else echo "**** ERROR **** hosts.tab not defined!" && \
  228: 	     echo -n "You need to do one of the following within your " && \
  229: 	     echo "CVS repository (cd loncapa/loncom)" && \
  230: 	     echo "   1) ln -s production_hosts.tab hosts.tab" && \
  231: 	     echo "   2) ln -s development_hosts.tab hosts.tab" && \
  232: 	     echo "or 3) ln -s rawhide_hosts.tab hosts.tab" && \
  233: 	     echo "(you most likely want option #1, production_hosts.tab)" && \
  234: 	     exit 1; \
  235: 	fi
  236: 
  237: TEST_html2ps:
  238: 	@if (test -e /usr/local/html2ps/bin/html2ps); then \
  239: 		echo "I can find html2ps; assume okay"; \
  240: 	else \
  241: 	echo "**** ERROR **** cannot find /usr/local/html2ps/bin/html2ps!" && \
  242:         echo "Please visit http://www.tdb.uu.se/~jan/html2ps.html" && \
  243: 	exit 1; \
  244: 	fi
  245: 
  246: # ======================= *** GENERAL TARGETS SUCH AS 'build' AND 'install' ***
  247: 
  248: build: Makefile.build pod2html.sh pod2man.sh
  249: 	install -d $(SOURCE)/doc/man
  250: 	install -d $(SOURCE)/doc/scripts
  251: 	install -d $(SOURCE)/doc/lib/perl/Apache
  252: 	echo -n "" > WARNINGS
  253: 	make -f Makefile.build all
  254: 	echo '1' > buildflag
  255: 	make warningnote
  256: 
  257: buildflag:
  258: 	@echo "**** ERROR **** You need to run 'make build' first" > WARNINGS
  259: 	make warningnote
  260: 	@need_to_run_make_build_first 2>/dev/null
  261: 
  262: configinstall: Makefile.configinstall
  263: 	make -f Makefile.configinstall SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
  264: 	configfiles
  265: 	if (test "0" = $(NORESTORECONF)); then \
  266: 	perl loncaparestoreconfigurations suffix .lpmlnew; fi
  267: 
  268: install: buildflag VERSION TEST_hosts_tab Makefile.install Makefile
  269: 	echo -n "" > WARNINGS
  270: 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
  271: 	directories
  272: 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" files
  273: 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" links
  274: 	make SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
  275: 	NORESTORECONF="$(NORESTORECONF)" configinstall
  276: 	make postinstall
  277: 	make warningnote
  278: 	echo "You can run 'make test' to see if your system is ready to go!"
  279: 	echo "NOTE THAT YOUR SYSTEM MUST HAVE MYSQL WITH A USER=\"www\" AND"
  280: 	echo -n "PASSWORD=\"localhostkey\" FOR www\@localhost"
  281: 	echo -n "(YOU MAY NEED TO REINITIALIZE YOUR MYSQL www\@localhost USER)"
  282: 	echo -n "Please see http://install.lon-capa.org/ for more information"
  283: 
  284: rawinstall: VERSION Makefile.install Makefile
  285: 	echo -n "" > WARNINGS
  286: 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
  287: 	directories
  288: 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" files
  289: 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" links
  290: 	make SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
  291: 	NORESTORECONF="$(NORESTORECONF)" configinstall
  292: 
  293: hosts_tab: TEST_hosts_tab
  294: 	cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
  295: 	perl xfml_parse.pl $(SOURCE)/doc/loncapafiles/valid_hosts.xfml | \
  296: 	perl lpml_parse.pl install $(CATEGORY) $(DIST) "$(SOURCE)" \
  297: 	"$(TARGET)" > Makefile.install
  298: 	make -f Makefile.install directories
  299: 	make -f Makefile.install files
  300: 	@echo "If hosts.tab has changed, restart httpd and loncontrol:"
  301: 	@echo "   /etc/rc.d/init.d/httpd restart"
  302: 	@echo "   /etc/rc.d/init.d/loncontrol restart"
  303: 
  304: webserverconf:
  305: 	cat $(SOURCE)/doc/loncapafiles/webserver.piml | \
  306: 	perl piml_parse.pl $(CATEGORY) $(DIST) "$(TARGET)" $(LAUNCH)
  307: 
  308: # ---------------- Top-level files such as README, UPDATE, CHECKRPMS, and TEST
  309: vanillatar:
  310: 	# --------------------------- Point UPDATE to the internal make process
  311: 	echo '#!/bin/sh' > $(SOURCE)/UPDATE
  312: 	echo 'touch loncom/build/WARNINGS' >> $(SOURCE)/UPDATE;
  313: 	echo 'ln -s loncom/build/WARNINGS WARNINGS' >> $(SOURCE)/UPDATE;
  314: 	echo 'cd loncom/build; make build' >> $(SOURCE)/UPDATE
  315: 	echo 'make rawinstall' >> $(SOURCE)/UPDATE
  316: 	echo 'make configinstall' >> $(SOURCE)/UPDATE
  317: 	echo 'make updatequery' >> $(SOURCE)/UPDATE
  318: 	echo 'make hosts_tab' >> $(SOURCE)/UPDATE
  319: 	echo 'make postinstall' >> $(SOURCE)/UPDATE
  320: 	echo 'make aboutVERSION' >> $(SOURCE)/UPDATE
  321: 	echo 'make warningnote' >> $(SOURCE)/UPDATE
  322: 	# ----------------------------- Point TEST to the internal make process
  323: 	echo '#!/bin/sh' > $(SOURCE)/TEST
  324: 	echo 'cd loncom/build; make test' >> $(SOURCE)/TEST
  325: 	echo 'cd system_dependencies || cd loncom/build/system_dependencies; cp -v CPAN_STATUS_REPORT ../../../CPAN_STATUS_REPORT' >> $(SOURCE)/TEST
  326: 	# ----------------------------- Copy CHECKRPMS to the vanilla top-level
  327: 	cp -v $(SOURCE)/loncom/build/CHECKRPMS $(SOURCE)/CHECKRPMS
  328: 	# ----------------------- vanilla executables must indeed be executable
  329: 	chmod a+rx $(SOURCE)/UPDATE
  330: 	chmod a+rx $(SOURCE)/TEST
  331: 	chmod a+rx $(SOURCE)/CHECKRPMS
  332: 	# -------------------------------- Copy README to the vanilla top-level
  333: 	cp -v $(SOURCE)/doc/shortest_path_redhat7.2.txt $(SOURCE)/README
  334: 
  335: tardist:
  336: 	make MANIFEST_all
  337: 	make vanillatar
  338: 	# -------------------------------------------------------- Make tardist
  339: 	@cd $(SOURCE); \
  340: 	if (test -h $(DIRTARGET)); then \
  341: 		echo "$(DIRTARGET) link already defined; assume okay"; \
  342: 	else \
  343: 		ln -s . $(DIRTARGET); \
  344: 	fi
  345: 	cp -v $(SOURCE)/loncom/license/about.html \
  346: 	$(SOURCE)/loncom/license/about.html.orig
  347: 	make aboutVERSION
  348: 	cd $(SOURCE); \
  349: 	tar --no-recursion --numeric-owner --files-from MANIFEST \
  350: 	-h -czf $(DIRTARGET).tar.gz 2>tar_WARNINGS || [ "0" == "0" ]
  351: 	mv -v $(SOURCE)/loncom/license/about.html.orig \
  352: 	$(SOURCE)/loncom/license/about.html
  353: 	cat $(SOURCE)/tar_WARNINGS | \
  354: 	xargs --replace=XXX echo '**** WARNING **** XXX' > WARNINGS
  355: 	rm -f $(SOURCE)/tar_WARNINGS
  356: 	make warningnote
  357: 
  358: sanitycheck:
  359: 	cat $(SOURCE)/doc/loncapafiles/sanitycheck.piml | \
  360: 	perl piml_parse.pl $(CATEGORY) $(DIST) "$(TARGET)" $(LAUNCH) | \
  361: 	tee -a WARNINGS
  362: 
  363: updatequery:
  364: 	cat $(SOURCE)/doc/loncapafiles/updatequery.piml | \
  365: 	perl piml_parse.pl $(CATEGORY) $(DIST) "$(TARGET)" $(QUERYLAUNCH)
  366: 
  367: reseval_fixup:
  368: 	cat $(SOURCE)/doc/loncapafiles/reseval_fixup.piml | \
  369: 	perl piml_parse.pl $(CATEGORY) $(DIST) "$(TARGET)" $(LAUNCH) | \
  370: 	tee -a WARNINGS
  371: 
  372: clearoutoldspreadsheetcache:
  373: 	cat $(SOURCE)/doc/loncapafiles/clearoutoldspreadsheetcache.piml | \
  374: 	perl piml_parse.pl $(CATEGORY) $(DIST) "$(TARGET)" $(LAUNCH) | \
  375: 	tee -a WARNINGS
  376: 
  377: sendmail_fix:
  378: 	cat $(SOURCE)/doc/loncapafiles/sendmail_fix.piml | \
  379: 	perl piml_parse.pl $(CATEGORY) $(DIST) "$(TARGET)" $(LAUNCH) | \
  380: 	tee -a WARNINGS
  381: 
  382: postinstall:
  383: 	make webserverconf
  384: 	make reseval_fixup
  385: 	make clearoutoldspreadsheetcache
  386: 	make sanitycheck
  387: 	make sendmail_fix
  388: 
  389: VERSION:
  390: 	install -d $(TARGET)/etc
  391: 	echo -n "LON-CAPA release $(VERSION)-" > $(TARGET)/etc/loncapa-release
  392: 	date +"%Y%m%d" >> $(TARGET)/etc/loncapa-release
  393: 
  394: aboutVERSION:
  395: 	cat $(SOURCE)/loncom/license/about.html | \
  396: 	perl -e '$$d=`date +"%Y%m%d"`;chomp($$d);while(<>){s/\<\!\-\- VERSION \-\-\>/$(VERSION)-$$d/; print;}' > \
  397: 	$(SOURCE)/loncom/license/about.html.new
  398: 	mv -v $(SOURCE)/loncom/license/about.html.new \
  399: 	$(SOURCE)/loncom/license/about.html
  400: 
  401: # ========= *** Makefile.* TARGETS BUILT DYNAMICALLY FROM loncapafiles.lpml ***
  402: 
  403: Makefile.configinstall: $(SOURCE)/doc/loncapafiles/loncapafiles.lpml \
  404:                         lpml_parse.pl
  405: 	cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
  406: 	perl lpml_parse.pl configinstall $(CATEGORY) $(DIST) "$(SOURCE)" \
  407: 	"$(TARGET)" > Makefile.configinstall
  408: 
  409: Makefile.build: $(SOURCE)/doc/loncapafiles/loncapafiles.lpml lpml_parse.pl
  410: 	cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
  411: 	perl lpml_parse.pl build $(CATEGORY) $(DIST) "$(SOURCE)" "$(TARGET)" \
  412: 	> Makefile.build
  413: 
  414: Makefile.install: alwaysrun
  415: 	cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
  416: 	perl lpml_parse.pl install $(CATEGORY) $(DIST) "$(SOURCE)" \
  417: 	"$(TARGET)" > Makefile.install
  418: 
  419: # ============= *** TARGETS FOR OPERATING ON FILESYSTEMS ACROSS THE NETWORK ***
  420: 
  421: lpmladm:
  422: 	@if (test $(METAMTARGET) = "TRANSPORT"); then \
  423: 		echo "Transporting to $(HOSTNAME)"; \
  424: 		sudo make DIST=$(DIST) CATEGORY=$(CATEGORY) \
  425: 		SOURCE="$(SOURCE)" \
  426: 		TARGET="lpmladm.$(TIMESTAMP)" \
  427: 		NORESTORECONF="$(NORESTORECONF)" "$(MTARGET)"; \
  428: 		cd lpmladm.$(TIMESTAMP); \
  429: 		sudo tar czvf ../tarball$(TIMESTAMP).tar.gz .; \
  430: 		cd ..; scp tarball$(TIMESTAMP).tar.gz \
  431: 		lpmladm@$(HOSTNAME):~/tarball$(TIMESTAMP).tar.gz; \
  432: 		ssh lpmladm@$(HOSTNAME) sudo mv tarball$(TIMESTAMP).tar.gz /; \
  433: 		ssh lpmladm@$(HOSTNAME) sudo tar -x -z -v -C / \
  434: 		-p --same-owner -f \
  435: 		/tarball$(TIMESTAMP).tar.gz; \
  436: 		ssh lpmladm@$(HOSTNAME) sudo rm -f \
  437: 		/tarball$(TIMESTAMP).tar.gz; \
  438: 	elif (test $(METAMTARGET) = "LAUNCH"); then \
  439: 		echo "Launching process on $(HOSTNAME)"; \
  440: 		LAUNCHSAVE=$(OUTSTREAM) $(SAVE); \
  441: 		make DIST=$(DIST) CATEGORY=$(CATEGORY) SOURCE="$(SOURCE)" \
  442: 		TARGET="$(TARGET)" NORESTORECONF="$(NORESTORECONF)" \
  443: 		LAUNCH="$(LAUNCHSAVE)" "$(MTARGET)"; \
  444: 		scp $(SAVE) lpmladm@$(HOSTNAME):~/$(SAVE); \
  445: 		ssh lpmladm@$(HOSTNAME) sudo perl $(SAVE); \
  446: 		ssh lpmladm@$(HOSTNAME) sudo rm -f $(SAVE); \
  447: 	else \
  448: 		echo "**** ERROR **** Incorrect METAMTARGET"; \
  449: 	fi
  450: 
  451: NET_hosts_tab:
  452: 	make TIMESTAMP=`date +"%s"` METAMTARGET="TRANSPORT" \
  453: 	MTARGET="hosts_tab" HOSTNAME="$(HOSTNAME)" lpmladm
  454: 
  455: NET_webserverconf:
  456: 	make TIMESTAMP=`date +"%s"` METAMTARGET="LAUNCH" \
  457: 	MTARGET="webserverconf" HOSTNAME="$(HOSTNAME)" lpmladm
  458: 
  459: NET_rawinstall:
  460: 	make TIMESTAMP=`date +"%s"` METAMTARGET="TRANSPORT" \
  461: 	MTARGET="rawinstall" HOSTNAME="$(HOSTNAME)" lpmladm
  462: 
  463: # ============== *** TARGETS FOR MAKING LISTS (MANIFESTS) OF LON-CAPA FILES ***
  464: 
  465: MANIFEST_all:
  466: 	# --------------------------------------------------------- start clean
  467: 	rm -f $(SOURCE)/MANIFEST
  468: 	make MANIFEST_lpml
  469: 	make MANIFEST_vanillatar
  470: 	make MANIFEST_cvs
  471: 	# ---------------------------------- might as well include the MANIFEST
  472: 	echo 'MANIFEST' >> $(SOURCE)/MANIFEST
  473: 	# ------------------------------------------ hosts.tab are belong to us
  474: 	echo 'loncom/rawhide_hosts.tab' >> $(SOURCE)/MANIFEST
  475: 	echo 'loncom/production_hosts.tab' >> $(SOURCE)/MANIFEST
  476: 	echo 'loncom/development_hosts.tab' >> $(SOURCE)/MANIFEST
  477: 	# ------------------ Files needed for dynamically generated directories
  478: 	echo 'doc/man' >> $(SOURCE)/MANIFEST
  479: 	echo 'doc/lib' >> $(SOURCE)/MANIFEST
  480: 	echo 'doc/lib/perl' >> $(SOURCE)/MANIFEST
  481: 	echo 'doc/lib/perl/Apache' >> $(SOURCE)/MANIFEST
  482: 	echo 'doc/scripts' >> $(SOURCE)/MANIFEST
  483: 	# --------------------------------------------------- Clean up MANIFEST
  484: 	cd $(SOURCE); \
  485: 	sort MANIFEST | perl -nle 'print "$(DIRTARGET)/$$_"' | \
  486: 	perl -nle 's/\w+\/\.\.\///g;s/\w+\/\.\.\///g;print' | \
  487: 	perl -nle 's/\w+\/\.\.\///g;s/\w+\/\.\.\///g;print' | \
  488: 	perl -nle 's/\w+\/\.\.\///g;s/\w+\/\.\.\///g;print' | \
  489: 	perl -nle 's/\/\.\//\//g;print' | sort | uniq > \
  490: 	MANIFEST_loncapa
  491: 	cd $(SOURCE); mv -v MANIFEST_loncapa MANIFEST
  492: 
  493: # --------------- MANIFEST files with important CVS versioning/date information
  494: MANIFEST_cvs:
  495: 	# ------ CVS/Entries directories to retain 'time-checking' intelligence
  496: 	cd $(SOURCE); find . -type f -name 'Entries' | grep 'CVS/Entries' >> \
  497: 	MANIFEST
  498: 
  499: # ------------------- MANIFEST the building, testing and standard loncapa files
  500: MANIFEST_lpml:
  501: 	cat $(SOURCE)/doc/loncapafiles/buildfiles.lpml | \
  502: 	perl lpml_parse.pl MANIFEST development default \
  503: 	'$(SOURCE)' '$(TARGET)' | grep '[[:alnum:]]' >> $(SOURCE)/MANIFEST
  504: 	cat $(SOURCE)/doc/loncapafiles/testfiles.lpml | \
  505: 	perl lpml_parse.pl MANIFEST development default \
  506: 	'$(SOURCE)' '$(TARGET)' | grep '[[:alnum:]]' >> $(SOURCE)/MANIFEST
  507: 	cat $(SOURCE)/doc/loncapafiles/installfiles.lpml | \
  508: 	perl lpml_parse.pl MANIFEST development default \
  509: 	'$(SOURCE)' '$(TARGET)' | grep '[[:alnum:]]' >> $(SOURCE)/MANIFEST
  510: 	cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
  511: 	perl lpml_parse.pl MANIFEST development default \
  512: 	'$(SOURCE)' '$(TARGET)' | grep '[[:alnum:]]' >> $(SOURCE)/MANIFEST
  513: 
  514: # ------------ Files for top-level (the vanilla layer that the user first sees)
  515: MANIFEST_vanillatar:
  516: 	echo 'README' >> $(SOURCE)/MANIFEST
  517: 	echo 'UPDATE' >> $(SOURCE)/MANIFEST
  518: 	echo 'TEST' >> $(SOURCE)/MANIFEST
  519: 	echo 'CHECKRPMS' >> $(SOURCE)/MANIFEST
  520: 
  521: # =============================================== *** STATUS REPORT TARGETS ***
  522: 
  523: warningnote:
  524: 	@if (test -s WARNINGS); then \
  525: 		W=`grep -c '\*\*\*\* WARNING' WARNINGS`; \
  526: 		E=`grep -c '\*\*\*\* ERROR' WARNINGS`; \
  527: 		N=`grep -c '\*\*\*\* NOTE' WARNINGS`; \
  528: 		echo "--->  $$W WARNINGS ENCOUNTERED!       "; \
  529: 		echo "--->  $$E ERRORS ENCOUNTERED!         "; \
  530: 		echo "--->  $$N NOTES ENCOUNTERED!          "; \
  531: 		echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
  532: 		echo "!!!!  Please read the WARNINGS file !!!!"; \
  533: 		echo "!!!!   to make sure everything is   !!!!"; \
  534: 		echo "!!!!    correct and taken care of   !!!!"; \
  535: 		echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
  536: 	fi
  537: 
  538: HTML:
  539: 	install -d HTML
  540: 	cp $(SOURCE)/doc/loncapafiles/*.gif HTML
  541: 	cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
  542: 	perl lpml_parse.pl html development default "$(SOURCE)" '$(TARGET)' \
  543: 	> HTML/index.html
  544: 
  545: status:
  546: 	install -d HTML
  547: 	cp $(SOURCE)/doc/loncapafiles/*.gif HTML
  548: 	cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
  549: 	perl lpml_parse.pl html $(CATEGORY) $(DIST) "$(SOURCE)" "($TARGET)" | \
  550: 	perl lpml_html_posteval.pl > \
  551: 	HTML/filestatus.html
  552: 
  553: statuspost: status
  554: 	cp $(SOURCE)/doc/loncapafiles/*.gif \
  555: 	$(TARGET)/home/httpd/html/lon-status
  556: 	cp HTML/filestatus.html \
  557: 	$(TARGET)/home/httpd/html/lon-status/filestatus.html
  558: 
  559: rpmstatus:
  560: 	install -d RPMSTATUS
  561: 	rpm -qa --queryformat \
  562: 	'%{NAME}\t%{VERSION}\t%{RELEASE}\t%{BUILDTIME}\n' | sort > \
  563: 	RPMSTATUS/current.tmp
  564: 	cat $(SOURCE)/doc/otherfiles/cd_rpms.txt > RPMSTATUS/standard.tmp
  565: 	cat $(SOURCE)/doc/otherfiles/rpm_list.txt > RPMSTATUS/expected.tmp
  566: 	perl rpmparse.pl RPMSTATUS/standard.tmp RPMSTATUS/current.tmp \
  567: 	RPMSTATUS/expected.tmp > RPMSTATUS/rpmstatus.html
  568: 
  569: rpmstatuspost: rpmstatus
  570: 	cp RPMSTATUS/rpmstatus.html /home/httpd/html/lon-status/rpmstatus.html
  571: 
  572: # ======================================= *** ALTERNATIVE PACKAGING TARGETS ***
  573: 
  574: RPM: BinaryRoot base_rpm_file_list
  575: 	cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
  576: 	perl lpml_parse.pl make_rpm $(CATEGORY) $(DIST) $(SOURCE) $(TARGET) \
  577: 	> base_customizerpm.xml
  578: 	cat base_rpm_file_list.txt | perl make_rpm.pl base $(VERSION) \
  579: 	$(RELEASE) '' '' BinaryRoot base_customizerpm.xml
  580: 
  581: DPKG:
  582: 	make TARGET='lon-capa-$(VERSION)' NORESTORECONF='1' install
  583: 	@echo "You will next need to follow instructions at:"
  584: 	@echo "http://people.debian.org/~jaldhar/make_package1.html"
  585: 	@echo "A directory with a snapshot of the debian package files"
  586: 	@echo "is LON-CAPA-base."
  587: # What DPKG steps need to happen (for future implementation):
  588: # export EMAIL="" ... probably sharrison@mail.lon-capa.org
  589: # deb-make
  590: # edit debian/control
  591: # make debian/dirs file
  592: # make debian/copyright file
  593: # debian/README.debian... point them to LON-CAPA URLS
  594: # debian/changelog
  595: # debian/conffiles
  596: # debuild
  597: # and maybe do some GPG-related steps around here
  598: 
  599: base_rpm_file_list:
  600: 	cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
  601: 	perl lpml_parse.pl rpm_file_list $(CATEGORY) $(DIST) $(SOURCE) \
  602: 	'BinaryRoot' | sort > base_rpm_file_list.txt
  603: 
  604: BinaryRoot: base_rpm_file_list
  605: 	make TARGET='BinaryRoot' NORESTORECONF='1' install
  606: 
  607: # ======================================== *** MASTER DOCUMENTATION TARGETS ***
  608: 
  609: # Generates CVS:loncom/build/docs; root location of install.lon-capa.org
  610: doc:
  611: 	install -d docs
  612: 	@if (test -e installation_manual.pdf); then \
  613: 		cp -vf installation_manual.pdf docs/.; \
  614: 	else \
  615: 		touch docs/installation_manual.pdf; \
  616: 	fi
  617: 	install -m 0755 -d docs/icons
  618: 	install -m 0644 $(SOURCE)/doc/icons/[^C][^V]* docs/icons
  619: 	install -m 0755 -d docs/reconfig
  620: 	cd docs; ln -fs installation_manual.pdf index.pdf
  621: 	cd docs/reconfig; ln -fs ../installation_manual.pdf index.pdf
  622: 	perl doc_template.pl $(SOURCE)/doc/templates/template.html \
  623: 		$(SOURCE)/doc/build/reconfig.html > docs/reconfig/index.html
  624: 	install -m 0755 -d docs/reconfig/confexamples
  625: 	install -m 0644 $(SOURCE)/doc/build/confexamples/[^C][^V]* \
  626: 		docs/reconfig/confexamples
  627: 	perl doc_template.pl $(SOURCE)/doc/templates/template.html \
  628: 		$(SOURCE)/doc/build/installindex.html > docs/index.html
  629: 	install -m 0755 -d docs/license
  630: 	cd docs/license; ln -fs ../installation_manual.pdf index.pdf
  631: 	perl doc_template.pl $(SOURCE)/doc/templates/template.html \
  632: 		$(SOURCE)/doc/build/license.html > docs/license/index.html
  633: 	install -m 0755 -d docs/contact
  634: 	cd docs/contact; ln -fs ../installation_manual.pdf index.pdf
  635: 	perl doc_template.pl $(SOURCE)/doc/templates/template.html \
  636: 		$(SOURCE)/doc/build/contact.html > docs/contact/index.html
  637: 	install -m 0755 -d docs/faq
  638: 	cd docs/faq; ln -fs ../installation_manual.pdf index.pdf
  639: 	perl doc_template.pl $(SOURCE)/doc/templates/template.html \
  640: 		$(SOURCE)/doc/build/faq.html > docs/faq/index.html
  641: 	install -m 0755 -d docs/downloads
  642: 	cd docs/downloads; ln -fs ../installation_manual.pdf download.pdf
  643: 	perl doc_template.pl $(SOURCE)/doc/templates/template.html \
  644: 		$(SOURCE)/doc/build/download.html > docs/downloads/index.html
  645: 	install -m 0755 -d docs/install
  646: 	cd docs/install; ln -fs ../installation_manual.pdf install.pdf
  647: 	perl doc_template.pl $(SOURCE)/doc/templates/template.html \
  648: 		$(SOURCE)/doc/build/install.html > docs/install/index.html
  649: 	cp -v $(SOURCE)/doc/install/redhat7.3/new_install_rh73.html \
  650: 		docs/install/rh73.html
  651: 	cp -v $(SOURCE)/doc/install/redhat7.3/new_install_rh73.html \
  652: 		docs/downloads/rh73.html
  653: 	install -m 0755 -d docs/upgrade
  654: 	cd docs/upgrade; ln -fs ../installation_manual.pdf upgrade.pdf
  655: 	perl doc_template.pl $(SOURCE)/doc/templates/template.html \
  656: 		$(SOURCE)/doc/build/upgrade.html > docs/upgrade/index.html
  657: 	cd docs; tar czvpf ../docs.tar.gz .
  658: 
  659: pdfdoc: TEST_html2ps
  660: 	install -d pdfdoc
  661: 	/usr/local/html2ps/bin/html2ps -D \
  662: 	$(SOURCE)/doc/build/installindex_noform.html > pdfdoc/installindex.ps
  663: 	/usr/local/html2ps/bin/html2ps -D \
  664: 	$(SOURCE)/doc/build/reconfig.html | \
  665: 	perl -nle 's/\[EXAMPLE\]/\[EXAMPLE \(at end of document\)\]/g;print' \
  666: 	> pdfdoc/reconfig.ps
  667: 	/usr/local/html2ps/bin/html2ps -D \
  668: 	$(SOURCE)/doc/build/install.html > pdfdoc/install.ps
  669: 	/usr/local/html2ps/bin/html2ps -D \
  670: 	$(SOURCE)/doc/build/upgrade.html > pdfdoc/upgrade.ps
  671: 	/usr/local/html2ps/bin/html2ps -D \
  672: 	$(SOURCE)/doc/build/faq.html > pdfdoc/faq.ps
  673: 	/usr/local/html2ps/bin/html2ps -D \
  674: 	$(SOURCE)/doc/build/download.html > pdfdoc/download.ps
  675: 	/usr/local/html2ps/bin/html2ps -D \
  676: 	$(SOURCE)/doc/build/contact.html > pdfdoc/contact.ps
  677: 	/usr/local/html2ps/bin/html2ps -D \
  678: 	$(SOURCE)/doc/build/license.html > pdfdoc/license.ps
  679: #       This creates a bad confexamples.ps... so take the long way around
  680: #	cd $(SOURCE)/doc/build/confexamples; \
  681: #	mpage -P- -1 -H [^C]* > ../../../loncom/build/pdfdoc/confexamples.ps
  682: 	install -d pdfdoc/confexamples
  683: 	cd $(SOURCE)/doc/build/confexamples; \
  684: 	find . -type f | cut -b3- | grep -v '^C' | grep -v 'keyword' | \
  685: 	perl -nle \
  686: 	'`mpage -P- -1 -H $$_ > ../../../loncom/build/pdfdoc/confexamples/$$_.ps`;'
  687: 	echo '' > pdfdoc/contents.txt
  688: 	echo '' >> pdfdoc/contents.txt
  689: 	echo '          The Learning Online Network' >> pdfdoc/contents.txt
  690: 	echo '                    with the' >> pdfdoc/contents.txt
  691: 	echo '     Computer-Assisted Personalized Approach' >> \
  692: 	pdfdoc/contents.txt
  693: 	echo '' >> pdfdoc/contents.txt
  694: 	echo '' >> pdfdoc/contents.txt
  695: 	echo 'CONTENTS' >> pdfdoc/contents.txt
  696: 	echo '--------' >> pdfdoc/contents.txt
  697: 	echo 'Opening' >> pdfdoc/contents.txt
  698: 	echo 'Configuration' >> pdfdoc/contents.txt
  699: 	echo 'Installation' >> pdfdoc/contents.txt
  700: 	echo 'Upgrading a LON-CAPA Server' >> pdfdoc/contents.txt
  701: 	echo 'FAQ' >> pdfdoc/contents.txt
  702: 	echo 'Download' >> pdfdoc/contents.txt
  703: 	echo 'Contact Information' >> pdfdoc/contents.txt
  704: 	echo 'License Information' >> pdfdoc/contents.txt
  705: 	echo 'Configuration Examples' >> pdfdoc/contents.txt
  706: 	mpage -P- -1 \
  707: 	pdfdoc/contents.txt \
  708: 	pdfdoc/installindex.ps \
  709: 	pdfdoc/reconfig.ps \
  710: 	pdfdoc/install.ps \
  711: 	pdfdoc/upgrade.ps \
  712: 	pdfdoc/faq.ps \
  713: 	pdfdoc/download.ps \
  714: 	pdfdoc/contact.ps \
  715: 	pdfdoc/license.ps \
  716: 	pdfdoc/confexamples/*.ps \
  717: 	> pdfdoc/installation_manual.ps
  718: 	ps2pdf pdfdoc/installation_manual.ps pdfdoc/installation_manual.pdf
  719: 	mv -vf pdfdoc/installation_manual.pdf .
  720: 
  721: # ================================================ *** KEEPING THINGS CLEAN ***
  722: 
  723: clean:
  724: 	rm -f buildflag
  725: 	rm -Rf HTML
  726: 	rm -f installation_manual.pdf
  727: 	rm -f Makefile.build
  728: 	rm -f Makefile.install
  729: 	rm -f Makefile.configinstall
  730: 	rm -Rf BinaryRoot
  731: 	rm -Rf SetupBinaryRoot
  732: 	rm -Rf LON-CAPA-base
  733: 	rm -f base_rpm_file_list.txt
  734: 	rm -f base_customizerpm.xml
  735: 	rm -f setup_rpm_file_list.txt
  736: 	rm -f docs.tar.gz
  737: 	rm -Rf docs
  738: 	rm -Rf pdfdoc
  739: 	rm -f program.pl*
  740: 	rm -Rf lpmladm.*
  741: 	rm -f WARNINGS
  742: 	rm -f CPAN_STATUS_REPORT
  743: 	rm -f $(SOURCE)/loncom/build/hosts.tab
  744: 
  745: reallyclean:
  746: 	rm -f buildflag
  747: 	rm -f $(SOURCE)/README
  748: 	rm -f $(SOURCE)/UPDATE
  749: 	rm -f $(SOURCE)/TEST
  750: 	rm -f $(SOURCE)/MANIFEST
  751: 	rm -f $(SOURCE)/MANIFEST_loncapa
  752: 	rm -f $(SOURCE)/loncapa
  753: 	rm -f $(SOURCE)/loncom/build/hosts.tab
  754: 	rm -f $(SOURCE)/loncapa.tar.gz
  755: 	rm -Rf HTML
  756: 	rm -f installation_manual.pdf
  757: 	rm -f Makefile.build
  758: 	rm -f Makefile.install
  759: 	rm -f Makefile.configinstall
  760: 	rm -Rf BinaryRoot
  761: 	rm -Rf SetupBinaryRoot
  762: 	rm -Rf LON-CAPA-base
  763: 	rm -f base_rpm_file_list.txt
  764: 	rm -f base_customizerpm.xml
  765: 	rm -f setup_rpm_file_list.txt
  766: 	rm -f docs.tar.gz
  767: 	rm -Rf docs
  768: 	rm -Rf pdfdoc
  769: 	rm -f program.pl*
  770: 	rm -Rf lpmladm.*
  771: 	make -f Makefile.cvs clean
  772: 	rm -f WARNINGS
  773: 
  774: uninstall:
  775: 	rm -f UNINSTALL_SHELL_COMMANDS
  776: 	cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
  777: 	perl lpml_parse.pl uninstall_shell_commands $(CATEGORY) $(DIST) \
  778: 	"$(SOURCE)" "$(TARGET)" > UNINSTALL_SHELL_COMMANDS
  779: 	@echo -n "**** NOTE **** A file \"UNINSTALL_SHELL_COMMANDS\" has been "
  780: 	@echo "generated."
  781: 	@echo "First, you should view the contents of this file."
  782: 	@echo "If you are happy with the 'rm -Rf'! commands (or at least"
  783: 	@echo "have another job lined up in case of catastrophe), then you "
  784: 	@echo "can execute the following: sh ./UNINSTALL_SHELL_COMMANDS"
  785: 
  786: backup:
  787: 	@echo "Not yet implemented"
  788: 
  789: restore:
  790: 	@echo "Not yet implemented"
  791: 
  792: # ================================================ *** A HELPFUL DEPENDENCY ***
  793: alwaysrun:

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