Miscellaneous shortcutsAlthough the examples we have shown do not explicitly say so, you can put more than one file in the target section of the dependency rules. If a file appears as a target more than once in a dependency, all of its source files are included as sources for that target. Here is our sample Makefile again:
CFLAGS = -Aa -D_HPUX_SOURCE
OBJECTS = data.o main.o io.o
project1: $(OBJECTS)
cc $(OBJECTS) -o project1
data.o main.o: data.h
io.o main.o: io.h
This Makefile shows main.o appearing in two places. Make
knows by looking at all the dependencies that main.o depends on both
data.h and io.h.
|
Author: Ben Yoshino (ben@wiliki.eng.hawaii.edu)Comments, Questions? | E-mail: webmaster@wiliki.eng.hawaii.edu Last updated on Monday, February 05, 2001 Copyright © 2001 University of Hawai`i, College of Engineering, Computer Facility All rights reserved. |