这是我的makefile,直到今天我从未尝试过使用OS检测。我看起来像这样:
CC = gcc
CFLAGS = -Wall -Wextra -O1 -Wuninitialized
OUT = project.exe
ifeq ($(UNAME),Darwin) #Mac OS
echo "Darwin"
SRC = sdl_gui.c libSDLextra.c libImageProcessing.c SDLmain.m
OBJ = sdl_gui.o libSDLextra.o libImageProcessing.o SDLmain.o
LIBS = -I /Library/Frameworks/SDL.framework/Headers -framework SDL -I /Library/Frameworks/SDL_ttf.framework/Versions/A/Headers -framework SDL_ttf -framework Cocoa
endif
ifeq ($(UNAME),Linux) #Linux based systems
SRC = sdl_gui.c libSDLextra.c libImageProcessing.c
OBJ = sdl_gui.o libSDLextra.o libImageProcessing.o
LIBS = -lSDL -lSDL_ttf
endif
all : $(OUT)
$(OUT) : $(OBJ)
$(CC) $(CFLAGS) $(OBJ) -o $(OUT)
$(OBJ) : $(SRC)
$(CC) $(CFLAGS) -c $(SRC)
clean :
rm -f $(OBJ) $(OUT)
当我make
时,我发现了这个错误:
gcc -Wall -Wextra -O1 -Wuninitialized -o projet.exe
clang: error: no input files
make: *** [projet.exe] Error 1
我理解错误,但我不知道如何修复它。
答案 0 :(得分:1)
看起来你在文件顶部(附近)遗漏了这个:
UNAME := $(shell uname)