CroCo
CroCo

Reputation: 5741

how to add multiple shared libraries in this makefile

I have a source file that uses two shared libs (i.e. -lnr2c and -lm). I would like to add the math lib -lm without -l. This is the part of my makefile for this matter.

LIBFILE    = nr2c -lm
INCLUDES   = -I$(INCLUDEDIR)
LIBS       = -L$(LIBDIR) -l$(LIBFILE)

I've tried this approach

LIBFILE    = nr2c m

and

LIBFILE    = nr2c / m

with no luck. Any suggestions?

Upvotes: 0

Views: 502

Answers (1)

Beta
Beta

Reputation: 99154

I don't see why you want to do this, but here's a way:

LIBFILE = nr2c m
LIBS    = -L$(LIBDIR) $(addprefix -l, $(LIBFILE))

Upvotes: 2

Related Questions