'How do I write Makefile to compile c project with bin lib obj subfolders
This is my project structure
build/
bin/
z.exe
lib/
libx.a
liby.a
libz.a
obj/
x.o
y.o
z.o
src/
module_1/
x.h
x.c
module_2/
y.h
y.c
module_3/
z.h
z.c
I want to compile my project so that the build directory has these subfolder (bin, lib, obj)
How do I write Makefile for this? (Spent 2 days cannot figure that out)
module_3 is the entry point with main function in z.c
I want all modules become libraries for later testing them
NOTE:
default include in modules is relative to the project directory
src/module_3/z.c
#include "src/module_1/x.h"
...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
