I am using Ubuntu-gcc and have a large C code which uses routines from numerical recipes and GNU scientific library.
It needs a compilation compilation because each library, i.e. nr and GNUsl, needs its own flags for gcc.
Therefore I use a makefile. It works well when the code is only one file. But when the code is distributed into many files it does not work!
My question is that what should I write as the TARGET in the makefile. Either *.c or complete list of files do not work.
The scripts is :
CC = gcc CFLAGS = -Wall -lgsl -lgslcblas INSTALL_INCLUDEDIR = /usr/include/nr INSTALL_LIBDIR = /usr/lib/nr INSTALL_LIB = nr2c INCLUDEDIR = $(INSTALL_INCLUDEDIR) INCLUDES = -I$(INSTALL_INCLUDEDIR) LIBDIR = -L$(INSTALL_LIBDIR) LIBS = -l$(INSTALL_LIB) -lm #### What should I write here ????????? #### TARGET = build_grid.c cheb_2D_tring.c headers.c interp_tring.c nr_test.c polin2.c polint.c pre_proc.c read.c utilities.c OBJS = $(TARGET).o $(TARGET): $(OBJS) $(CC) $(OBJS) $(LIBDIR) $(LIBS) -o $(TARGET) .c.o: $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ clean: rm -f $(OBJS) $(TARGET)
Please help me !
Thanks in advance.