
Note that this example Makefile is from an older software project, which specifies everything within each makefile rather than using any recursive or inclusion-based makefile hierarchy, and is presented here for the purposes of the C intro project only. It is modified from the original for the purposes of the C intro project.
CC= gcc CFLAGS= -Wall -O2 LFLAGS+=
SRCS= cas.c \
client.c \
hashtable_itr.c
OBJS= ${SRCS:.c=.o}
all: libmarquis.a libmarquis.so
clean:
rm -f libmarquis.a libmarquis.so *.o
libmarquis.a: ${OBJS}
ar -r $@ ${OBJS}
libmarquis.so:${OBJS}
${CC} -shared ${CFLAGS} -fPIC -Wl,-soname,libmarquis.so -o $@ \
${OBJS}
.c.o:
${CC} ${CFLAGS} -c $<
—————
- Use of runtime variables to save into another variable using register in Ansible - September 6, 2018
- Ansible & Ansible Tower Variable Precedence Hierarchy - September 6, 2018
- How to use template in Ansible? - September 6, 2018
This is a well-written and practical introduction to Makefiles, clearly explaining how they help automate and manage build processes in software development. Makefiles save time and reduce errors by defining rules that determine how programs are compiled and linked, especially in large projects with many source files. The breakdown of targets, dependencies, and commands gives readers a solid foundation for writing their own Makefiles and optimizing builds. Whether you’re a beginner learning build automation or an experienced developer refining your workflow, this tutorial offers valuable insights into making your development process more efficient and consistent.