Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Makefile – Makefile example – Makefile Guide

makefile-example

makefile-example

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 $<
—————

Rajesh Kumar
Follow me
Latest posts by Rajesh Kumar (see all)
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x