我在这里有这个makefile:
CC := gcc
ODIR := build
SDIR := source
IDIR := include
LDIR := lib
CFLAGS := -I$(IDIR) -fms-extensions -O2 -Wall
LFLAGS := -L$(LDIR)
CFILES := $(wildcard $(SDIR)/*.c)
OBJS := $(patsubst $(SDIR)/%.c, build/%.o, $(wildcard $(SDIR)/*.c))
PLATFORM = $(shell uname)
ifeq ($(findstring Linux,$(PLATFORM)),Linux)
TARGET=$(shell basename $(CURDIR))
endif
ifeq ($(findstring Darwin,$(PLATFORM)),Darwin)
TARGET=$(shell basename $(CURDIR))
endif
ifeq ($(findstring MINGW,$(PLATFORM)),MINGW)
TARGET=$(shell basename $(CURDIR)).exe
endif
$(TARGET): $(ODIR) $(OBJS)
$(CC) $(ODIR)/*.o -o $(TARGET) $(CFLAGS) $(LFLAGS)
$(ODIR)/%.o: $(SDIR)/%.c
$(CC) -c -o $@ $< $(CFLAGS)
$(ODIR):
@mkdir $@
.PHONY: clean
clean:
rm -f $(TARGET) $(ODIR)/*.o
问题是它不想创建一个exe。在Windows,Linux上进行了尝试,并且我在Windows上安装了mingw(使用mingw32-make.exe),但仍然没有exe。有人知道如何解决这个问题吗?预先感谢!