Annotation of nsdl/build/Makefile, revision 1.7

1.1       harris41    1: # The NSDL to LON-CAPA Gateway Server
                      2: 
                      3: # Scott Harrison
1.7     ! harris41    4: # $Id: Makefile,v 1.6 2002/07/14 06:39:06 harris41 Exp $
        !             5: 
        !             6: # Quick usage:
        !             7: # Either type "make all" (compiles and installs code onto your system), or
        !             8: # type "make tardist" and use the distributable tarball.
1.1       harris41    9: 
                     10: DISTPROBE=`perl ./distprobe`
                     11: DIST=$(DISTPROBE)
                     12: CATEGORY="development"
1.3       harris41   13: SOURCE=..
1.1       harris41   14: TARGET=""
                     15: NORESTORECONF="0"
                     16: HOSTNAME=""
                     17: LAUNCH=| perl
                     18: OUTSTREAM=>
                     19: SAVE=program.pl.$(TIMESTAMP)
                     20: LAUNCHSAVE=$(OUTSTREAM) $(SAVE)
                     21: METAMTARGET=""
                     22: MTARGET=""
                     23: VERSION=0.1
                     24: 
                     25: help:
                     26: 	@echo "*** You need to specify a valid target ***"
1.7     ! harris41   27: 	@echo "To get a list of valid targets: \"make help_TARGETS\""
        !            28: 	@echo "To get a list of valid options: \"make help_OPTIONS\""
        !            29: 	@echo " "
        !            30: 	@echo "Typically invoked targets are:"
        !            31: 	@echo "    make build"
        !            32: 	@echo "    make install"
        !            33: 	@echo "    make all"
        !            34: 	@echo "    make tardist"
        !            35: 	@echo "    make clean"
        !            36: 
        !            37: help_OPTIONS:
        !            38: 	@echo "You can specify options to your Makefile target."
1.1       harris41   39: 	@echo "(option) DIST can be redhat6, redhat7, debian2.2, or default"
                     40: 	@echo "(option) CATEGORY can be runtime or development"
                     41: 	@echo "(option) SOURCE is an absolute or relative directory path"
                     42: 	@echo "(option) TARGET is an absolute or relative directory path"
1.7     ! harris41   43: 
        !            44: help_TARGETS:
        !            45: 	@echo "Valid targets"	
1.1       harris41   46: 	@echo "build: compile the CVS source tree"
                     47: 	@echo "install: install from a compiled CVS source tree to a "
                     48: 	@echo "         specified TARGET destination on the filesystem"
                     49: 	@echo "test: test different parts of the LON-CAPA system (TEST_*)"
1.6       harris41   50: 	@echo "TEST_lpml: make sure that the system can process "
1.1       harris41   51: 	@echo "                   the Linux Packaging Markup Language"
                     52: 	@echo "TEST_system_dependencies: make sure that all needed system "
                     53: 	@echo "                          components are active and present "
                     54: 	@echo "                          on the server such as perl modules"
                     55: 	@echo "                          and the MySQL database"
1.6       harris41   56: 	@echo "TEST_weblayer: mimic various web-based interactions with "
1.1       harris41   57: 	@echo "                respect to the login and various system "
                     58: 	@echo "                actions on the Gateway server"
                     59: 	@echo "HTML: generate an HTML-formatted description of the "
                     60: 	@echo "      NSDL to LON-CAPA Gateway Server CVS source files"
                     61: 	@echo "doc: compiles documentation for the system administration of"
                     62: 	@echo "     the gateway server"
                     63: 	@echo "status: compare the TARGET filesystem with a compiled CVS "
                     64: 	@echo "        source directory"
                     65: 	@echo "statuspost: post the results of "make status" to "
                     66: 	@echo "            TARGET/home/httpd/html/lon-status/filestatus.html"
                     67: 	@echo "rpmstatus: compare the rpms on a system to defined lists "
                     68: 	@echo "           CVS:doc/otherfiles/cd_rpms and "
                     69: 	@echo "           CVS:doc/otherfiles/rpm_list.txt"
                     70: 	@echo "rpmstatuspost: post the results of "make rpmstatus" to "
                     71: 	@echo "            TARGET/home/httpd/html/lon-status/rpmstatus.html"
                     72: 	@echo "tardist: build a tarball that will upgrade the software on a "
                     73: 	@echo "         system"
                     74: 
