gpt4 book ai didi

linux - 操作系统检测 Makefile

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:58:13 24 4
gpt4 key购买 nike

这是我的 makefile,直到今天我从未尝试在其中使用操作系统检测。我的看起来像这样:

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

我明白这个错误,但我不知道如何修复它。

最佳答案

看起来您在文件顶部(附近)遗漏了这个:

UNAME := $(shell uname)

关于linux - 操作系统检测 Makefile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23544041/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com