makefile 模板

CC=gcc
CFLAGS=-g -Wall
#OBJPATH=./build
SOURCES=$(wildcard *.c ./core/*.c)
OBJECTS=$(addprefix ./, $(addsuffix .o, $(basename $(SOURCES))))
 
TARGET=ds
all: $(TARGET)
 
$(TARGET) : $(OBJECTS)
$(CC) $(CFLAGS) -o $@ $(OBJECTS) -lpthread
 
%.o : %.c
$(CC) $(CFLAGS) -o $@ -c $<
clean :
-rm $(OBJECTS) $(TARGET)
 通用makefile模板,留做备份

你可能感兴趣的:(makefile)