Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Makefile problem (linking)  (Read 1439 times)

0 Members and 1 Guest are viewing this topic.

Lasconik

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Makefile problem (linking)
« on: June 18, 2013, 05:39:40 pm »
Greetings,
my "problem" isn't directly related to SFML, but I hope you can help me !  :D

Here is my makefile, I am also underlining the fact that my SFML installation directory is $HOME/.SFML-2.0

Quote
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 :
Quote
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 ! :D

 

anything