Problem Solving With C++ Recitation – make February 2016.

Slides:



Advertisements
Similar presentations
Makefiles. makefiles Problem: You are working on one part of a large programming project (e. g., MS Word).  It consists of hundreds of individual.c files.
Advertisements

Separate compilation Large programs are generally separated into multiple files, e.g. tuples.h, ray.h, ray.c, tuples.c main.c With several files, we can.
Understanding Makefiles COMP 2400, Fall 2008 Prof. Chris GauthierDickey.
1 CSE 390 Lecture 8 Large Program Management: Make; Ant slides created by Marty Stepp, modified by Josh Goodwin
1 The Makefile Utility ABC – Chapter 11,
MAKEFILES A description file that defines the relationships or dependencies between applications and functions; it simplifies the development process.
1 CS 201 Makefile Debzani Deb. 2 Remember this? 3 What is a Makefile? A Makefile is a collection of instructions that is used to compile your program.
Basic linux shell commands and Makefiles. Log on to engsoft.rutgers.edu Open SSH Secure Shell – Quick Connect Hostname: engsoft.rutgers.edu Username/password:
Introduction to Make Updated by Prasad Spring 2000.
CS465 - Unix C Programming (cc/make and configuration control)
G++ and make Dan Wilson CS193 02/01/06. The g++ Compiler What happens when you call g++ to build your program? Phase 1, Compilation:.cpp files are compiled.
Lecture 8  make. Overview: Development process  Creation of source files (.c,.h,.cpp)  Compilation (e.g. *.c  *.o) and linking  Running and testing.
Unix Makefiles COP 3330 Lecture Notes Dr. David A. Gaitros.
Makefiles CISC/QCSE 810. BeamApp and Tests in C++ 5 source code files After any modification, changed source needs to be recompiled all object files need.
Makefiles. makefiles Problem: You are working on one part of a large programming project (e. g., MS Word).  It consists of hundreds of individual.cpp.
Makefile M.A Doman. Compiling multiple objects Card.cpp -> Card.o Deck.cpp -> Deck.o main.cpp -> main.o main.o Deck.o Card.o -> Dealer.exe.
GNU Make Computer Organization II 1 © McQuain What is make ? make is a system utility for managing the build process (compilation/linking/etc).
1 CSE 390 Lecture 8 Large Program Management: Make; Ant slides created by Marty Stepp, modified by Jessica Miller and Ruth Anderson
Data Display Debugger (DDD)
Makefiles CARYL RAHN. Separate compilation Large programs are generally separated into multiple files, e.g. main.c addmoney.c removemoney.c money.h With.
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2015 Makefile Tutorial CIS5027.
Makefiles Problem: You are working on one part of a large programming project (e. g., MS Word).  It consists of hundreds of individual.c files all linked.
Emacs, Compilation, and Makefile C151 Multi-User Operating Systems.
Object Oriented Programming COP3330 / CGS5409.  Compiling with g++  Using Makefiles  Debugging.
Brandon Packard. Why make? So far, you have probably worked on relatively small projects Coding projects can become huge My research consists of 1600.
GNU Make Computer Organization II 1 © McQuain What is make ? make is a system utility for managing the build process (compilation/linking/etc).
Object Oriented Programming COP3330 / CGS5409.  Assignment Submission Overview  Compiling with g++  Using Makefiles  Misc. Review.
Makefiles Manolis Koubarakis Data Structures and Programming Techniques 1.
Multiple file project management & Makefile
Large Program Management: Make; Ant
CSE 303 Lecture 17 Makefiles reading: Programming in C Ch. 15
Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha Fall 2015
Compilation and Debugging
Compilation and Debugging
Makefiles.
Large Program Management: Make; Ant
Makefiles Caryl Rahn.
SCMP Special Topic: Software Development Spring 2017 James Skon
Makefile Separate Compilation
Makefile Tutorial CIS5027 Prof: Dr. Shu-Ching Chen
What is make? make is a system utility for managing the build process (compilation/linking/etc). There are various versions of make; these notes discuss.
Prof: Dr. Shu-Ching Chen TA: Yimin Yang
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Hector Cen Fall 2017
Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha
Large Program Management: Make; Ant
Large Program Management: Make; Ant
Makefiles and the make utility
Large Program Management: Make; Ant
Data Structures and Programming Techniques
Unix Programming Environment
CSE 390 Lecture 8 Large Program Management: Make; Ant
CMPSC 60: Week 4 Discussion
Programming Project #1 Fork and Command Shell
CMSC 202 Additional Lecture – Makefiles
Large Program Management: Make; Ant
SCMP Software Development Spring 2018 James Skon
Large Program Management: Make; Ant
Build Tools (make) CSE 333 Autumn 2018
CSCE-221 Makefile Introduction
Large Program Management: Make; Ant
Large Program Management: Make; Ant
Large Program Management: Make; Ant
Makefiles and the make utility
Makefile Assignment Create a file called f1.cpp. It should contain the following function: int squareIt ( int x ) { //insert code to calc and return the.
CSE 390 Lecture 8 Large Program Management: Make; Ant
SCMP Software Development Spring 2018 James Skon
What is make? make is a system utility for managing the build process (compilation/linking/etc). There are various versions of make; these notes discuss.
g++ features, better makefiles
Large Program Management: Make; Ant
Large Program Management: Make, Ant
Presentation transcript:

Problem Solving With C++ Recitation – make February 2016

Make Utility: The "make" is a utility which automatically determines the pieces of a large program that need to be recompiled, and issues commands to recompile them. Problem: Recompiling the whole project consisting hundreds of files for every minor code changes will take hours. Solution: makefile Syntax: target: [ ] * [ ]

Example: exec: movie.o actor.o g++ -Wall –I. movie.o actor.o –o exec movie.o: movie.cpp movie.h g++ -Wall –I. –c movie.cpp actor.o: actor.cpp actor.h g++ -Wall –I. –c actor..cpp Order of Execution If you type make and hit enter, it will look for a make file in the current directory and run the commands of the first target If you type make and hit enter, it will look for a make file in the current directory and locate the target. How does make work: Each file has a timestamp that indicates when the file was last modified make looks at the timestamp of the file, and then the timestamp of the dependencies (which are also files) If the dependencies have changed, then the target needs to be updated. More precisely, if the dependent files have a more recent timestamp than the target, then the command lines are run

make all: Sometime we need to create more than one executable. You can achieve this with an all target. Example: all: p1 p2 p3 p1: Foo.o main1.o g++ -Wall –I. Foo.o main1.o -o p1 p2: Bar.o main2.o g++ -Wall –I. Bar.o main2.o -o p2 p3: Baz.o main3.o g++ -Wall –I. Baz.o main3.o -o p3 make clean: To guarantee a most recent rebuild, we have to recompile the entire project. It’s a good idea to clean all the executable files & object files before recompiling. Example: clean: rm *.o p1 p2 p3 make tar: When you submit files, often you have tar many files together. Example: tar tar –cvf assignment1.tar *.cpp *.h p1

ASSIGNMENT Download complex example file from cs253 progress page Create a makefile making use of all three different targets(tar,clean,all)