GNU Make & Makefile To Build C/C++ Projects – (LINUX,MAC)
Understand make tool & write better makefile by understanding what is happening behind the scene(Creation of intermediate files) during building C/C++ programs. We will understand the makefile by using a real time example( “Creation Of Egg Omelet” ).
We are going to do 2 projects during the learning process of makefile.
PROJECT#1: Without knowing/remembering too many things you will be able to write a makefile for generating binary, shared object(.so), static object(.a), and also get a trick to link from anywhere. After completion of this project Idea of makefile will be cleared. We are creating a makefile template after completing this project and which can be easily used in any project.
PROJECT#2: During implementing this project, we’ll improve our makefile and makefile template created in Project#1 by applying patterns, functions.
Every step we will face some problem and then apply the solution.
We will begin with the PROJECT FOLDER STRUCTURE creation(THIS CAN BE USED IN REAL TIME PROJECTS) after understanding all the possible output of a C/C++ program. Then we will come across more technical issues in programming and try to solve them one by one during this journey. Our project structure is in such a way that deployment process will become much easier.
We’ll start writing simple makefiles and keep on improving as we really need it! We are doing lots of exercises and facing lots of issues and also fixing all on the fly!
We are going to write a makefile for all possible outputs. In this course you will always learn WHY??? and HOW???
I will show you the real requirement of a particular concept and then we will learn and apply that.
1. Write makefile by knowing minimal things.
2. One Makefile to call all makefiles
3. Makefile with Cross Compilation feature
4. Makefile considering DEBUG & RELEASE version of binary.
5. Passing MACRO from makefile to other makefile
6. Detect environment variables of terminal and one make pass the same to other make.
7. We will discuss high level design(HLD) of the projects and from that you will feel how easy it is to write a makefile.
8. You will be more comfortable with command line compilation
9. Understand shared object linking issues and how to fix it temporarily as well as permanently.
10. Project will be done in MAC and copied to Linux. We will directly do a single make which will call all the modules makefile and build the executables, shared object, static objects seamlessly. IMPORTANT thing is WITHOUT ANY SINGLE LINE OF CODE CHANGE FOR LINUX!