![Page 1: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/1.jpg)
Pacific University
Eclipse, SVN, Makefile examples
January 20, 2010Eclipse version 3.5.1
![Page 2: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/2.jpg)
Pacific University
New Project• New | C Project • Makefile Project | Empty Project | Linux
GCC | Next • Advanced Settings | C/C++ Build • Configuration: [All Configurations]• UNCHECK “Generate Makefiles
Automatically” | OK • Finish
![Page 3: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/3.jpg)
Pacific University
Add Directory• File | New | Folder
![Page 4: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/4.jpg)
Pacific University
Add Source File• New | {Source File, Header File}
![Page 5: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/5.jpg)
Pacific University
Add Makefile• File | New | File
![Page 6: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/6.jpg)
Pacific University
Add Make Targets• Open Makefile, write all:, CS480_0:, clean:• Open Outline on right side• Right click on name• “Add make target”• Click green dot to
invoke make
![Page 7: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/7.jpg)
Pacific University
Run Binary
![Page 8: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/8.jpg)
Pacific University
Set command line arguments
![Page 9: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/9.jpg)
Pacific University
Set up debugger
![Page 10: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/10.jpg)
Pacific University
Run Binary (take two)
Debug Run
![Page 11: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/11.jpg)
Pacific University
Printing• Windows | Preferences • General | Appearance | Colors and Fonts• C/C++ | Editor | C/C++ Editor Text Font
– Use Courier 10 Pitch, Size 8
• This changes the font on the screen! – You may want to change back after printing
• Print doubled sided!
![Page 12: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/12.jpg)
Pacific University
Create SVN Repository
zeus$ svnadmin create /home/login/SVNREPOS/
Run once on Zeus.
If you have an different repository name (SVNREPOS), email it to me!
Never touch SVNREPOS again.
![Page 13: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/13.jpg)
Pacific University
Subversion: add to repository• SVN• Create New OR• Use Existing• Use Project name as
folder name
![Page 14: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/14.jpg)
Pacific University
Subversion: Commit Files• Team | Commit• What do I commit?
– Source files– Makefiles– .cproject / .project– Test files
• What do I not commit?– *.o– Binaries– Temporary files
![Page 15: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/15.jpg)
Pacific University
Subversion: Update from Repos• Team | Update
• Team | Synchronize with Repository– Shows how files differ from repos
• Revert from bad code– Team | Show History– “Revert changes from revision ###”
• Team | Compare With• Team | Replace With
![Page 16: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/16.jpg)
Pacific University
Revert One File
• Team | Replace With | Revision• Copy All Non-Conflicting Changes from
Right to Left• Right click on Workspace File Pane | Save
• Next commit will save the changes to a new revision in the repository
![Page 17: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/17.jpg)
Pacific University
![Page 18: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/18.jpg)
Pacific University
Revert the Entire Project• Rename existing Project• Right click Project Name | Rename
• Don't worry, from Eclipse, you cannot destroy your SVN Repository– Unless you really, really try
![Page 19: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/19.jpg)
Pacific University
Revert the Entire Project• Check out New
Project from SVN
• Don't check out the HEAD
• Select Revision
![Page 20: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/20.jpg)
Pacific University
![Page 21: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/21.jpg)
Pacific University
Both Projects
• Project checked out twice• Different revisions in
each project
![Page 22: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/22.jpg)
Pacific University
Delete Old Project• Not strictly necessary• Right click on (Old) Project Name | Delete
• Make sure you delete Project from disk– Does not affect Subversion repository
• Close Eclipse and restart– To clean up the workspace
![Page 23: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/23.jpg)
Pacific University
Reverted Project: Commit new Changes
• Update code in project• Right click Project Name | Team |
Synchronize with Repository• Right click Project Name | Mark as merged• Go back to C/C++ Perspective• Right click {File,Project} | Team | Commit
![Page 24: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/24.jpg)
Pacific University
Merge Conflict!• Changes in the Repository conflict with
changes in your local directory
![Page 25: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/25.jpg)
Pacific University
Update!• Right click file | Team |
Update
![Page 26: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/26.jpg)
Pacific University
Resolve!• Edit the source file
main.c– Remove <<<< >>>>
• Right Click File | Team | Mark Resolved
• Commit
![Page 27: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/27.jpg)
Pacific University
Subversion: Check out• File | New | Project | SVN | Checkout
projects from SVN
• Create new: svn+ssh://zeus/home/login/SVNROOT/CS480_0
• login: your zeus login• CS480_0: project in repository
![Page 28: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/28.jpg)
Pacific University
Subversion: Check out by handzeus$ svn co svn+ssh://zeus/home/login/SVNROOT/CS480_0 CS480_0
• login: your zeus login
• CS480_0: project in repository
• CS480_0: local directory to create
zeus$ cd CS480_0
zeus$ make
zeus$ ./CS480_0 10or
zeus$ bin/CS480_0 10
![Page 29: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/29.jpg)
Pacific University
GCC (compiler)• gcc -o example.o -c example.c
– -o output file– -c compile only (produce .o file)
• gcc -o example example.o– Use example.o to build executable file example– Run example:– zeus$ ./example
• -g : add debug symbols• -Wall : show all warnings
![Page 30: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/30.jpg)
Pacific University
GCC (extras)• gcc --help
• gcc -S -o file.asm file.c– dump assembly instructions to file.asm
• gcc -lm file.c -o file– Link against math library (libm.so)– Link against library libabc.so: -labc– Produce executable file
![Page 31: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/31.jpg)
Pacific University
Makefile# Sample makefile # comment
CC=gcc # variableCFLAGS=g Wall
all: driver # default target
driver: driver.o ${CC} ${CFLAGS} o driver driver.o
driver.o: constants.h driver.c${CC} ${CFLAGS} o driver.o c driver.c
clean:rm f core *.o *~
![Page 32: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/32.jpg)
Pacific University
Makefileshttp://zeus.cs.pacificu.edu/chadd/cs480s09/schedule.html
• See makeex1.tar.gz and makeex2.tar.gz• Example 2 shows directories being used
![Page 33: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/33.jpg)
Pacific University
Valgrind.org• http://valgrind.org/docs/manual/QuickStart.html
• Memcheck– Memory checker
• To run:zeus$ valgrind --leak-check=yes ./CS480_0 10
• Look for– invalid read/writes– uninitialized values– illegal frees– and more....
![Page 34: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/34.jpg)
Pacific University
Linux Command Line
ssh – connect to a remote machinescp – copy file to/from remote machinecd – change directoryls – list filesman – manual pagesmkdir – make a directorycp – copy a filetar zxf filename.tar.gz – explode files
![Page 35: Eclipse, SVN, Makefile examples - Pacific Uzeus.cs.pacificu.edu/chadd/cs460s10/Lectures/EclipseEtc.pdfPacific University Eclipse, SVN, Makefile examples January 20, 2010 Eclipse version](https://reader031.vdocument.in/reader031/viewer/2022022510/5ada98fa7f8b9a53618cd179/html5/thumbnails/35.jpg)
Pacific University
Linux Command Line
rm – remove a filemv – move (rename) a filemore – display a fileps – list processesgrep – search for text in a filediff – compare two filekill – kill a processpasswd – change password (on ada)