# We start with a rule to make ‹getenv› again: getenv: getenv.o cc -o getenv getenv.o # We also add -std=c99 to CFLAGS: CFLAGS += -std=c99 # Out of the box, ‹make› knows how to compile C sources (‹.c› files) # into object files (‹.o› files). This time, however, we will tell # it how to do that anyway. The traditional way to tell ‹make› that # ‹.c› and ‹.o› are «suffixes» (which are special for ‹make›) is # this: .SUFFIXES: .c .o # If .c and .o are suffixes, we can write special rules (called # inference rules) which tell ‹make› how to go from «any» ‹.c› file # to a corresponding ‹.o› file like this: .c.o: cc -c $(CFLAGS) -o $@ $< # We have used some magic variables there. The $@ is the name of the # target to make and is defined in any rule. The $< is the name of # the prerequisite (the .c file in this case) and may or may not be # available in standard (non-suffix) rules. # # Now, since we have the suffix rule, we don't have to tell ‹make› # how to build ‹getenv.o›. Try running those commands: # # $ rm -f getenv.o getenv # $ make -f suffixes.mk # You can now go on to read ‹autodep.mk›.