| Table of Contents | Previous Slide | Next Slide |
Software Development in the UNIX Environment
A Sample Makefile for monte_pi_sprng
Here is a Makefile for the monte_pi_sprng.c program:
# Makefile to build monte_pi_sprng program
# --- macros
CC=cc
CFLAGS= -O3 -I /usr/local/lib/sprng/include -I /usr/local/lib/pgplot -g
OBJECTS= monte_pi_sprng.o plot.o
LIBS = -L/usr/local/lib/sprng/lib -llcg -L/usr/local/lib/pgplot -lcpgplot -lpgplot -lX11 -lftn -lm
# --- targets
all: monte_pi_sprng
monte_pi_sprng: $(OBJECTS)
$(CC) -o monte_pi_sprng $(OBJECTS) $(LIBS)
monte_pi_sprng.o: /usr/local/lib/sprng/include/sprng.h /usr/local/lib/pgplot/cpgplot.h monte_pi_sprng.c
$(CC) $(CFLAGS) -c monte_pi_sprng.c
plot.o: /usr/local/lib/pgplot/cpgplot.h plot.c
$(CC) $(CFLAGS) -c plot.c
# --- remove binary and executable files
clean:
rm -f monte_pi_sprng $(OBJECTS)
Notes about this Makefile:
Issue the command 'make all' or 'make monte_pi_sprng' to build the
program.
Issue the command 'make clean' to rebuild the entire application