首页 > 代码库 > HelloWorld Makefile Template

HelloWorld Makefile Template

DEPDIR = build_depTARGET_NAME = helloworldCFLAGS = -WallSRCS  = main.cSRCS += foo.cOBJS   = $(SRCS:%.c=%.o)all: $(OBJS)    $(CC) $(CFLAGS) $^ -o $(TARGET_NAME)debug:    @echo "CC       = $(CC)"    @echo "MAKE     = $(MAKE)"    @echo "SRCS     = $(SRCS)"    @echo "OBJS     = $(OBJS)"    @echo "CFLAGS   = $(CFLAGS)"$(DEPDIR)/%.d: %.c    $(SHELL) -ec mkdir -p $(DEPDIR); \    $(CC) -MM $(CFLAGS) $< | sed \‘s@\($*\)\.o[ :]*@\1.o $@ : @g\‘ > $@.$$$$;     cp $@.$$$$ $@; rm $@.$$$$include $(SRCS:%.c=$(DEPDIR)/%.d)clean:    @rm -f $(TARGET_NAME)    @rm -f *.o

 

HelloWorld Makefile Template