170 likes | 299 Views
March 14, 2005 Lecture 9. CS498ps. Taming larger projects. File and resource organization Version control “make”. File and Resource Organization. Source files and headers Object files (.obj) Executables Test environment Deployment environment. Project Directory Structure.
E N D
March 14, 2005 Lecture 9 CS498ps
Taming larger projects • File and resource organization • Version control • “make”
File and Resource Organization • Source files and headers • Object files (.obj) • Executables • Test environment • Deployment environment
Project Directory Structure • Project Development • Source files • Headers • .obj • Scripts and makefiles • Deployment • Contains only that which end user would have present • Testing • Data
Version Control • Fixed deficiencies • New features • Changes in implementation
Version Control • CVS • Subversion • Poor man's version control
Poor Man's Version Control • Create subdirectories (folders) within project folder • Copy all pertinent content into directory • Use meaningful name for subdirectory • Write script to allow automatic version • “mversion march14verA”
Makefiles • Reduce unnecessary steps in build • Insure all necessary components are up-to-date • Reduces human error
The “make” utility... • Reads a text file and executes indicated steps. • Allows dependencies so that changes can cascade throughout project. • Reduces unnecessary rebuilds while maintaining integrity of the build. • Is recursive.
Contents of a makefile • Comments • Macros • Dependencies • Shell lines • Directives
Comments • '#' starts a comment line • Everything after the '#' to the end of the line is a comment • # this is an example comment for a makefile
Macros • String replacement in your makefile • COMPILE = cl.exe /nologo /Gs /G5 /Z7 /c /W3 /MLd /D "WIN32" /D "_DEBUG" /D "__MSC__" • LIBRARY = lib
Dependencies • Dependencies allow for conditional building based on a dependence relationship • The correct build of an executable depends on all the components being up-to-date. • You can also rebuild .obj files when headers change. • Warning: you may end up unnecessarily rebuilding which defeats part of the purpose. • hud.obj: hud.c
Shell Lines • Shell lines are the command lines that execute when a dependency is met. • $(COMPILE) hud.c • NOT limited to compile, link, etc.
Directives • Conditionals and flow control • $if, $else, $elif, $endif
Directives and Command Line Macros • Can use command line macro definitions for control • Make “COMPILER=borland” • $if $(COMILER) == borland
A makefile example • ldtt.mak