makefile - no rule to make a target c

639 Views Asked by At

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 :(

0

There are 0 best solutions below