CC = gcc CFLAGS = -O2 -Wall # 检测操作系统类型 ifeq ($(OS),Windows_NT) TARGET = decode.exe RM = del /Q else TARGET = decode RM = rm -f endif SRCS = decode.c OBJS = $(SRCS:.c=.o) .PHONY: all clean all: $(TARGET) $(TARGET): $(OBJS) $(CC) $(CFLAGS) -o $@ $^ %.o: %.c $(CC) $(CFLAGS) -c $< clean: $(RM) $(OBJS) $(TARGET)