path include and src directory makefile

后端 未结 3 1362
不知归路
不知归路 2021-01-30 07:58

Following this tutorial:

http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/

It has 3 files 2 of which are .c files and 1 .h fil

3条回答
  •  爱一瞬间的悲伤
    2021-01-30 08:25

    The simple Makefile definitions seem OK to me as they appear in your question. Try specifying the compiler options before the file names:

    $(ODIR)/%.o: %.c $(DEPS)
        $(CC) $(CFLAGS) -c -o $@ $<
    
    hellomake: $(OBJ)
        gcc $(CFLAGS) -o $@ $^
    

    You need to run make from the source directory.

提交回复
热议问题