Hello,
I have some problems writing my makefile. I'm newbie writing makefiles because I use to make small programs. I have defined a library, functions.h and functions.c that uses the GNU scientific library. And then a program that calls functions from functions.h. My makefile is like this:
I have an error of undefined reference in every gnu scientific library function that I use. Someone can help me?Code:
SDIR = source directory
CC = gcc
CFLOPTS = -g
CFLAGS = $(CFLOPTS) -I$(SDIR)
CPROGS = main
OBJETOS = $(SDIR)/main.o $(SDIR)/funciones.o
all:$(CPROGS) $(OBJETOS)
clean:
rm -f *.o $(CPROGS)
main_RCS:$(OBJETOS)
$(CC) $(CFLAGS) -o $@ $(OBJETOS) -lm
mv $@ $(SDIR)
funciones_RCS.o:$(SDIR)/funciones.c $(SDIR)/funciones.h
$(CC) $(CFLAGS) /usr/local/lib/libgsl.a -o $@ -lm
mv $@ $(SDIR)
main_RCS.o:$(SDIR)/main.c $(SDIR)/funciones.h
mv $@ $(SDIR)