gsrunion
gsrunion

Reputation: 409

Makefile issue. Second set of eyes please

PROJ     =      .
SRC_ROOT =      .
FLAGS    =      -g -Wall -Wextra

INC      =      -I$(PROJ)                               \
                -I$(SRC_ROOT)/Exception                 \
                -I$(SRC_ROOT)/MapFile

DEPS     =      $(SRC_ROOT)/Exception/Exception.h       \
                $(SRC_ROOT)/Exception/Exception.cpp     \
                $(SRC_ROOT)/MapFile/MapFile.h           \
                $(SRC_ROOT)/MapFile/MapFile.cpp

OBJS     =      $(SRC_ROOT)/MapFile/MapFIle.o           \
                $(SRC_ROOT)/Exception/Exception.o

all: main $(OBJS)

%.o : %.cpp %.h
        g++ -c $(FLAGS) $(INC) $< -o $@

main: $(DEPS) $(OBJS) main.cpp
        g++ -o main $(FLAGS) $(INC) main.cpp $(OBJS)

$(SRC_ROOT)/MapFile/MapFIle.o : $(SRC_ROOT)/MapFile/MapFIle.cpp $(SRC_ROOT)/MapFile/MapFIle.h
        g++ -c $(FLAGS) $(INC) $< -o $@


clean:
        rm -f *~
        rm -f $(OBJS)
        rm -f main
        rm -f -R *.dSYM

When I comment out the explicit rule for MapFile.o I get a "no rule to build error for it" yet the implicit rule clearly works for Exception.o. Any idea what could be the issue? Hope it is not something simple that I am missing having been staring at it for a few. Thanks in advance.

Using GNU Make 3.81

Upvotes: 0

Views: 55

Answers (1)

ruakh
ruakh

Reputation: 183201

The filenames are case-sensitive; in some places you have MapFile.cpp and MapFile.h, but elsewhere you have MapFIle.o (with a capital I) and MapFIle.cpp and so on.

Upvotes: 2

Related Questions