您的位置:首页 > 其它

makefile 调用其他makefile文件

2018-01-21 12:55 162 查看

|-- Makefile


|-- test1


|   |-- Makefile


|   |-- bin


|   |   `-- test


|   |-- hello.o


|   |-- include


|   |   `-- hello.h


|   `-- src


|       `-- hello.c


`-- test2


    |-- Makefile


    |-- bin


    |   `-- test


    |-- hello.o


    |-- include


    |   `-- hello.h


    |-- obj


    `-- src


        `-- hello.c


 根目录下的Makefile文件调用test2中的Makefile文件:

根目录下的Makefile文件


SUBDIR = ./test2


MAKE = make


subsystem:


        cd $(SUBDIR) && $(MAKE)



test2中的Makefile文件:


all: ./bin/test




CC = gcc


INCLUDE = ./include


vpath %.c ./src


vpath %.h ./include




./bin/test: hello.o


        $(CC) -o $@ $^


hello.o: hello.c hello.h


        $(CC) -c $< -I$(INCLUDE)


.PHONY: clean


clean:


        -rm *.o



 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: