CSE321Week3 - CSE 321 Panya Chanawangsa pc57@buffalo.edu...

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

View Full Document Right Arrow Icon
CSE 321 Panya Chanawangsa pc57@buffalo.edu
Background image of page 1

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

View Full DocumentRight Arrow Icon
Office Hours • M, R 4 - 5:30 @ Fronczak 206 A
Background image of page 2
Today’s Agenda • Introduction to Makefiles • Homework #1 • Data-driven vs. Function-driven programming
Background image of page 3

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

View Full DocumentRight Arrow Icon
Introduction to Makefiles • Extremely useful when your program involves more than one source file • It can be as simple as gcc -o binary_file sourcefile.c • For example, gcc -o hello hello.c • Or it can get as complicated as your source code
Background image of page 4
Introduction to Makefiles (cont’d) • General rule: target: requirements build instructions • Requirements can in turn be targets.
Background image of page 5

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

View Full DocumentRight Arrow Icon
myprogram: main.o part1.o part2.o gcc -o myprogram main.o part1.o part2.o part1.o: part1.c part1.h header.h gcc -O -c part1.c part2.o: part2.c header.h gcc -O -c part2.c main.o: main.c header.h gcc -O -c main.c clean: rm -f myprogram main.o part1.o part2.o source: http://www.cs.usask.ca/staff/oster/makefiles.html Introduction to Makefiles (cont’d)
Background image of page 6
CC = gcc CFLAGS = -O OBJS = part1.o part2.o main.o myprogram: ${OBJS}
Background image of page 7

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

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

Page1 / 11

CSE321Week3 - CSE 321 Panya Chanawangsa pc57@buffalo.edu...

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

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