1.5       harris41   75: build: Makefile.build
                     76: 	echo -n "" > WARNINGS
                     77: 	make -f Makefile.build all
                     78: 	make warningnote
                     79: 
                     80: Makefile.build: Makefile alwaysrun
                     81: 	cat gatewayfiles.lpml | \
                     82: 	perl lpml_parse.pl build $(CATEGORY) $(DIST) "$(SOURCE)" \
                     83: 	"$(TARGET)" > Makefile.build
1.1       harris41   84: 
1.4       harris41   85: NET_install:
                     86: 	make TIMESTAMP=`date +"%s"` METAMTARGET="TRANSPORT" \
                     87: 	MTARGET="install" HOSTNAME="$(HOSTNAME)" lpmladm
                     88: 	make warningnote
                     89: 
1.3       harris41   90: install: Makefile.install
                     91: 	@echo -n "" > WARNINGS
                     92: 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
                     93: 	directories
                     94: 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" files
                     95: 	make warningnote
                     96: 
                     97: Makefile.install: Makefile alwaysrun
                     98: 	cat gatewayfiles.lpml | \
                     99: 	perl lpml_parse.pl install $(CATEGORY) $(DIST) "$(SOURCE)" \
                    100: 	"$(TARGET)" > Makefile.install
                    101: 
                    102: alwaysrun:
1.1       harris41  103: 
1.6       harris41  104: test: TEST_lpml TEST_system_dependencies TEST_weblayer
                    105: 	@echo "ALL TESTS SUCCESSFUL"
1.1       harris41  106: 
1.6       harris41  107: TEST_lpml:
                    108: 	@echo "TESTING LPML INSTALLATION MECHANISM"
                    109: 	cd lpml_test; perl filecomparetest.pl
1.1       harris41  110: 
                    111: TEST_system_dependencies:
1.6       harris41  112: 	@echo "TESTING WEB LAYER"
1.1       harris41  113: 
1.6       harris41  114: TEST_weblayer:
                    115: 	@echo "TESTING SYSTEM DEPENDENCIES"
1.1       harris41  116: 
                    117: HTML:
