|--
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文件
test2中的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)
MAKE = make
subsystem:
cd $(SUBDIR) && $(MAKE)
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
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