lecture20 - Tools Makefiles Sourcecodecontrol CodeAnalysis 1

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 335 Dr. Charles B. Owen Object-Oriented Programming 1 Tools Makefiles Source code control Code Analysis
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 335 Dr. Charles B. Owen Object-Oriented Programming 2 Makefiles What are they? How do they work? Why do we care? http://oreilly.com/catalog/make3/book/index.csp Book is online for free…
Background image of page 2
CSE 335 Dr. Charles B. Owen Object-Oriented Programming 3 Makefiles Eclipse creates a makefile that it uses to compile  your program It’s in the Debug directory But… You may need to distribute code Some IDEs  require you to create a makefile I created a makefile for the precompiled headers A makefile, in conjuction with the make utility, tells the system  how to build your program (compile, link, post-build steps, etc.) You need to know how a  makefile works and how to write  basic versions.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 335 Dr. Charles B. Owen Object-Oriented Programming 4 A Simple Makefile hello: hello.c gcc hello.c -o hello target: prereq1 prereq2 commands Tab 1. To build a target, it first builds any  prerequisites that a target depends on. 2. Next, it builds the target if the target  does not exist or the times of the  prerequisites are later than the time of  the target. Rule By default, make builds the first rule in the  file. make rule  will make a different rule.
Background image of page 4
CSE 335 Dr. Charles B. Owen Object-Oriented Programming 5 More prerequisites hello: hello.c hello.h gcc hello.c -o hello If you include the .h file, changing  either will cause make to rebuild.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 335 Dr. Charles B. Owen Object-Oriented Programming 6 Example Hello: Hello.cpp Hello.h g++ Hello.cpp -oHello -rwxr-xr-x 1 cbowen cbowen 8942 2010-04-06 10:46:22.050817144 -0400 Hello -rw-r--r-- 1 cbowen cbowen 104 2010-04-06 10:46:10.163802117 -0400 Hello.cpp -rw-r--r-- 1 cbowen cbowen 0 2010-04-06 10:48:49.568007129 -0400 Hello.h -rw-r--r-- 1 cbowen cbowen 41 2010-04-06 10:45:52.647373483 -0400 makefile
Background image of page 6
CSE 335 Dr. Charles B. Owen Object-Oriented Programming 7 More complex makefile count_words: count_words.o lexer.o gcc count_words.o lexer.o -lfl  -ocount_words count_words.o: count_words.c gcc -c count_words.c lexer.o: lexer.c gcc -c lexer.c lexer.c: lexer.l flex -t lexer.l > lexer.c make gcc -c count_words.c flex -t lexer.l > lexer.c gcc -c lexer.c gcc count_words.o lexer.o -lfl  -ocount_words
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 335 Dr. Charles B. Owen Object-Oriented Programming 8 Minimizing rebuilds count_words: count_words.o lexer.o gcc count_words.o lexer.o -lfl  -ocount_words count_words.o: count_words.c gcc -c count_words.c lexer.o: lexer.c gcc -c lexer.c lexer.c: lexer.l flex -t lexer.l > lexer.c count_words: count_words.c lexer.c gcc count_words.c lexer.c -lfl  -ocount_words lexer.c: lexer.l flex -t lexer.l > lexer.c Both will work,  why will the  longer one be  better?
Background image of page 8
CSE 335 Dr. Charles B. Owen
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 46

lecture20 - Tools Makefiles Sourcecodecontrol CodeAnalysis 1

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online