Makefile export .o file to a different path than .cpp

前端 未结 2 1385
天命终不由人
天命终不由人 2020-12-22 09:33

So my task is simple, I have created the makefile (New with makefiles) and I want to keep my .o files in a different folder to have a cleaner directory and allow the usage o

2条回答
  •  执念已碎
    2020-12-22 10:15

    try

    $(OBJECT_PATH)/file1.o: $(SOURCE_PATH)/file2.cpp $(SOURCE_PATH)/file1.cpp
        $(CC) $(CFLAGS) $^ -c $@
    

    and check that CFLAGS doesn't include -o -c or -s flags

    also read about implicit rules. it might help you to orginzie your makefile

提交回复
热议问题