# Here we demonstrate variable substitution

OBJS = main.o blah.o \
	 bar.o
CC = gcc
AR = ar
RANLIB = ranlib # we might want to make this ar -s on some systems
RM = rm

.PHONY: all clean dep
all: main libblah.a

main: $(OBJS)
	$(CC) -o main $(OBJS)

# Make knows how to do this, but we'll write a static pattern rule anyway.
$(OBJS): %.o: %.c
	$(CC) -c $< -o $@

libblah.a: $(OBJS)
	$(AR) -r libblah.a $(OBJS)
	$(RANLIB) libblah.a

clean:
	-$(RM) -f $(OBJS) main libblah.a core *~

dep:
	makedepend *.c
# DO NOT DELETE THIS LINE -- make depend depends on it.

bar.o: blah.h
blah.o: blah.h
main.o: /usr/include/stdio.h /usr/include/ansi_compat.h blah.h
