Command | Description |
---|---|
make |
Compile the project |
make clean |
Remove the object files |
make fclean |
Remove the binary file and the object files |
make re |
Re-compile the project |
make tests_run |
Compile the tests and run them |
make coverage |
Compile the tests and run them with coverage |
.
├── Makefile # Main Makefile
├── lib
│ ├── Makefile # Compile libraries
│ ├── lib0
│ │ └── Makefile # Compile the library 0
│ ├── lib1
│ │ └── Makefile # Compile the library 1
│ └── lib2
│ └── Makefile # Compile the library 2
└── tests
└── Makefile # Compile tests
- Add the source file in the
src/
directory - Add the source file path in the
SRC
variable in the./Makefile
SRC = src/main.c \ src/my_new_file.c <-- Add the source file here
- Add the library folder in the
lib/
directory - Add the library make command in the
lib/Makefile
all: $(MAKE_COMMAND) -C my $(MAKE_COMMAND) -C new_lib <-- Add the library make command here clean: $(MAKE_COMMAND) clean -C my $(MAKE_COMMAND) clean -C new_lib <-- Add the library make command here fclean: clean $(MAKE_COMMAND) fclean -C my $(MAKE_COMMAND) fclean -C new_lib <-- Add the library make command here
- Link the library in the
./Makefile
LDFLAGS = -lmy -lnew_lib <-- Add the library here
Add the test file in the tests/unit_tests/
directory