Makefile to use source files from one directory and create the executable in another. You are given Three directories. The Top directory contains the makefile The two subdirectories belong to the Top directory first subdirectory contains the source file hello_world.c second subdirectory should contain the compiled executable of hello_world.c It appears as so Top | Makefile | first_sub: | hello_world.c | second_sub: | I understand how to compile and create an executable if and only all source files are in the same directory So my question is: How do I create a makefile that compiles the source file(s) in a subdirectory and place the compilex executable(s) in another different directory? Please show results and displayed results
Makefile to use source files from one directory and create the executable in another.
You are given Three directories.
The Top directory contains the makefile
The two subdirectories belong to the Top directory
first subdirectory contains the source file hello_world.c
second subdirectory should contain the compiled executable of hello_world.c
It appears as so
Top
|
Makefile
|
first_sub:
|
hello_world.c
|
second_sub:
|
<insert compiled executable here>
I understand how to compile and create an executable if and only all source files are in the same directory
So my question is: How do I create a makefile that compiles the source file(s) in a subdirectory and
place the compilex executable(s) in another different directory?
Please show results and displayed results
Step by step
Solved in 2 steps