0

This case has been opened many times, I have checked up all of the answers but didn't really help.

I'm posting it here may someone can help me.

My working architecture is :

| ( I'm Here )
+- matamzone.c
+- amountset.c
+- product.c
+- order.c
+- matamzone.h
+- amount.h
+- p.h
+- order.h
+- TEST-folder
   +- amount_set_main.c
   +- amount_set_main.h
   +- amount_set_tests.c
   +- amount_set_tests.h

The makefile have to support running amount_set_main.c by writing make amount_set.

My make file code:

    CC = gcc
COMP_FLAGS = -std=c99 -Wall -pedantic-errors -Werror -DNDEBUG
COMP_NEW = -std=c99 -Wall -pedantic-errors -Werror -DNDEBUG /tests
OUR_FILES = amount_set.c matamazom.c order.c product.c matamazom_print.c 
OUR_NFILES = amount_set_main.c amount_set_test.c
OBJS = amount_set.o matamazom.o order.o product.o matamazom_print.o
TEST_OBJS = amount_set_main.o amount_set_test.o
EXEC = matamazom.exe 
TESTROOMEXE = amount_set


$(TESTROOMEXE) : $(TEST_OBJS)
     $(CC) -o $@ $(COMP_FLAGS) $(TEST_OBJS)  -L. -lmtm  

matamazom.o: matamazom.c matamazom.h list.h product.h order.h amount_set.h matamazom_print.h
    $(CC) -c $(COMP_FLAGS) $(OUR_FILES) $*.c 

amount_set.o: amount_set.c amount_set.h
    $(CC) -c $(COMP_FLAGS) $(OUR_FILES) $*.c 

order.o: order.c order.h amount_set.h
    $(CC) -c $(COMP_FLAGS) $(OUR_FILES) $*.c 

product.o: product.c matamazom.h
    $(CC) -c $(COMP_FLAGS) $(OUR_FILES) $*.c 

matamazom_print.o: matamazom_print.c matamazom_print.h
    $(CC) -c $(COMP_FLAGS) $(OUR_FILES) $*.c    


amount_set_main.o: amount_set_main.c amount_set_tests.h test_utilities.h
    $(CC) -c $(COMP_NEW) $(OUR_NFILES) $*.c

amount_set:  amount_set_main.c amount_set_tests.h amount_set.h 
    $(CC) -o $@ $(COMP_NEW) $(TEST_OBJS) -L. -lmtm

amount_set_test.o: amount_set_tests.c amount_set_tests test_utilities.h ../amount_set.h
    $(CC) -c $(COMP_NEW) $(OUR_NFILES) $*.c

clean: 
    rm -f $(OBJS) $(EXEC) $(TESTS) $(TEST_O)

For some reason I get:

**make: *** No rule to make target `amount_set_main.c', needed by `amount_set_main.o'.  Stop.**

Any help :(

the busybee
  • 10,755
  • 3
  • 13
  • 30
  • 1
    I'm pretty sure you need to point to the .o not the .c in the rule of amount_set_main.0 – B. Go Dec 07 '19 at 17:18
  • That message means exactly what it says: make cannot find the file `amount_set_main.c`. If you type `ls amount_set_main.c`, what do you see? – MadScientist Dec 07 '19 at 18:09
  • I edited your question because the "image" of your source tree was completely unreadable. Feel free to correct any errors I introduced. – the busybee Dec 08 '19 at 15:37
  • You might like to look up the documentation of `VPATH` to help `make` find your sources. Please make sure that you also read its caveats. – the busybee Dec 08 '19 at 15:37

0 Answers0