CC = gcc CFLAGS = -g -ansi -Wall # files associated with the bitstring package HDRS = bits.h SRCS = bits.c OBJECTS = bits.o # files associated with the test driver DHDRS = DSRCS = driver.c DOBJ = driver.o # this is the default target, the :: is unusual. all :: driver # This rule identifies how to make objects from sources %.o : %.c $(CC) $(CFLAGS) -c $< # this rule generates our test driver driver : $(OBJECTS) $(DOBJ) $(CC) $(CFLAGS) $(OBJECTS) $(DOBJ) -o driver # this rule removes unwanted object modules clean: usr/bin/rm $(OBJECTS) $(DOBJ) # this rule wraps up stuff in a shar file shar: shar Makefile $(SRCS) $(HDRS) $(DSRCS) $(DHDRS) > bits.shar # this rule wraps stuff up in a tar file tar: tar cvf bits.tar Makefile $(SRCS) $(HDRS) $(DSRCS) $(DHDRS) #or perhaps # tar cvf - Makefile $(SRCS) $(HDRS) $(DSRCS) $(DHDRS) >bits.tar # the next rule determines the dependencies between code and header files # saving us from having to do it. # You should do a make depend after every re-organization of the files that # would alter dependencies. depend: makedepend $(SRCS) $(DSRCS) # DO NOT DELETE THIS LINE -- make depend depends on it. bits.o: /usr/include/stdio.h bits.h driver.o: /usr/include/stdio.h bits.h # The above two lines were produced by makedepend--try it # See man makedepend