This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Introduction to Low-Level Programming Concepts CMSC 212 ecture 17 1 CMSC 212 Lecture 17 October 27, 2009 Last time c Chapter 12, Using structures and pointers (pointers and data structures) binary search trees (searching for values and inserting) graphs (adding nodes and edges) c Make and makefiles header files 2 CMSC 212 dependencies in makefiles a simple makefile how to run make, what it does, and how it decides what to do Reading c Read Chapter 14 in Reek (Pointers on C) c Also read Section 10.9, Bryant & O'Hallaron 3 CMSC 212 Make, con't. 4 CMSC 212 Additional features of make c Actions can be any UNIX commands, not just compilation commands c A long line in a makefile can be continued on the next clean: echo "Removing object, executable, and core files." rm f *.o *.x core core.* 5 CMSC 212 line by ending it with a backslash c Comments in a makefile start with a pound sign ( # ) and last until the end of the line A more complex makefile CC= gcc CFLAGS= ansi pedantic-errors Werror Wall all: int-count.x main.x int-count.x: int-count.o table.o $(CC) -o int-count.x int-count.o table.o main.x: main.o table.o hash-table.o $(CC) -o table.x main.o table.o hash-table.o nt ount.o nt ount.c nt ount.h two top-level programs macro definitions note no $(CFLAGS) here!!! 6 CMSC 212 int-count.o: int-count.c int-count.h $(CC) $(CFLAGS) c int-count.c table.o: table.c table.h $(CC) $(CFLAGS) c table.c main.o: main.c table.h hash-table.h $(CC) $(CFLAGS) c main.c hash-table.o: hash-table.c hash-table.h $(CC) $(CFLAGS) c hash-table.c clean: rm -f *.x *.o core core.* links together several files not part of main tree- built by typing "make clean" More about header files c Header files should contain declarations that the compiler needs to see to be able to compile executable code (statements), but no executable code header files contain function prototypes, symbolic constants, enum s, typedef s and extern global variable declarations 7 CMSC 212 enum s, typedef s and extern global variable declarations...
View Full Document
This note was uploaded on 11/23/2009 for the course CMSC 212 taught by Professor Staff during the Spring '08 term at Maryland.
- Spring '08