0
votes

i'm trying to use GCC (linux) with a makefile to compile my project. I get the following error :

% make map
make: *** No rule to make target `map'.  Stop.

Does any one have any idea what could that be ?

This is the makefile:

CC = gcc
DEBUG_FLAG = -g
COMP_FLAG = -std=c99 -Wall -Werror -pedantic-errors -DNDEBUG 

LIB = -L. -lmtm 
MAP_OBJS = map.o
USER_OBJS = user.o
NETWORK_OBJS = network.o
ISOCIAL_OBJS = network.o user.o Isocial.o
PARSING_OBJS = user.o network.o map.o Isocial.o mtm_isocial.o

PARSING = parsing
MAP_TEST = map_example_test
ISOCIAL_TEST = Isocial_test
NETWORK_TEST = network_test
USER_TEST = user_test

TEST_PATH = ./tests/

$(PARSING) : $(PARSING_OBJS) 
    $(CC) $(DEBUG_FLAG) $(PARSING_OBJS) $(LIB) -o $@
$(MAP_TEST) : $(MAP_OBJS)
    $(CC) $(DEBUG_FLAG) $(MAP_OBJS) $(LIB) -o $@
$(ISOCIAL_TEST) : $(ISOCIAL_OBJS)
    $(CC) $(DEBUG_FLAG) $(ISOCIAL_OBJS) $(LIB) -o $@
$(USER_TEST) : &(USER_OBJS)
    $(CC) $(DEBUG_FLAG) $(USER_OBJS) $(LIB) -o $@
$(NETWORK_TEST) : $(NETWORK_OBJS)
        $(CC) $(DEBUG_FLAG) $(MAP_OBJS) $(LIB) -o $@

map.o: map.c map.h mtm_ex2.h
    $(CC) -c $(DEBUG_FLAG) $(COMP_FLAG) $*.c
isocial.o: Isocial.c user.h mtm_ex2.h set.h network.h list.h Isocial.h
    $(CC) -c $(DEBUG_FLAG) $(COMP_FLAG) $*.c
parsing.o: parsing.c Isocial.h parsing.h mtm_ex2.h
    $(CC) -c $(DEBUG_FLAG) $(COMP_FLAG) $*.c
network.o: network.c network.h set.h mtm_ex2.h
    $(CC) -c $(DEBUG_FLAG) $(COMP_FLAG) $*.c
user.o:user.c user.h set.h mtm_ex2.h
    $(CC) -c $(DEBUG_FLAG) $(COMP_FLAG) $*.c
user_test.o:  user_test.c ../test_utilities.h ../user.h ../mtm_ex2.h \
  ../set.h  
    $(CC) -c $(DEBUG_FLAG) $(COMP_FLAG) $(TEST_PATH)$*.c
Isocial_test.o:  Isocial_test.c ../test_utilities.h ../Isocial.h
    $(CC) -c $(DEBUG_FLAG) $(COMP_FLAG) $*.c $(TEST_PATH)$*.c
map_example_test.o: map_example_test.c ../test_utilities.h ../map.h
    $(CC) -c $(DEBUG_FLAG) $(COMP_FLAG) $*.c $(TEST_PATH)$*.c
network_test.o: network_test.c ../test_utilities.h ../network.h ../set.h \
  ../mtm_ex2.h
    $(CC) -c $(DEBUG_FLAG) $(COMP_FLAG) $*.c $(TEST_PATH)$*.c

EXEC = $(PARSING) $(MAP_TEST) $(ISOCIAL_TEST $(USER_TEST) $(NETWORK_TEST)

tests : $(MAP_TEST) $(ISOCIAL_TEST) $(USER_TEST) $(NETWORK_TEST)

isocial : $(PARSING)

clean:
    rm -f $(PARSING_OBJS) $(EXEC)
1

1 Answers

3
votes

The error message is correct: I see a target for map.o, but there's no target for map, which would look like

 map: map.o
    something something something

There are targets for programs named parsing, map_example_test, network_test, and Isocial_test; perhaps you want to build one of those?

If you just typed make, it would build the program parsing, as that's the first target in the file.