It defines variables for the compiler (CC), compiler flags (CFLAGS), installation directory (INSTALL_DIR), and the target executable name (TARGET).
The default target "all" builds the executable.
The build rule compiles hello.c into the executable.
The "install" target creates the installation directory if it doesn't exist, then installs the executable with appropriate permissions.
A "clean" target is included to remove the built executable.
To use this Makefile:
Run make to build the executable.
Run make install to install it (you may need sudo for system directories).
Run make clean to remove the built executable.
You can customize the compiler or installation directory at the command line like this:
Copymake CC=clang
make install INSTALL_DIR=/opt/bin
This allows higher-level Makefiles or BitBake recipes to override these variables as needed.
This Makefile does the following:
It defines variables for the compiler (CC), compiler flags (CFLAGS), installation directory (INSTALL_DIR), and the target executable name (TARGET). The default target "all" builds the executable. The build rule compiles hello.c into the executable. The "install" target creates the installation directory if it doesn't exist, then installs the executable with appropriate permissions. A "clean" target is included to remove the built executable.
To use this Makefile:
Run make to build the executable. Run make install to install it (you may need sudo for system directories). Run make clean to remove the built executable.
You can customize the compiler or installation directory at the command line like this: Copymake CC=clang make install INSTALL_DIR=/opt/bin This allows higher-level Makefiles or BitBake recipes to override these variables as needed.