Administrative Matters Submitting Assignments using Subversion Compiling and Makefiles Systems Programming Advanced Software Development 3420ICT / 7420ICT René Hexel School of Information and Communication Technology Griffith University Semester 1, 2012 René Hexel 3420ICT / 7420ICT
38
Embed
Systems Programming Advanced Software … Programming Advanced Software Development ... Update your local copy to the latest version svn update ... Systems Programming Advanced Software
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Systems ProgrammingAdvanced Software Development
3420ICT / 7420ICT
René Hexel
School of Information and Communication TechnologyGriffith University
Semester 1, 2012
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
2 Submitting Assignments using SubversionSubversion OverviewUsing Subversion over the InternetAdvanced Subversion Commands
3 Compiling and MakefilesCompiling C ProgramsUsing Makefiles
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Course OrganisationQuestions?
Teaching Team
LecturerRené Hexel ([email protected])Use 3420ICT / 7420ICT Subject for eMails!
TutorRené Hexel
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Course OrganisationQuestions?
Teaching
Lecture ( 3 hours)Tuesdays 8–11am, N06_0.14
Labs (2 hours)start in week 1!N44_1.17 at 11am on Tuesdaysdemo and recapassignment milestones and feedback
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Course OrganisationQuestions?
Labs
Tutor AssistanceAsk Questions!Programming Practice
Part of the AssignmentsNecessary skills to complete AssignmentsProgramming Environment (Compiler, Makefiles,Subversion, . . . )Milestones are due each week!Come prepared!
Outside official hoursCheck Lab closing times!Dwarf is accessible via VLink from home!Most people will need to spend appx. 20 hours / week onSP!
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Course OrganisationQuestions?
Assessment
2 non-trivial AssignmentsAssignment 1 (25 %), due weeks 1-6Assignment 2 (35 %), due weeks 7-11Milestones due every week from day one (must besubmitted by the end of your lab day)!
End of Semester ExamWorth 40 %Closed Book Exam
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Course OrganisationQuestions?
Course Resources
SP Nathan Web Sitevia Learning@Griffith andhttp://www.ict.griffith.edu.au/teaching/coursecodeCheck Notice Board regularly!Read the Policies Page
Help outside the LabUse Virgil Message ForumReceived your Password? – Check official Student EMail!
Web ResourcesLoads of Online Material via the SP Web Page!
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Course OrganisationQuestions?
Course Communication
Notice BoardImportant updates and changes
ForumFor Student/Tutor/Lecturer communicationHelp other students if you can
Good feedback for yourself to see how well you haveunderstood a topic!
Web MaterialLecture Notes, Articles, TutorialsCode Examples, Model SolutionsMade available progressively
Check Web Pages regularly
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Course OrganisationQuestions?
Health and Safety, Policy Guidelines
Health and SafetyOnline Induction must be completed before the first lab!Learning@Griffith -> Organisations -> Laboratory Induction
Student Policies Web Pagevia Portal
Problems, Consultation, and GrievancesUse the Forum about SP related problems (available anytime)!Talk to Lecturer at Lectures, Labs, and TutorialsOpen Door Policy
Drop by my office any time the door is open!EMail me for an appointment at a specified time!
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Course OrganisationQuestions?
Administrativa: That’s It!
Any Questions?
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Subversion OverviewUsing Subversion over the InternetAdvanced Topics
Using Subversion
Submitting Assignmentsusing Subversion
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Subversion OverviewUsing Subversion over the InternetAdvanced Topics
What is Subversion?
Version Control SystemAllows you manage the life cycle of a programKeep track of changes as you develop a programView and compare differences between versionsGo back to an earlier versionCreate Milestones
Snapshot of your program at a given point in timeWon’t change, even if your program keeps changes
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Subversion OverviewUsing Subversion over the InternetAdvanced Topics
How does Subversion work?
Central repository for all versions of all your filesLogbook of changes
Local working copyMake changes as you go without losing information aboutearlier versions
Track changes between versionsMake debugging easier“Where did this error sneak into my program?”
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Subversion OverviewUsing Subversion over the InternetAdvanced Topics
An Example
E.g. a source file hello.c
int main (void){
printf("Hello, world!\n");
return 0;}
Let’s put these changes back into the repository:svn commit hello.cThis is what we need to type on the command line
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Subversion OverviewUsing Subversion over the InternetAdvanced Topics
Preparation – required only once!
Set up a repository on dwarf.cit.griffith.edu.auLog into dwarf using ssh or putty
Create an (empty) assignment working copysvn checkoutfile://$HOME/.spsvn-2012/ass1/trunk a1cd a1
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Subversion OverviewUsing Subversion over the InternetAdvanced Topics
Adding Files – required for every new file
1 Go to your checked out working directorycd a1
2 Create a new file with your favourite editore.g. module1.c
3 Add the file to Subversionsvn add module1.c
4 Commit the file to the repositorysvn commit -m "Log Message" module1.c
5 Repeat the last step for any changes you make to any filessvn commit -m "Log Message"Without a file name, svn commit will commit all files thathave changed!
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Subversion OverviewUsing Subversion over the InternetAdvanced Topics
Committing Changes to Subversion
Whenever you make any changes, commit them!svn commit -m "Log Message"
Commit early, commit often!Allows you more fine grained control over your changesBackup copies of earlier versions
What happens if I forget the -m ?An editor (usually vi) will openIn vi you can use the i key to insert text: enter the logmessage, then press ESC followed by Shift-Z Shift-Zto save and commit.
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Subversion OverviewUsing Subversion over the InternetAdvanced Topics
Submitting Assignments: Symbolic Tags
The Problem:Version numbers (1, 2, 3, . . . ) are not very readable!Every commit gets its own version number
. . . even if it belongs to a different project!e.g. commits to Assignment 2 also changes Assignment 1
The answer: named versions = tagsFirst, make sure all files are committed using svn commitsvn copy -m "Log"file://$HOME/.spsvn-2012/ass1/trunkfile://$HOME/.spsvn-2012/ass1/tags/milestone1(all of the above needs to be on a single line!)Copies the current version to a symbolic tag
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Subversion OverviewUsing Subversion over the InternetAdvanced Topics
Other useful Subversion Commands
svn log [filename]See the history of changes you madeLists your log messages (make sure they are meaningful!)filename is optional!
svn diff -r 1:2 [filename]Show the actual changes between versions 1 and 2
svn diffShow all the changes since the last svn commit
svn status [filename]Check the current version of a file
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Subversion OverviewUsing Subversion over the InternetAdvanced Topics
Using Subversion over the Internet
So far: you need to log into dwarf first!Can be cumbersome from the labs or at home
Simply replace the local repository URI on dwarffile://$HOME/.spsvn-2012
with the remote URIsvn+ssh://[email protected]/export/student/sid/.spsvn-2012
Prefer a Graphical User Interface (GUI)?GUI clients available for most Operating systems
TortoiseSVN for WindowsKSVN for LinuxMacSVN for Mac OS X
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Compiling C ProgramsUsing Makefiles
Compiling C Programs
Integrated Development Environment (IDE)Eclipse, XCode, Visual C++, Project Center, . . .Compiles programs at the press of a button (like BlueJ)Often difficult to customiseVery rarely support multiple platforms and languages
Command LineRequires manual invocationRequires knowledge of command line parametersCan be tedious for large projectsCross-platform and -language compilers (e.g. clang)
MakefilesCombine the best of both worldsRecompile a complex project with a simple make command
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Compiling C ProgramsUsing Makefiles
Getting a Command Line Interface
Via Dwarfusing putty (Windows)ssh dwarf.cit.griffith.edu.au
Via a local TerminalLinux: e.g. through the Gnome program menuMac OS X: e.g. Applications / Utilities / Terminal.appWindows: e.g. Start / Programs / Programming Tools /GNUstep / MSys
⇒ Enter commands to compile your programHit Return (or Enter) after every command!
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Compiling C ProgramsUsing Makefiles
Compiling a C program using clang
Once on the command line change to the directory (folder)your program is in
cd /my/example/directoryCompile the source code (e.g. Hello.c)
clang Hello.cCompiles Hello.c into an executable called a.out (ora.exe on Windows)
clang -o Hello Hello.cCompiles Hello.c into an executable called HelloOn Windows always use Hello.exe instead of just Hello
clang -Wall -std=c99 -o Hello Hello.cPrints all warnings about possible problemsAlways use -Wall -std=c99 when compiling yourprograms!
./HelloRun the Hello command from the current directory
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion
Compiling and Makefiles
Compiling C ProgramsUsing Makefiles
Makefiles
Save compile timeonly recompile what is necessary
Help avoiding mistakesprevent outdated modules from being linked together
Language independentwork with any programming language
C, C++, Objective-C, Java, . . .
René Hexel 3420ICT / 7420ICT
Administrative MattersSubmitting Assignments using Subversion