简体   繁体   中英

OS detection Makefile

Here is my makefile, until today I never try to use OS detection in it. Mine looks like this :

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)

When I do make I've got this error :

gcc -Wall -Wextra -O1 -Wuninitialized  -o projet.exe
clang: error: no input files
make: *** [projet.exe] Error 1

I understand the error but I don't know how to fix it.

您似乎在文件顶部(附近)缺少此功能:

UNAME := $(shell uname)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM