How to write non recursive makefile
I want to write simple non recursive makefile, but I am not getting syntax of it. Please give me example with simple description. I had read docs, html's but I am not getting how that works please give simple example. consider I have following directory structure.
| `-- main.c
| `-- main.c
| |-- mod1file1.c
| |-- mod1file1.h
| `-- module.mk
in this case app1 and app2 are different executables. then what should be contents of Makefile, and module.mk ?
Have you read Implementing non-recursive make?
Non recursive, multi DIR makefile template for new project
I know that This thread is very old but this link is viewed by many makefile newbies so adding some useful info.
Thanks to ntubski for useful link, most be code is modified from above link.
Here is goal,
- All source code is arranged in different meaningful directories.
- Makefile should be non recursive
- Adding new file in compilation process should be of minimum change in makefile
- All dependences of header and c source should be calculated correctly
- There should be option to customize each target compilation
- common things should be kept in one place
- whenever I do vi filena<tab> it should not ask me about non source file, this really sucks while editing source
- This template should be on internet so after next six months there should be no need for me to do same R&D :)
I had attached sample template project with this thread, following things are incomplete / or unknown to me,
- Unable to create separate build directory [so I used . as prefix for intermediate object and dep files]
- Install option is missing
- For loop in main Makefile is not working :) Don't know why
- sometime clean creates dep files.
Please feel free to update share or report bugs in above template.
Moved: This thread is more suitable in Programming and has been moved accordingly to help your thread/question get the exposure it deserves.
|All times are GMT -5. The time now is 04:34 AM.|