Makefile – Makefile example – Makefile Guide

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

Tagged : / / / / / / / / /