1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

makefile compile gsl and numerical recipes

Discussion in 'Shell Script' started by habib_parisa, Aug 28, 2010.

  1. habib_parisa

    habib_parisa New Member

    Aug 28, 2010
    Likes Received:
    Trophy Points:
    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


    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)

    $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

    rm -f $(OBJS) $(TARGET)
    Please help me !

    Thanks in advance.

Share This Page