please help with the Makefile
I am a Ph.D student in Physics and a newbie in programing. I am running a code made by someone else and now I am stuck badly at a point.
I have a set of C codes [A1.c, A2.c, A3.c, A4.c].
A2.c, A3.c and A4.c have different tasks and A1.c is the main program which is calling the other 3 codes as and when required.
To compile all of them togtether, I have a Makefile which is :
To compile and run, I do the following :
CPATHS= -L /usr/local/lib
ALL : prog
prog : A1.c
cc $(CPATHS) -O4 -Wall -o prog A1.c A2.c A3.c A4.c $(LIBS)
alice@alice-laptop:~$ make clean
alice@alice-laptop:~$ ./prog value1 value2
But now I have identified some problem in A4.c and need to use a package, SUNDIALS package.
To run a single code, say equations.c, INDEPENDENTLY (i.e. not being compiled simultaneously with other codes) in SUNDIALS, I have to run a command :
alice@alice-laptop:~$ cc -I/usr/local/sundials/include equations.c -L/usr/local/sundials/lib -lsundials_cvode -lsundials_nvecserial -lm
But now I have to run A4.c using SUNDIALS, along with the other codes (i.e. A1.c A2.c A3.c), as I was doing earlier.
What modifications should I make in my Makefile so that A1.c A2.c A3.c A4.c are all compiled together, as it was being done earlier, but A4.c can also use the package SUNDIALS ??