Question

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.

Was it helpful?

Solution

It looks like you are missing this from (near) the top of the file:

UNAME := $(shell uname)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top