1 / 23

CMSC 202

CMSC 202. Computer Science II for Majors. Topics. Using submit make unleashed Project 1 questions. Submitting Projects. submit is used for easy submission of projects It is a perl script and provides ACL on AFS Commands which are part of this system submit submitls submitproj

english
Télécharger la présentation

CMSC 202

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CMSC 202 Computer Science II for Majors

  2. Topics • Using submit • make unleashed • Project 1 questions

  3. Submitting Projects • submit is used for easy submission of projects • It is a perl script and provides ACL on AFS • Commands which are part of this system • submit • submitls • submitproj • submitrm • Programs provided by Mr. Frey • submitmake • submitrun

  4. Submit … cont • A class name is assigned to each class • CMSC 202 is assigned as cs202 • Names are assigned for projects • Proj0, Proj1, ….. Proj5 for CMSC 202 • All commands of submit system accept command line arguments

  5. Submit … cont • submitproj <class name> • Displays information for a given class • One argument – class name linux1[4]% submitproj cs202 The following projects are defined for dennis's cs202 class: Proj0 testing submit Proj1 (no description available) Proj2 (no description available) Proj3 (no description available) Proj4 (no description available) Proj5 (no description available)

  6. Submit … cont • submit <class name> <project name> <file1> <file2> … • Actually submits your files under the given project name • Re-submitted files will be overwritten • Gives a confirmation of submission

  7. Submit … cont • Example linux1[6]% submit cs202 Proj2 Proj2.C Game.C Game.H Submitting Proj2.C...OK Submitting Game.C...OK Submitting Game.H...OK linux1[7]% submit cs202 Proj2 Game.C It seems you have already submitted a file named Game.C. Do you wish to overwrite? (y/n): y Submitting Game.C...OK OR Do you wish to overwrite? (y/n): n Not Submitting Game.C.

  8. Submit … cont • submitls <class name> <project name> • Lists the files submitted for given project • Lets you check file submission • linux1[16]% submitls cs202 Proj0 • total 14 • drwx------ 2 dennis research 2048 Jan 26 14:45 . • drwx------ 338 dennis research 12288 Feb 6 14:34 .. • -rw------- 1 prasade1 general 0 Jan 26 14:45 proj0.C

  9. Submit … cont • submitrm <class name> <project name> <file1> <file2> … • Used to delete files • Deletes directly without prompting linux1[58]% submitrm cs202 Proj0 proj0.C Deleting proj0.C linux1[16]% submitls cs202 Proj0 total 14 drwx------ 2 dennis research 2048 Jan 26 14:45 . drwx------ 338 dennis research 12288 Feb 6 14:34 ..

  10. Submit … cont • submitmake <class name><project name> • Present in Mr. Frey’s ‘pub’ directory • It compiles and links programs in submittal directory • Run submitmake file in Mr. Frey’s pub directory • 1. Make an alias in .cshrc file • 2. Use an environment variable • % set PATH_202 = /afs/umbc.edu/users/d/e/dennis/pub/CMSC202/ • 3. Go to the pub directory • This will run ‘make Proj1’, create executable Proj1 and remove all object files

  11. Submit … cont • submitrun <class name> <project name> <command-line arguments> • Present in Mr. Frey’s ‘pub’ directory • Runs the project executable • If command line argument is a file, it should be present in local directory • Set path as explained

  12. make • make is a utility program • Helps to keep track of file dependencies • Provides easy maintenance of different files in a project • Looks for a file named – makefile or Makefile • Uses makefile database and last-modified time to update files

  13. make … cont • Makefile describes relationships among files • Makefile provides commands for updating each file • Makefile tells ‘make’ how to compile and link a program Compile g++ Link obj files Execute

  14. make … cont • Makefile consists of Rules of form: Target : Dependencies <TAB>Command • Target is name of file generated by program, e.g. Proj1 • Dependencies are files used as input to create target e.g. proj1.o, WordCount.o

  15. make … cont • Command is action carried out by ‘make’ e.g. Compile using g++ • Note: There is a <TAB> before command • One command per line • A target is considered out-of-date if its modification time is less than any of its dependencies

  16. make … cont • Variables • They allow a text string to be defined once and used multiple times • e.g. OBJ = proj1.o WordCount.o • Variable’s value is obtained as $(OBJ) • Variable names are traditionally uppercase

  17. make … cont • Makefile can contain several Rules • The first rule is considered to be default target and processed • If any dependency is target of another rule, it is processed too.

  18. # CMSC 202 Spring 2003 Project 1 Makefile # Note that lines which begin with # are comments # This "makefile" is read and interpreted by the unix "make" utility to # automate compiling and linking files in large projects. # This file must be named "makefile" or "Makefile" # # The two simplest ways to use the "make" utility are # 1. type make <target> # This causes the make utility to find your makefile and do whatever # is necessary to create the target you specified. # 2. type make # This causes the make utility to find your makefile # and build the first target found in the makefile # When the appropriate target is located, make will # build any of the targets dependencies if needed. # make will continue in this recursive manner until # all necessary targets are up-to-date # D. L. Frey # define an internal symbol for the correct compiler compiler = /usr/local/bin/g++ # define a symbol for the path to Mr. Frey's public directory MrFreysDirectory = /afs/umbc.edu/users/d/e/dennis/pub/CMSC202/p1

  19. # define an internal symbol for compiler switches to be used # the -I switches tells the compiler where to look for .H files # This is needed for project 1 so the compiler can find WordCount.H compilerflags = -ansi -Wall -I . -I $(MrFreysDirectory) # define an internal symbol for the name of the executable for the project PROJECT=Proj1 # define an internal symbol for the list of .o files OBJECTS= proj1.o WordCount.o $(PROJECT): $(OBJECTS) $(compiler) $(compilerflags) -o $(PROJECT) $(OBJECTS) # define proj1.o as a target that is dependent on proj1.C and WordCount.H proj1.o: proj1.C $(MrFreysDirectory)/WordCount.H ${compiler} ${compilerflags} -c proj1.C #define WordCount.o as a target WordCount.o : $(MrFreysDirectory)/WordCount.C $(MrFreysDirectory)/WordCount.H $(compiler) $(compilerflags) -c $(MrFreysDirectory)/WordCount.C

  20. # define some targets which help with directory maintenance # 'make clean' removes all .o files, the project executable and core # dump file clean: touch foo.o rm -rf foo.o $(OBJECTS) $(PROJECT) core # 'make cleanest' removes everything that 'make clean' removes # plus backup files created by the editors cleanest: clean rm -rf *~ *#

  21. make … cont • Adding dependencies to makefile • Suppose you have more files in Project1 • E.g. Proj1 depends on proj1Aux.o OBJECTS= proj1.o WordCount.o proj1Aux.o # define proj1Aux.o as a target that is dependent on proj1Aux.H proj1Aux.o: proj1Aux.C proj1Aux.H $(compiler) $(compilerflags) -c proj1Aux.C

  22. make … cont • Adding target to makefile submit: submit cs202 Proj1 proj1.C OR If you have several files in your project then: submit: submit cs202 Proj1 proj1.C proj1Aux.C proj1Aux.H Please remember the TAB before command

  23. Project 1 Questions

More Related