/
makefile - sandbox example
makefile - sandbox example
Always start learning make with a sandbox so you can get clear about how make works.
Make your make file like this:
all: test
main.o: main.cpp main.h
%.o: %.cpp
$(CC) -c $< -o $@
test: main.o life.o
$(CC) main.o life.o -o test
clean:
rm -rf *.o test
It’s important the “all” rule goes at the top.
For your demo files main.h and life.cpp can be empty files - try doing “touch main.h life.cpp”.
For main.cpp use this:
#include "main.h"
#include <stdio.h>
int main(){
printf("Hello world of C!\n");
return 0;
}
, multiple selections available,
Related content
Simple make system - putting it all together
Simple make system - putting it all together
More like this
Dependency Tree
Dependency Tree
More like this
Make - Concepts
Make - Concepts
Read with this
Make recipe rule
Make recipe rule
More like this
Make Dependency Files for C/C++ Headers
Make Dependency Files for C/C++ Headers
Read with this
Making a Single File C/C++ Sandbox
Making a Single File C/C++ Sandbox
More like this