Greetings,
my "problem" isn't directly related to SFML, but I hope you can help me !
Here is my makefile, I am also underlining the fact that my SFML installation directory is $HOME/.SFML-2.0
PROGRAM=app
SOURCES=$(wildcard *.cpp)
OBJECTS=$(patsubst %.cpp,%.o,$(SOURCES))
LIBREP=$(HOME)/.SFML-2.0
CC=g++
CPPFLAGS=
CFLAGS=-Wall
IFLAGS= -I$(LIBREP)/include
LDFLAGS=-L$(LIBREP)/lib -lsfml-graphics -lsfml-window -lsfml-system
all: show $(PROGRAM)
show:
@echo "librep : "$(LIBREP);
@echo "include : "$(IFLAGS);
@echo "ld : "$(LDFLAGS);
@echo "sources : "$(SOURCES);
@echo "objects : "$(OBJECTS);
$(PROGRAM):$(OBJECTS)
$(CC) $(CFLAGS) $(OBJECTS) -o $@ $(LDFLAGS)
%.o:%.d
$(CC) $(CFLAGS) -c $< $(IFLAGS) $(LDFLAGS)
%.d:%.cpp
$(CC) $(CFLAGS) -MM $< $(IFLAGS)
clean:
rm -f $(PROGRAM) $(OBJECTS) *.d *~
and here is the output :
g++ -c -o app.o app.cpp
In file included from app.hpp:4:0,
from app.cpp:1:
Resources.hpp:7:29: erreur fatale: SFML/Graphics.hpp : Aucun fichier ou dossier de ce type
compilation terminée.
make: *** [app.o] Erreur 1
which can be translated : "fatal error : SFML/Graphics.hpp : no such file or directory"
Please not that when I'm replacing
%.o:%.d by
%o:%.cpp, everything works fine. Still, I'm losing all advantages of Makefile.
According to me, the problem occurs when computing the .d or when passing from .o to .d. I'm not very familiar with -MM options, and adding or removing IFLAGS/LDFLAGS doesn't change anything.
I'll be grateful to anyone able to help me !