#!/sh/bin .SUFFIXES:.c.o CDIR = /Users/shelley/c BINDIR = $(CDIR)/bin CC = gcc CFLAGS = -g -O RM = rm -f getoptOBJ = getopt.o getopt:$(getoptOBJ) $(CC) $(CFLAGS) -o $(BINDIR)/$@ $(BINDIR)/$^ $(RM) $(BINDIR)/$^ strchrOBJ = strchr.o strchr:$(strchrOBJ) $(CC) $(CFLAGS) -o $(BINDIR)/$@ $(BINDIR)/$^ $(RM) $(BINDIR)/$^ #模式规则 #%o:%c # $(CC) $(CFLAGS) -o $(BINDIR)/$@ -c $< #后缀规则 .c.o: $(CC) $(CFLAGS) -o $(BINDIR)/$@ -c $< .PHONY:clean clean: $(RM) $(BINDIR)/* @echo "this rm -f $(BINDIR)/*"