1.6       harris41  118: 	install -d HTML
                    119: 	cp $(SOURCE)/doc/gatewayfiles/*.gif HTML
                    120: 	cat gatewayfiles.lpml | \
                    121: 	perl lpml_parse.pl html development default "$(SOURCE)" '$(TARGET)' \
                    122: 	> HTML/index.html
1.1       harris41  123: 
                    124: doc:
                    125: 	@echo "Not yet implemented"
                    126: 
                    127: status:
                    128: 	@echo "Not yet implemented"
                    129: 
                    130: statuspost:
                    131: 	@echo "Not yet implemented"
                    132: 
                    133: tardist:
1.7     ! harris41  134: 	@echo "Not yet fully implemented"
        !           135: 	make MANIFEST_all
        !           136: 
        !           137: MANIFEST_all:
        !           138: 	rm -f $(SOURCE)/MANIFEST
        !           139: 	make MANIFEST_lpml
        !           140: 
        !           141: MANIFEST_lpml:
        !           142: #	cat $(SOURCE)/buildfiles.lpml | \
        !           143: #	perl lpml_parse.pl MANIFEST development default \
        !           144: #	'$(SOURCE)' '$(TARGET)' | grep '[[:alnum:]]' >> $(SOURCE)/MANIFEST
        !           145: #	cat $(SOURCE)/testfiles.lpml | \
        !           146: #	perl lpml_parse.pl MANIFEST development default \
        !           147: #	'$(SOURCE)' '$(TARGET)' | grep '[[:alnum:]]' >> $(SOURCE)/MANIFEST
        !           148: 	cat $(SOURCE)/build/gatewayfiles.lpml | \
        !           149: 	perl lpml_parse.pl MANIFEST development default \
        !           150: 	'$(SOURCE)' '$(TARGET)' | grep '[[:alnum:]]' >> $(SOURCE)/MANIFEST
1.3       harris41  151: 
                    152: warningnote:
                    153: 	@if (test -s WARNINGS); then \
                    154: 		W=`grep -c '\*\*\*\* WARNING' WARNINGS`; \
                    155: 		E=`grep -c '\*\*\*\* ERROR' WARNINGS`; \
                    156: 		N=`grep -c '\*\*\*\* NOTE' WARNINGS`; \
                    157: 		echo "--->  $$W WARNINGS ENCOUNTERED!       "; \
                    158: 		echo "--->  $$E ERRORS ENCOUNTERED!         "; \
                    159: 		echo "--->  $$N NOTES ENCOUNTERED!          "; \
                    160: 		echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
                    161: 		echo "!!!!  Please read the WARNINGS file !!!!"; \
                    162: 		echo "!!!!   to make sure everything is   !!!!"; \
                    163: 		echo "!!!!    correct and taken care of   !!!!"; \
                    164: 		echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
                    165: 	fi
1.4       harris41  166: 
                    167: lpmladm:
                    168: 	@if (test $(METAMTARGET) = "TRANSPORT"); then \
                    169: 		echo "Transporting to $(HOSTNAME)"; \
                    170: 		sudo mkdir lpmladm.$(TIMESTAMP); \
                    171: 		sudo make DIST=$(DIST) CATEGORY=$(CATEGORY) \
                    172: 		SOURCE="$(SOURCE)" \
                    173: 		TARGET="lpmladm.$(TIMESTAMP)" \
                    174: 		NORESTORECONF="$(NORESTORECONF)" "$(MTARGET)"; \
                    175: 		cd lpmladm.$(TIMESTAMP); \
                    176: 		sudo tar czf ../tarball$(TIMESTAMP).tar.gz .; \
                    177: 		cd ..; scp tarball$(TIMESTAMP).tar.gz \
                    178: 		lpmladm@$(HOSTNAME):~/tarball$(TIMESTAMP).tar.gz; \
                    179: 		sudo rm -Rf lpmladm.$(TIMESTAMP); \
                    180: 		sudo rm -f tarball$(TIMESTAMP).tar.gz; \
                    181: 		ssh lpmladm@$(HOSTNAME) sudo mv tarball$(TIMESTAMP).tar.gz /; \
                    182: 		ssh lpmladm@$(HOSTNAME) sudo tar -x -z -C / \
                    183: 		-p --same-owner -f \
                    184: 		/tarball$(TIMESTAMP).tar.gz; \
                    185: 		ssh lpmladm@$(HOSTNAME) sudo rm -f \
                    186: 		/tarball$(TIMESTAMP).tar.gz; \
                    187: 	elif (test $(METAMTARGET) = "LAUNCH"); then \
                    188: 		echo "Launching process on $(HOSTNAME)"; \
                    189: 		LAUNCHSAVE=$(OUTSTREAM) $(SAVE); \
                    190: 		make DIST=$(DIST) CATEGORY=$(CATEGORY) SOURCE="$(SOURCE)" \
                    191: 		TARGET="$(TARGET)" NORESTORECONF="$(NORESTORECONF)" \
                    192: 		LAUNCH="$(LAUNCHSAVE)" "$(MTARGET)"; \
                    193: 		scp $(SAVE) lpmladm@$(HOSTNAME):$(SAVE); \
                    194: 		ssh lpmladm@$(HOSTNAME) sudo -u $(LAUNCHUSER) perl $(SAVE); \
                    195: 	else \
                    196: 		echo "**** ERROR **** Incorrect METAMTARGET"; \
                    197: 	fi
                    198: #		ssh lpmladm@$(HOSTNAME) sudo rm -f $(SAVE); \
1.1       harris41  199: 
1.2       harris41  200: clean:
                    201: 	@echo "Not yet implemented"
1.1       harris41  202: 

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