#First, we define the MACRONAMES:
SLIB = libScalar_Product.a
APP=app.x
CC = gcc
CFLAGS = -O3
LIBPATH = .
#Then we refer to them by $(MACRONAMES):
$(APP): main.o $(SLIB)
$(CC) $(CFLAGS) -o $(APP) main.o -L$(LIBPATH) -lScalar_Product
main.o: main.c Scalar_Product.h
$(CC) $(CFLAGS) -c main.c
Scalar_Product.o: Scalar_Product.c
$(CC) $(CFLAGS) -c Scalar_Product.c
$(SLIB): Scalar_Product.o
ar -cru $(SLIB) Scalar_Product.o
ranlib $(SLIB)
|