简体   繁体   中英

Makefile creation for subdirectories Makefile

I'm new to Makefile and I have to create a Makefile for my project.

project
├── Makefile
|
├── application
│   |── code1
│   |   ├── header-->header1.h(Inside the header1 folder)
│   |   |── source-->main1.c(Inside the source1 folder)
|   |   ├── doc-->Makefile
|   |
|   |── code2
|   |   ├── header-->header2.h(Inside the header2 folder)
|   |   |── source-->main2.c(Inside the source2 folder)
|   |   ├── doc-->Makefile

For this project , how can I write the Makefile for inside the code1 & code2 and the overall one Makefile How to create the overall Makefile to run the subdirectories Makefile

Something like this?

.PHONY: all
all: application/code1/exe1 application/code2/exe2

application/code1/exe1: application/code1/source/main1.c application/code1/header/header1.c

application/code2/exe2: application/code2/source/main2.c application/code2/header/header2.c

The application/ level adds to the pain here; perhaps you should remove it. Alternatively, maybe put the Makefile in application and remove the toplevel directories in the above.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM